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

Side by Side Diff: third_party/WebKit/Source/platform/TracedValueTest.cpp

Issue 1620673002: Remove Blink's ConvertableToTraceFormat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/TracedValue.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/TracedValue.h" 5 #include "platform/TracedValue.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 scoped_ptr<base::Value> parseTracedValue(PassRefPtr<TracedValue> value) 13 scoped_ptr<base::Value> parseTracedValue(PassRefPtr<TracedValue> value)
14 { 14 {
15 base::JSONReader reader; 15 base::JSONReader reader;
16 CString utf8 = value->asTraceFormat().utf8(); 16 CString utf8 = value->toString().utf8();
17 return reader.Read(utf8.data()); 17 return reader.Read(utf8.data());
18 } 18 }
19 19
20 TEST(TracedValueTest, FlatDictionary) 20 TEST(TracedValueTest, FlatDictionary)
21 { 21 {
22 RefPtr<TracedValue> value = TracedValue::create(); 22 RefPtr<TracedValue> value = TracedValue::create();
23 value->setInteger("int", 2014); 23 value->setInteger("int", 2014);
24 value->setDouble("double", 0.0); 24 value->setDouble("double", 0.0);
25 value->setBoolean("bool", true); 25 value->setBoolean("bool", true);
26 value->setString("string", "string"); 26 value->setString("string", "string");
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 EXPECT_EQ("\"value2\"", s2); 123 EXPECT_EQ("\"value2\"", s2);
124 std::string s3; 124 std::string s3;
125 EXPECT_TRUE(dictionary->GetString("s3\\", &s3)); 125 EXPECT_TRUE(dictionary->GetString("s3\\", &s3));
126 EXPECT_EQ("value3", s3); 126 EXPECT_EQ("value3", s3);
127 std::string s4; 127 std::string s4;
128 EXPECT_TRUE(dictionary->GetString("\"s4\"", &s4)); 128 EXPECT_TRUE(dictionary->GetString("\"s4\"", &s4));
129 EXPECT_EQ("value4", s4); 129 EXPECT_EQ("value4", s4);
130 } 130 }
131 131
132 } // namespace blink 132 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/TracedValue.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698