tests/ceftests/values_unittest.cc
// Test get/set of a CefValue dictionary type.
Test get/set of a CefValue dictionary type.
Test get / set of a CefValue dictionary type .
TEST(ValuesTest, ValueDictionary) {
  CefRefPtr<CefDictionaryValue> dict_value = CreateDictionaryValue();
  CefRefPtr<CefValue> value = CefValue::Create();
  EXPECT_TRUE(value->SetDictionary(dict_value));
  EXPECT_EQ(VTYPE_DICTIONARY, value->GetType());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  CreateAndCompareCopy(value);
  CefRefPtr<CefDictionaryValue> dict_value2 = value->GetDictionary();
  EXPECT_TRUE(dict_value2.get());
  EXPECT_TRUE(dict_value2->IsValid());
  EXPECT_FALSE(dict_value2->IsOwned());
  EXPECT_FALSE(dict_value2->IsReadOnly());
  TestDictionaryEqual(dict_value, dict_value2);
  EXPECT_TRUE(dict_value->IsSame(dict_value2));
  EXPECT_TRUE(dict_value2->IsSame(dict_value));
  EXPECT_TRUE(dict_value->SetString(kKey1, kStringValue));
  EXPECT_EQ(VTYPE_STRING, dict_value->GetType(kKey1));
  EXPECT_STREQ(kStringValue, dict_value->GetString(kKey1).ToString().data());
}
TEST ( ValuesTest , ValueDictionary ) { CefRefPtr < CefDictionaryValue > dict_value = CreateDictionaryValue ( ) ; CefRefPtr < CefValue > value = CefValue :: Create ( ) ; EXPECT_TRUE ( value -> SetDictionary ( dict_value ) ) ; EXPECT_EQ ( VTYPE_DICTIONARY , value -> GetType ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; CreateAndCompareCopy ( value ) ; CefRefPtr < CefDictionaryValue > dict_value2 = value -> GetDictionary ( ) ; EXPECT_TRUE ( dict_value2 . get ( ) ) ; EXPECT_TRUE ( dict_value2 -> IsValid ( ) ) ; EXPECT_FALSE ( dict_value2 -> IsOwned ( ) ) ; EXPECT_FALSE ( dict_value2 -> IsReadOnly ( ) ) ; TestDictionaryEqual ( dict_value , dict_value2 ) ; EXPECT_TRUE ( dict_value -> IsSame ( dict_value2 ) ) ; EXPECT_TRUE ( dict_value2 -> IsSame ( dict_value ) ) ; EXPECT_TRUE ( dict_value -> SetString ( kKey1 , kStringValue ) ) ; EXPECT_EQ ( VTYPE_STRING , dict_value -> GetType ( kKey1 ) ) ; EXPECT_STREQ ( kStringValue , dict_value -> GetString ( kKey1 ) . ToString ( ) . data ( ) ) ; }
Test get/set of a CefValue dictionary type.
Test get / set of a CefValue dictionary type .
// Create the dictionary. // Create the value. // Get the dictionary reference from the value. // The dictionaries are the same and equal. // Change a value in one dictionary and verify that it's changed in the other // dictionary.