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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 304 |
305 TEST_F(PerformanceMonitorDatabaseEventTest, GetAllEventTypes) { | 305 TEST_F(PerformanceMonitorDatabaseEventTest, GetAllEventTypes) { |
306 Database::EventTypeSet types = db_->GetEventTypes(); | 306 Database::EventTypeSet types = db_->GetEventTypes(); |
307 ASSERT_EQ(2u, types.size()); | 307 ASSERT_EQ(2u, types.size()); |
308 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_INSTALL)); | 308 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_INSTALL)); |
309 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_UNINSTALL)); | 309 ASSERT_EQ(1u, types.count(EVENT_EXTENSION_UNINSTALL)); |
310 } | 310 } |
311 | 311 |
312 TEST_F(PerformanceMonitorDatabaseEventTest, GetEventInTimeRange) { | 312 TEST_F(PerformanceMonitorDatabaseEventTest, GetEventInTimeRange) { |
313 base::Time start_time = clock_->GetTime(); | 313 base::Time start_time = clock_->GetTime(); |
314 scoped_ptr<Event> crash_event = util::CreateRendererFreezeEvent( | 314 scoped_ptr<Event> crash_event = util::CreateRendererFailureEvent( |
315 clock_->GetTime(), "chrome://freeze"); | 315 clock_->GetTime(), EVENT_RENDERER_CRASH, "http://www.google.com/"); |
316 db_->AddEvent(*crash_event.get()); | 316 db_->AddEvent(*crash_event.get()); |
317 Database::EventVector events = db_->GetEvents(start_time, clock_->GetTime()); | 317 Database::EventVector events = db_->GetEvents(start_time, clock_->GetTime()); |
318 ASSERT_EQ(1u, events.size()); | 318 ASSERT_EQ(1u, events.size()); |
319 EXPECT_TRUE(events[0]->data()->Equals(crash_event->data())); | 319 EXPECT_TRUE(events[0]->data()->Equals(crash_event->data())); |
320 } | 320 } |
321 | 321 |
322 TEST_F(PerformanceMonitorDatabaseEventTest, GetInstallEvents) { | 322 TEST_F(PerformanceMonitorDatabaseEventTest, GetInstallEvents) { |
323 Database::EventVector events = db_->GetEvents(EVENT_EXTENSION_INSTALL); | 323 Database::EventVector events = db_->GetEvents(EVENT_EXTENSION_INSTALL); |
324 ASSERT_EQ(2u, events.size()); | 324 ASSERT_EQ(2u, events.size()); |
325 EXPECT_TRUE(events[0]->data()->Equals(install_event_1_->data())); | 325 EXPECT_TRUE(events[0]->data()->Equals(install_event_1_->data())); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 db_->AddMetric(kProcessChromeAggregate, | 524 db_->AddMetric(kProcessChromeAggregate, |
525 Metric(METRIC_CPU_USAGE, clock_->GetTime(), 21.0)); | 525 Metric(METRIC_CPU_USAGE, clock_->GetTime(), 21.0)); |
526 Database::MetricVector stats = | 526 Database::MetricVector stats = |
527 db_->GetStatsForActivityAndMetric(METRIC_CPU_USAGE, start, end); | 527 db_->GetStatsForActivityAndMetric(METRIC_CPU_USAGE, start, end); |
528 ASSERT_EQ(2u, stats.size()); | 528 ASSERT_EQ(2u, stats.size()); |
529 ASSERT_EQ(3, stats[0].value); | 529 ASSERT_EQ(3, stats[0].value); |
530 ASSERT_EQ(9, stats[1].value); | 530 ASSERT_EQ(9, stats[1].value); |
531 } | 531 } |
532 | 532 |
533 } // namespace performance_monitor | 533 } // namespace performance_monitor |
OLD | NEW |