Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: apps/benchmark/event_unittest.cc

Issue 1381933002: Fix the benchmark app to handle real-world events (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« apps/benchmark/event.cc ('K') | « apps/benchmark/event.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "apps/benchmark/event.h" 5 #include "apps/benchmark/event.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_EQ(base::TimeTicks::FromInternalValue(1), events[0].timestamp); 171 EXPECT_EQ(base::TimeTicks::FromInternalValue(1), events[0].timestamp);
172 EXPECT_EQ(base::TimeDelta::FromInternalValue(2), events[0].duration); 172 EXPECT_EQ(base::TimeDelta::FromInternalValue(2), events[0].duration);
173 173
174 EXPECT_EQ(EventType::COMPLETE, events[1].type); 174 EXPECT_EQ(EventType::COMPLETE, events[1].type);
175 EXPECT_EQ("t2 event", events[1].name); 175 EXPECT_EQ("t2 event", events[1].name);
176 EXPECT_EQ("cc", events[1].categories); 176 EXPECT_EQ("cc", events[1].categories);
177 EXPECT_EQ(base::TimeTicks::FromInternalValue(2), events[1].timestamp); 177 EXPECT_EQ(base::TimeTicks::FromInternalValue(2), events[1].timestamp);
178 EXPECT_EQ(base::TimeDelta::FromInternalValue(2), events[1].duration); 178 EXPECT_EQ(base::TimeDelta::FromInternalValue(2), events[1].duration);
179 } 179 }
180 180
181 TEST(GetEventsTest, AsyncEventsIsString) {
ppi 2015/10/01 13:09:44 AsyncEventsIdIsString
etiennej 2015/10/01 13:25:17 Done.
182 std::vector<std::string> event_specs(4);
183 event_specs[0] =
184 "{\"tid\":1001,\"id\":"\a\",\"ts\":1,\"ph\":\"S\",\"cat\":\"cc\","
185 "\"name\":\"t1 event\"}";
186 event_specs[2] =
187 "{\"tid\":1003,\"id\":\"a\",\"ts\":3,\"ph\":\"F\",\"cat\":\"cc\","
188 "\"name\":\"t1 event\"}";
189
190 std::string trace_json = "[" + JoinString(event_specs, ',') + "]";
191 std::vector<Event> events;
192 ASSERT_TRUE(GetEvents(trace_json, &events));
193 ASSERT_EQ(1u, events.size());
194
195 EXPECT_EQ(EventType::COMPLETE, events[0].type);
196 EXPECT_EQ("t1 event", events[0].name);
197 EXPECT_EQ("cc", events[0].categories);
198 EXPECT_EQ(base::TimeTicks::FromInternalValue(1), events[0].timestamp);
199 EXPECT_EQ(base::TimeDelta::FromInternalValue(2), events[0].duration);
200 }
201
181 } // namespace 202 } // namespace
182 203
183 } // namespace benchmark 204 } // namespace benchmark
OLDNEW
« apps/benchmark/event.cc ('K') | « apps/benchmark/event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698