diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 22:30:57 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 22:30:57 +0000 |
commit | e8749c99e678b18cf1b0b4051fab7d518e9ef0f9 (patch) | |
tree | cb496300d8809184e48012b299785eee8da9c466 /base/values_unittest.cc | |
parent | 834e1940adac0d36fa796b0bea95e39eb03bae4e (diff) | |
download | chromium_src-e8749c99e678b18cf1b0b4051fab7d518e9ef0f9.zip chromium_src-e8749c99e678b18cf1b0b4051fab7d518e9ef0f9.tar.gz chromium_src-e8749c99e678b18cf1b0b4051fab7d518e9ef0f9.tar.bz2 |
Revert "Added std::string to Value via Set/GetString overloading."
Review URL: http://codereview.chromium.org/13358
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/values_unittest.cc')
-rw-r--r-- | base/values_unittest.cc | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/base/values_unittest.cc b/base/values_unittest.cc index 1a78089..67515ec 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -93,30 +93,6 @@ TEST(ValuesTest, BinaryValue) { delete binary; } -TEST(ValuesTest, StringValue) { - // Test overloaded CreateStringValue. - Value* narrow_value = Value::CreateStringValue("narrow"); - ASSERT_TRUE(narrow_value); - ASSERT_TRUE(narrow_value->IsType(Value::TYPE_STRING)); - Value* wide_value = Value::CreateStringValue(L"wide"); - ASSERT_TRUE(wide_value); - ASSERT_TRUE(wide_value->IsType(Value::TYPE_STRING)); - - // Test overloaded GetString. - std::string narrow = "http://google.com"; - std::wstring wide = L"http://google.com"; - ASSERT_TRUE(narrow_value->GetAsString(&narrow)); - ASSERT_TRUE(narrow_value->GetAsString(&wide)); - ASSERT_EQ(std::string("narrow"), narrow); - ASSERT_EQ(std::wstring(L"narrow"), wide); - ASSERT_TRUE(wide_value->GetAsString(&narrow)); - ASSERT_TRUE(wide_value->GetAsString(&wide)); - ASSERT_EQ(std::string("wide"), narrow); - ASSERT_EQ(std::wstring(L"wide"), wide); - delete narrow_value; - delete wide_value; -} - // This is a Value object that allows us to tell if it's been // properly deleted by modifying the value of external flag on destruction. class DeletionTestValue : public Value { @@ -266,10 +242,8 @@ TEST(ValuesTest, DeepCopy) { original_dict.Set(L"int", original_int); Value* original_real = Value::CreateRealValue(3.14); original_dict.Set(L"real", original_real); - Value* original_string = Value::CreateStringValue("hello"); + Value* original_string = Value::CreateStringValue(L"peek-a-boo"); original_dict.Set(L"string", original_string); - Value* original_wstring = Value::CreateStringValue(L"peek-a-boo"); - original_dict.Set(L"wstring", original_wstring); char* original_buffer = new char[42]; memset(original_buffer, '!', 42); @@ -326,22 +300,9 @@ TEST(ValuesTest, DeepCopy) { ASSERT_TRUE(copy_string); ASSERT_NE(copy_string, original_string); ASSERT_TRUE(copy_string->IsType(Value::TYPE_STRING)); - std::string copy_string_value; - std::wstring copy_wstring_value; + std::wstring copy_string_value; ASSERT_TRUE(copy_string->GetAsString(©_string_value)); - ASSERT_TRUE(copy_string->GetAsString(©_wstring_value)); - ASSERT_EQ(std::string("hello"), copy_string_value); - ASSERT_EQ(std::wstring(L"hello"), copy_wstring_value); - - Value* copy_wstring = NULL; - ASSERT_TRUE(copy_dict->Get(L"wstring", ©_wstring)); - ASSERT_TRUE(copy_wstring); - ASSERT_NE(copy_wstring, original_wstring); - ASSERT_TRUE(copy_wstring->IsType(Value::TYPE_STRING)); - ASSERT_TRUE(copy_wstring->GetAsString(©_string_value)); - ASSERT_TRUE(copy_wstring->GetAsString(©_wstring_value)); - ASSERT_EQ(std::string("peek-a-boo"), copy_string_value); - ASSERT_EQ(std::wstring(L"peek-a-boo"), copy_wstring_value); + ASSERT_EQ(std::wstring(L"peek-a-boo"), copy_string_value); Value* copy_binary = NULL; ASSERT_TRUE(copy_dict->Get(L"binary", ©_binary)); @@ -399,8 +360,7 @@ TEST(ValuesTest, Equals) { dv.SetBoolean(L"a", false); dv.SetInteger(L"b", 2); dv.SetReal(L"c", 2.5); - dv.SetString(L"d1", "string"); - dv.SetString(L"d2", L"string"); + dv.SetString(L"d", L"string"); dv.Set(L"e", Value::CreateNullValue()); DictionaryValue* copy = static_cast<DictionaryValue*>(dv.DeepCopy()); |