summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-15 18:37:10 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-15 18:37:10 +0000
commit16b527168c7fcdc36588379c3c30225493265689 (patch)
tree9b413147539b9d9cd929dc4200d34d312aff33d6 /base
parent0d93778842822187888671cffa788a3524687864 (diff)
downloadchromium_src-16b527168c7fcdc36588379c3c30225493265689.zip
chromium_src-16b527168c7fcdc36588379c3c30225493265689.tar.gz
chromium_src-16b527168c7fcdc36588379c3c30225493265689.tar.bz2
Remove (deprecated) wstring version of Value::CreateStringValue().
BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3136012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/json/json_reader.cc2
-rw-r--r--base/values.cc10
-rw-r--r--base/values.h3
-rw-r--r--base/values_unittest.cc27
4 files changed, 3 insertions, 39 deletions
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index 0818f93..391f58b3 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -504,7 +504,7 @@ Value* JSONReader::DecodeString(const Token& token) {
decoded_str.push_back(c);
}
}
- return Value::CreateStringValue(decoded_str);
+ return Value::CreateStringValue(WideToUTF16Hack(decoded_str));
}
JSONReader::Token JSONReader::ParseToken() {
diff --git a/base/values.cc b/base/values.cc
index d4b01c8..7e348dc 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -94,14 +94,6 @@ Value* Value::CreateStringValue(const string16& in_value) {
return new StringValue(in_value);
}
-#if !defined(WCHAR_T_IS_UTF16)
-// TODO(viettrungluu): Deprecated and to be removed:
-// static
-Value* Value::CreateStringValue(const std::wstring& in_value) {
- return new StringValue(in_value);
-}
-#endif
-
// static
BinaryValue* Value::CreateBinaryValue(char* buffer, size_t size) {
return BinaryValue::Create(buffer, size);
@@ -481,7 +473,7 @@ void DictionaryValue::SetString(const std::wstring& path,
// TODO(viettrungluu): Deprecated and to be removed:
void DictionaryValue::SetString(const std::wstring& path,
const std::wstring& in_value) {
- Set(path, CreateStringValue(in_value));
+ Set(WideToUTF8(path), CreateStringValue(WideToUTF8(in_value)));
}
#endif
diff --git a/base/values.h b/base/values.h
index b4e0892..01a2cf4 100644
--- a/base/values.h
+++ b/base/values.h
@@ -57,9 +57,6 @@ class Value {
static Value* CreateRealValue(double in_value);
static Value* CreateStringValue(const std::string& in_value);
static Value* CreateStringValue(const string16& in_value);
-#if !defined(WCHAR_T_IS_UTF16)
- /*DEPRECATED*/static Value* CreateStringValue(const std::wstring& in_value);
-#endif
// This one can return NULL if the input isn't valid. If the return value
// is non-null, the new object has taken ownership of the buffer pointer.
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index a3e7353..3b78b5f 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -38,8 +38,7 @@ class ValuesTest: public testing::Test {
// to std::string. I've temporarily kept the old methods taking std::wstring for
// compatibility. The ...Deprecated tests are the old tests which use these
// methods, and remain to test compatibility. They will be removed once the old
-// methods are removed. There are also parts of tests marked DEPRECATED which
-// are to be deleted.
+// methods are removed.
TEST_F(ValuesTest, Basic) {
// Test basic dictionary getting/setting
@@ -228,9 +227,6 @@ TEST_F(ValuesTest, StringValueDeprecated) {
scoped_ptr<Value> narrow_value(Value::CreateStringValue("narrow"));
ASSERT_TRUE(narrow_value.get());
ASSERT_TRUE(narrow_value->IsType(Value::TYPE_STRING));
- scoped_ptr<Value> wide_value(Value::CreateStringValue(L"wide"));
- ASSERT_TRUE(wide_value.get());
- ASSERT_TRUE(wide_value->IsType(Value::TYPE_STRING));
scoped_ptr<Value> utf16_value(
Value::CreateStringValue(ASCIIToUTF16("utf16")));
ASSERT_TRUE(utf16_value.get());
@@ -247,13 +243,6 @@ TEST_F(ValuesTest, StringValueDeprecated) {
ASSERT_EQ(std::wstring(L"narrow"), wide);
ASSERT_EQ(ASCIIToUTF16("narrow"), utf16);
- ASSERT_TRUE(wide_value->GetAsString(&narrow));
- ASSERT_TRUE(wide_value->GetAsString(&wide));
- ASSERT_TRUE(wide_value->GetAsString(&utf16));
- ASSERT_EQ(std::string("wide"), narrow);
- ASSERT_EQ(std::wstring(L"wide"), wide);
- ASSERT_EQ(ASCIIToUTF16("wide"), utf16);
-
ASSERT_TRUE(utf16_value->GetAsString(&narrow));
ASSERT_TRUE(utf16_value->GetAsString(&wide));
ASSERT_TRUE(utf16_value->GetAsString(&utf16));
@@ -632,8 +621,6 @@ TEST_F(ValuesTest, DeepCopyDeprecated) {
original_dict.Set(L"real", original_real);
Value* original_string = Value::CreateStringValue("hello");
original_dict.Set(L"string", original_string);
- Value* original_wstring = Value::CreateStringValue(L"peek-a-boo");
- original_dict.Set(L"wstring", original_wstring);
Value* original_utf16 = Value::CreateStringValue(ASCIIToUTF16("hello16"));
original_dict.Set(L"utf16", original_utf16);
@@ -702,18 +689,6 @@ TEST_F(ValuesTest, DeepCopyDeprecated) {
ASSERT_EQ(std::wstring(L"hello"), copy_wstring_value);
ASSERT_EQ(ASCIIToUTF16("hello"), copy_utf16_value);
- Value* copy_wstring = NULL;
- ASSERT_TRUE(copy_dict->Get(L"wstring", &copy_wstring));
- ASSERT_TRUE(copy_wstring);
- ASSERT_NE(copy_wstring, original_wstring);
- ASSERT_TRUE(copy_wstring->IsType(Value::TYPE_STRING));
- ASSERT_TRUE(copy_wstring->GetAsString(&copy_string_value));
- ASSERT_TRUE(copy_wstring->GetAsString(&copy_wstring_value));
- ASSERT_TRUE(copy_wstring->GetAsString(&copy_utf16_value));
- ASSERT_EQ(std::string("peek-a-boo"), copy_string_value);
- ASSERT_EQ(std::wstring(L"peek-a-boo"), copy_wstring_value);
- ASSERT_EQ(ASCIIToUTF16("peek-a-boo"), copy_utf16_value);
-
Value* copy_utf16 = NULL;
ASSERT_TRUE(copy_dict->Get(L"utf16", &copy_utf16));
ASSERT_TRUE(copy_utf16);