OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 TEST_F(PerformanceMonitorDatabaseEventTest, GetAllEventTypes) { | 239 TEST_F(PerformanceMonitorDatabaseEventTest, GetAllEventTypes) { |
240 Database::EventTypeSet types = db_->GetEventTypes(); | 240 Database::EventTypeSet types = db_->GetEventTypes(); |
241 ASSERT_EQ(2u, types.size()); | 241 ASSERT_EQ(2u, types.size()); |
242 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_INSTALL)); | 242 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_INSTALL)); |
243 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_UNINSTALL)); | 243 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_UNINSTALL)); |
244 } | 244 } |
245 | 245 |
246 TEST_F(PerformanceMonitorDatabaseEventTest, GetEventInTimeRange) { | 246 TEST_F(PerformanceMonitorDatabaseEventTest, GetEventInTimeRange) { |
247 base::Time start_time = clock_->GetTime(); | 247 base::Time start_time = clock_->GetTime(); |
248 scoped_ptr<Event> crash_event = util::CreateRendererFreezeEvent( | 248 scoped_ptr<Event> crash_event = util::CreateRendererFailureEvent( |
249 clock_->GetTime(), "chrome://freeze"); | 249 clock_->GetTime(), EVENT_RENDERER_CRASH); |
250 db_->AddEvent(*crash_event.get()); | 250 db_->AddEvent(*crash_event.get()); |
251 Database::EventVector events = db_->GetEvents(start_time, clock_->GetTime()); | 251 Database::EventVector events = db_->GetEvents(start_time, clock_->GetTime()); |
252 ASSERT_EQ(1u, events.size()); | 252 ASSERT_EQ(1u, events.size()); |
253 EXPECT_TRUE(events[0]->data()->Equals(crash_event->data())); | 253 EXPECT_TRUE(events[0]->data()->Equals(crash_event->data())); |
254 } | 254 } |
255 | 255 |
256 TEST_F(PerformanceMonitorDatabaseEventTest, GetInstallEvents) { | 256 TEST_F(PerformanceMonitorDatabaseEventTest, GetInstallEvents) { |
257 Database::EventVector events = db_->GetEvents(EVENT_EXTENSION_INSTALL); | 257 Database::EventVector events = db_->GetEvents(EVENT_EXTENSION_INSTALL); |
258 ASSERT_EQ(2u, events.size()); | 258 ASSERT_EQ(2u, events.size()); |
259 EXPECT_TRUE(events[0]->data()->Equals(install_event_1_->data())); | 259 EXPECT_TRUE(events[0]->data()->Equals(install_event_1_->data())); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 base::Time end = clock_->GetTime(); | 402 base::Time end = clock_->GetTime(); |
403 db_->AddMetric(kProcessChromeAggregate, METRIC_CPU_USAGE, std::string("21")); | 403 db_->AddMetric(kProcessChromeAggregate, METRIC_CPU_USAGE, std::string("21")); |
404 Database::MetricVector stats = | 404 Database::MetricVector stats = |
405 db_->GetStatsForActivityAndMetric(METRIC_CPU_USAGE, start, end); | 405 db_->GetStatsForActivityAndMetric(METRIC_CPU_USAGE, start, end); |
406 ASSERT_EQ(2u, stats.size()); | 406 ASSERT_EQ(2u, stats.size()); |
407 ASSERT_EQ(3, stats[0].value); | 407 ASSERT_EQ(3, stats[0].value); |
408 ASSERT_EQ(9, stats[1].value); | 408 ASSERT_EQ(9, stats[1].value); |
409 } | 409 } |
410 | 410 |
411 } // namespace performance_monitor | 411 } // namespace performance_monitor |
OLD | NEW |