| 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 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 value->EndArray(); | 90 value->EndArray(); |
| 91 | 91 |
| 92 std::string json; | 92 std::string json; |
| 93 value->AppendAsTraceFormat(&json); | 93 value->AppendAsTraceFormat(&json); |
| 94 EXPECT_EQ("{\"a\":\"short\",\"b\":\"" + kLongString + "\",\"c\":[\"" + | 94 EXPECT_EQ("{\"a\":\"short\",\"b\":\"" + kLongString + "\",\"c\":[\"" + |
| 95 kLongString2 + "\",\"\",{\"a\":\"" + kLongString3 + "\"}]}", | 95 kLongString2 + "\",\"\",{\"a\":\"" + kLongString3 + "\"}]}", |
| 96 json); | 96 json); |
| 97 } | 97 } |
| 98 | 98 |
| 99 TEST(TraceEventArgumentTest, PassBaseValue) { | 99 TEST(TraceEventArgumentTest, PassBaseValue) { |
| 100 FundamentalValue int_value(42); | 100 Value int_value(42); |
| 101 FundamentalValue bool_value(true); | 101 Value bool_value(true); |
| 102 FundamentalValue double_value(42.0f); | 102 Value double_value(42.0f); |
| 103 | 103 |
| 104 auto dict_value = WrapUnique(new DictionaryValue); | 104 auto dict_value = WrapUnique(new DictionaryValue); |
| 105 dict_value->SetBoolean("bool", true); | 105 dict_value->SetBoolean("bool", true); |
| 106 dict_value->SetInteger("int", 42); | 106 dict_value->SetInteger("int", 42); |
| 107 dict_value->SetDouble("double", 42.0f); | 107 dict_value->SetDouble("double", 42.0f); |
| 108 dict_value->SetString("string", std::string("a") + "b"); | 108 dict_value->SetString("string", std::string("a") + "b"); |
| 109 dict_value->SetString("string", std::string("a") + "b"); | 109 dict_value->SetString("string", std::string("a") + "b"); |
| 110 | 110 |
| 111 auto list_value = WrapUnique(new ListValue); | 111 auto list_value = WrapUnique(new ListValue); |
| 112 list_value->AppendBoolean(false); | 112 list_value->AppendBoolean(false); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 nested_dict_value->SetInteger("f", 3); | 156 nested_dict_value->SetInteger("f", 3); |
| 157 nested_dict_value->BeginDictionary("g"); | 157 nested_dict_value->BeginDictionary("g"); |
| 158 nested_dict_value->EndDictionary(); | 158 nested_dict_value->EndDictionary(); |
| 159 json = ""; | 159 json = ""; |
| 160 nested_dict_value->AppendAsTraceFormat(&json); | 160 nested_dict_value->AppendAsTraceFormat(&json); |
| 161 EXPECT_EQ("{\"b\":2,\"c\":[\"foo\"],\"f\":3,\"g\":{}}", json); | 161 EXPECT_EQ("{\"b\":2,\"c\":[\"foo\"],\"f\":3,\"g\":{}}", json); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace trace_event | 164 } // namespace trace_event |
| 165 } // namespace base | 165 } // namespace base |
| OLD | NEW |