tests/ceftests/values_unittest.cc
// Test association of a CefValue simple type with a CefDictionaryValue.
Test association of a CefValue simple type with a CefDictionaryValue.
Test association of a CefValue simple type with a CefDictionaryValue .
TEST(ValuesTest, ValueSimpleToDictionary) {
  const double double_value = 5.665;
  const char* key = "key";
  CefRefPtr<CefValue> value = CefValue::Create();
  EXPECT_TRUE(value->SetDouble(double_value));
  CefRefPtr<CefDictionaryValue> target_dict = CefDictionaryValue::Create();
  EXPECT_TRUE(target_dict->SetValue(key, value));
  EXPECT_EQ(VTYPE_DOUBLE, target_dict->GetType(key));
  EXPECT_EQ(double_value, target_dict->GetDouble(key));
  CefRefPtr<CefValue> value2 = target_dict->GetValue(key);
  EXPECT_TRUE(value2.get());
  EXPECT_FALSE(value2->IsOwned());
  EXPECT_FALSE(value2->IsReadOnly());
  EXPECT_EQ(VTYPE_DOUBLE, value2->GetType());
  EXPECT_EQ(double_value, value2->GetDouble());
  EXPECT_TRUE(value->IsEqual(value2));
  EXPECT_TRUE(value2->IsEqual(value));
  EXPECT_FALSE(value->IsSame(value2));
  EXPECT_FALSE(value2->IsSame(value));
  EXPECT_TRUE(target_dict->SetInt(key, 5));
  EXPECT_EQ(VTYPE_INT, target_dict->GetType(key));
  EXPECT_EQ(5, target_dict->GetInt(key));
  EXPECT_TRUE(value->IsValid());
  EXPECT_TRUE(value2->IsValid());
}
TEST ( ValuesTest , ValueSimpleToDictionary ) { const double double_value = 5.665 ; const char * key = " " ; CefRefPtr < CefValue > value = CefValue :: Create ( ) ; EXPECT_TRUE ( value -> SetDouble ( double_value ) ) ; CefRefPtr < CefDictionaryValue > target_dict = CefDictionaryValue :: Create ( ) ; EXPECT_TRUE ( target_dict -> SetValue ( key , value ) ) ; EXPECT_EQ ( VTYPE_DOUBLE , target_dict -> GetType ( key ) ) ; EXPECT_EQ ( double_value , target_dict -> GetDouble ( key ) ) ; CefRefPtr < CefValue > value2 = target_dict -> GetValue ( key ) ; EXPECT_TRUE ( value2 . get ( ) ) ; EXPECT_FALSE ( value2 -> IsOwned ( ) ) ; EXPECT_FALSE ( value2 -> IsReadOnly ( ) ) ; EXPECT_EQ ( VTYPE_DOUBLE , value2 -> GetType ( ) ) ; EXPECT_EQ ( double_value , value2 -> GetDouble ( ) ) ; EXPECT_TRUE ( value -> IsEqual ( value2 ) ) ; EXPECT_TRUE ( value2 -> IsEqual ( value ) ) ; EXPECT_FALSE ( value -> IsSame ( value2 ) ) ; EXPECT_FALSE ( value2 -> IsSame ( value ) ) ; EXPECT_TRUE ( target_dict -> SetInt ( key , 5 ) ) ; EXPECT_EQ ( VTYPE_INT , target_dict -> GetType ( key ) ) ; EXPECT_EQ ( 5 , target_dict -> GetInt ( key ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_TRUE ( value2 -> IsValid ( ) ) ; }
Test association of a CefValue simple type with a CefDictionaryValue.
Test association of a CefValue simple type with a CefDictionaryValue .
// Add the value to the target dictionary. // Test the value in the target dictionary. // Get the value from the target dictionary. // Values are equal but not the same. // Change the value in the target dictionary. // The other values are still valid.