OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/trace_event/trace_event_argument.h" | 5 #include "base/trace_event/trace_event_argument.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/googletest/include/gtest/gtest.h" |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 namespace trace_event { | 10 namespace trace_event { |
11 | 11 |
12 TEST(TraceEventArgumentTest, FlatDictionary) { | 12 TEST(TraceEventArgumentTest, FlatDictionary) { |
13 scoped_refptr<TracedValue> value = new TracedValue(); | 13 scoped_refptr<TracedValue> value = new TracedValue(); |
14 value->SetInteger("int", 2014); | 14 value->SetInteger("int", 2014); |
15 value->SetDouble("double", 0.0); | 15 value->SetDouble("double", 0.0); |
16 value->SetBoolean("bool", true); | 16 value->SetBoolean("bool", true); |
17 value->SetString("string", "string"); | 17 value->SetString("string", "string"); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 nested_dict_value->SetInteger("f", 3); | 150 nested_dict_value->SetInteger("f", 3); |
151 nested_dict_value->BeginDictionary("g"); | 151 nested_dict_value->BeginDictionary("g"); |
152 nested_dict_value->EndDictionary(); | 152 nested_dict_value->EndDictionary(); |
153 json = ""; | 153 json = ""; |
154 nested_dict_value->AppendAsTraceFormat(&json); | 154 nested_dict_value->AppendAsTraceFormat(&json); |
155 EXPECT_EQ("{\"b\":2,\"c\":[\"foo\"],\"f\":3,\"g\":{}}", json); | 155 EXPECT_EQ("{\"b\":2,\"c\":[\"foo\"],\"f\":3,\"g\":{}}", json); |
156 } | 156 } |
157 | 157 |
158 } // namespace trace_event | 158 } // namespace trace_event |
159 } // namespace base | 159 } // namespace base |
OLD | NEW |