| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 | |
| 7 #include "platform/TracedValue.h" | 6 #include "platform/TracedValue.h" |
| 8 | 7 |
| 9 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
| 10 | 9 |
| 11 using namespace blink; | 10 namespace blink { |
| 12 | |
| 13 namespace { | |
| 14 | 11 |
| 15 TEST(TracedValueTest, FlatDictionary) | 12 TEST(TracedValueTest, FlatDictionary) |
| 16 { | 13 { |
| 17 RefPtr<TracedValue> value = TracedValue::create(); | 14 RefPtr<TracedValue> value = TracedValue::create(); |
| 18 value->setInteger("int", 2014); | 15 value->setInteger("int", 2014); |
| 19 value->setDouble("double", 0.0); | 16 value->setDouble("double", 0.0); |
| 20 value->setBoolean("bool", true); | 17 value->setBoolean("bool", true); |
| 21 value->setString("string", "string"); | 18 value->setString("string", "string"); |
| 22 String json = value->asTraceFormat(); | 19 String json = value->asTraceFormat(); |
| 23 EXPECT_EQ("{\"int\":2014,\"double\":0,\"bool\":true,\"string\":\"string\"}",
json); | 20 EXPECT_EQ("{\"int\":2014,\"double\":0,\"bool\":true,\"string\":\"string\"}",
json); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 41 value->pushBoolean(true); | 38 value->pushBoolean(true); |
| 42 value->beginDictionary(); | 39 value->beginDictionary(); |
| 43 value->setInteger("i2", 3); | 40 value->setInteger("i2", 3); |
| 44 value->endDictionary(); | 41 value->endDictionary(); |
| 45 value->endArray(); | 42 value->endArray(); |
| 46 value->setString("s0", "foo"); | 43 value->setString("s0", "foo"); |
| 47 String json = value->asTraceFormat(); | 44 String json = value->asTraceFormat(); |
| 48 EXPECT_EQ("{\"i0\":2014,\"dict1\":{\"i1\":2014,\"dict2\":{\"b2\":false},\"s1
\":\"foo\"},\"d0\":0,\"b0\":true,\"a1\":[1,true,{\"i2\":3}],\"s0\":\"foo\"}", js
on); | 45 EXPECT_EQ("{\"i0\":2014,\"dict1\":{\"i1\":2014,\"dict2\":{\"b2\":false},\"s1
\":\"foo\"},\"d0\":0,\"b0\":true,\"a1\":[1,true,{\"i2\":3}],\"s0\":\"foo\"}", js
on); |
| 49 } | 46 } |
| 50 | 47 |
| 51 } | 48 } // namespace blink |
| OLD | NEW |