[Mac] Use the app's version as the app shim bundle version.
[chromium-blink-merge.git] / base / trace_event / trace_event_argument_unittest.cc
blobc59910e44653537b8d5d27288ac0aa4c5083e610
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
3 // found in the LICENSE file.
5 #include "base/trace_event/trace_event_argument.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 namespace base {
9 namespace trace_event {
11 TEST(TraceEventArgumentTest, FlatDictionary) {
12 scoped_refptr<TracedValue> value = new TracedValue();
13 value->SetInteger("int", 2014);
14 value->SetDouble("double", 0.0);
15 value->SetBoolean("bool", true);
16 value->SetString("string", "string");
17 std::string json;
18 value->AppendAsTraceFormat(&json);
19 EXPECT_EQ("{\"bool\":true,\"double\":0.0,\"int\":2014,\"string\":\"string\"}",
20 json);
23 TEST(TraceEventArgumentTest, Hierarchy) {
24 scoped_refptr<TracedValue> value = new TracedValue();
25 value->SetInteger("i0", 2014);
26 value->BeginDictionary("dict1");
27 value->SetInteger("i1", 2014);
28 value->BeginDictionary("dict2");
29 value->SetBoolean("b2", false);
30 value->EndDictionary();
31 value->SetString("s1", "foo");
32 value->EndDictionary();
33 value->SetDouble("d0", 0.0);
34 value->SetBoolean("b0", true);
35 value->BeginArray("a1");
36 value->AppendInteger(1);
37 value->AppendBoolean(true);
38 value->BeginDictionary();
39 value->SetInteger("i2", 3);
40 value->EndDictionary();
41 value->EndArray();
42 value->SetString("s0", "foo");
43 std::string json;
44 value->AppendAsTraceFormat(&json);
45 EXPECT_EQ(
46 "{\"a1\":[1,true,{\"i2\":3}],\"b0\":true,\"d0\":0.0,\"dict1\":{\"dict2\":"
47 "{\"b2\":false},\"i1\":2014,\"s1\":\"foo\"},\"i0\":2014,\"s0\":"
48 "\"foo\"}",
49 json);
52 } // namespace trace_event
53 } // namespace base