Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Unified Diff: base/json/json_writer_unittest.cc

Issue 11519026: base: Do not use Value::Create* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scoped_ptr Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_parser.cc ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_writer_unittest.cc
diff --git a/base/json/json_writer_unittest.cc b/base/json/json_writer_unittest.cc
index c52a1df40418df6fbb1823822531ae89533f8d3b..7ddd7b462d6cde7c74c7d0767be2ba95dd4c6a8e 100644
--- a/base/json/json_writer_unittest.cc
+++ b/base/json/json_writer_unittest.cc
@@ -29,19 +29,19 @@ TEST(JSONWriterTest, Writing) {
delete root;
// Test Real values should always have a decimal or an 'e'.
- root = Value::CreateDoubleValue(1.0);
+ root = new FundamentalValue(1.0);
JSONWriter::Write(root, &output_js);
ASSERT_EQ("1.0", output_js);
delete root;
// Test Real values in the the range (-1, 1) must have leading zeros
- root = Value::CreateDoubleValue(0.2);
+ root = new FundamentalValue(0.2);
JSONWriter::Write(root, &output_js);
ASSERT_EQ("0.2", output_js);
delete root;
// Test Real values in the the range (-1, 1) must have leading zeros
- root = Value::CreateDoubleValue(-0.8);
+ root = new FundamentalValue(-0.8);
JSONWriter::Write(root, &output_js);
ASSERT_EQ("-0.8", output_js);
delete root;
@@ -56,7 +56,7 @@ TEST(JSONWriterTest, Writing) {
inner_dict->SetInteger("inner int", 10);
ListValue* inner_list = new ListValue;
list->Append(inner_list);
- list->Append(Value::CreateBooleanValue(true));
+ list->Append(new FundamentalValue(true));
// Test the pretty-printer.
JSONWriter::Write(&root_dict, &output_js);
@@ -80,18 +80,17 @@ TEST(JSONWriterTest, Writing) {
// Test keys with periods
DictionaryValue period_dict;
- period_dict.SetWithoutPathExpansion("a.b", Value::CreateIntegerValue(3));
- period_dict.SetWithoutPathExpansion("c", Value::CreateIntegerValue(2));
+ period_dict.SetWithoutPathExpansion("a.b", new FundamentalValue(3));
+ period_dict.SetWithoutPathExpansion("c", new FundamentalValue(2));
DictionaryValue* period_dict2 = new DictionaryValue;
- period_dict2->SetWithoutPathExpansion("g.h.i.j",
- Value::CreateIntegerValue(1));
+ period_dict2->SetWithoutPathExpansion("g.h.i.j", new FundamentalValue(1));
period_dict.SetWithoutPathExpansion("d.e.f", period_dict2);
JSONWriter::Write(&period_dict, &output_js);
ASSERT_EQ("{\"a.b\":3,\"c\":2,\"d.e.f\":{\"g.h.i.j\":1}}", output_js);
DictionaryValue period_dict3;
- period_dict3.Set("a.b", Value::CreateIntegerValue(2));
- period_dict3.SetWithoutPathExpansion("a.b", Value::CreateIntegerValue(1));
+ period_dict3.Set("a.b", new FundamentalValue(2));
+ period_dict3.SetWithoutPathExpansion("a.b", new FundamentalValue(1));
JSONWriter::Write(&period_dict3, &output_js);
ASSERT_EQ("{\"a\":{\"b\":2},\"a.b\":1}", output_js);
@@ -103,18 +102,18 @@ TEST(JSONWriterTest, Writing) {
delete root;
ListValue binary_list;
- binary_list.Append(Value::CreateIntegerValue(5));
+ binary_list.Append(new FundamentalValue(5));
binary_list.Append(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
- binary_list.Append(Value::CreateIntegerValue(2));
+ binary_list.Append(new FundamentalValue(2));
JSONWriter::WriteWithOptions(&binary_list,
JSONWriter::OPTIONS_OMIT_BINARY_VALUES,
&output_js);
ASSERT_EQ("[5,2]", output_js);
DictionaryValue binary_dict;
- binary_dict.Set("a", Value::CreateIntegerValue(5));
+ binary_dict.Set("a", new FundamentalValue(5));
binary_dict.Set("b", BinaryValue::CreateWithCopiedBuffer("asdf", 4));
- binary_dict.Set("c", Value::CreateIntegerValue(2));
+ binary_dict.Set("c", new FundamentalValue(2));
JSONWriter::WriteWithOptions(&binary_dict,
JSONWriter::OPTIONS_OMIT_BINARY_VALUES,
&output_js);
« no previous file with comments | « base/json/json_parser.cc ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698