OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Test of classes in the tracked_objects.h classes. | 5 // Test of classes in the tracked_objects.h classes. |
6 | 6 |
7 #include "base/tracked_objects.h" | 7 #include "base/tracked_objects.h" |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 scoped_ptr<base::DictionaryValue> dictionary(data->ToValue()); | 144 scoped_ptr<base::DictionaryValue> dictionary(data->ToValue()); |
145 int integer; | 145 int integer; |
146 EXPECT_TRUE(dictionary->GetInteger("run_ms", &integer)); | 146 EXPECT_TRUE(dictionary->GetInteger("run_ms", &integer)); |
147 EXPECT_EQ(integer, 2 * run_ms); | 147 EXPECT_EQ(integer, 2 * run_ms); |
148 EXPECT_TRUE(dictionary->GetInteger("queue_ms", &integer)); | 148 EXPECT_TRUE(dictionary->GetInteger("queue_ms", &integer)); |
149 EXPECT_EQ(integer, 2 * queue_ms); | 149 EXPECT_EQ(integer, 2 * queue_ms); |
150 EXPECT_TRUE(dictionary->GetInteger("count", &integer)); | 150 EXPECT_TRUE(dictionary->GetInteger("count", &integer)); |
151 EXPECT_EQ(integer, 2); | 151 EXPECT_EQ(integer, 2); |
152 | 152 |
153 std::string output; | |
154 data->WriteHTML(&output); | |
155 std::string results = "Lives:2, " | |
156 "Run:84ms(42ms/life,max:42ms) " | |
157 "Queue:16ms(8ms/life,max:8ms) "; | |
158 EXPECT_EQ(results, output); | |
159 | |
160 scoped_ptr<base::Value> value(data->ToValue()); | 153 scoped_ptr<base::Value> value(data->ToValue()); |
161 std::string json; | 154 std::string json; |
162 base::JSONWriter::Write(value.get(), false, &json); | 155 base::JSONWriter::Write(value.get(), false, &json); |
163 std::string birth_only_result = "{" | 156 std::string birth_only_result = "{" |
164 "\"count\":2," | 157 "\"count\":2," |
165 "\"queue_ms\":16," | 158 "\"queue_ms\":16," |
166 "\"queue_ms_max\":8," | 159 "\"queue_ms_max\":8," |
167 "\"run_ms\":84," | 160 "\"run_ms\":84," |
168 "\"run_ms_max\":42" | 161 "\"run_ms_max\":42" |
169 "}"; | 162 "}"; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 "\"line_number\":999" | 620 "\"line_number\":999" |
628 "}" | 621 "}" |
629 "}" | 622 "}" |
630 "]" | 623 "]" |
631 "}"; | 624 "}"; |
632 EXPECT_EQ(one_line_result, json); | 625 EXPECT_EQ(one_line_result, json); |
633 } | 626 } |
634 | 627 |
635 | 628 |
636 } // namespace tracked_objects | 629 } // namespace tracked_objects |
OLD | NEW |