| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 ASSERT_TRUE(events[i]->data()->GetInteger("eventType", &event_type)); | 137 ASSERT_TRUE(events[i]->data()->GetInteger("eventType", &event_type)); |
| 138 ASSERT_EQ(expected_event_types[i], event_type); | 138 ASSERT_EQ(expected_event_types[i], event_type); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace | 142 } // namespace |
| 143 | 143 |
| 144 class PerformanceMonitorBrowserTest : public ExtensionBrowserTest { | 144 class PerformanceMonitorBrowserTest : public ExtensionBrowserTest { |
| 145 public: | 145 public: |
| 146 virtual void SetUpOnMainThread() OVERRIDE { | 146 virtual void SetUpOnMainThread() OVERRIDE { |
| 147 ExtensionBrowserTest::SetUpOnMainThread(); |
| 147 CHECK(db_dir_.CreateUniqueTempDir()); | 148 CHECK(db_dir_.CreateUniqueTempDir()); |
| 148 performance_monitor_ = PerformanceMonitor::GetInstance(); | 149 performance_monitor_ = PerformanceMonitor::GetInstance(); |
| 149 performance_monitor_->SetDatabasePath(db_dir_.path()); | 150 performance_monitor_->SetDatabasePath(db_dir_.path()); |
| 150 | 151 |
| 151 // PerformanceMonitor's initialization process involves a significant | 152 // PerformanceMonitor's initialization process involves a significant |
| 152 // amount of thread-hopping between the UI thread and the background thread. | 153 // amount of thread-hopping between the UI thread and the background thread. |
| 153 // If we begin the tests prior to full initialization, we cannot predict | 154 // If we begin the tests prior to full initialization, we cannot predict |
| 154 // the behavior or mock synchronicity as we must. Wait for initialization | 155 // the behavior or mock synchronicity as we must. Wait for initialization |
| 155 // to complete fully before proceeding with the test. | 156 // to complete fully before proceeding with the test. |
| 156 content::WindowedNotificationObserver windowed_observer( | 157 content::WindowedNotificationObserver windowed_observer( |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 test_server()->GetURL(std::string("files/").append("title2.html"))); | 787 test_server()->GetURL(std::string("files/").append("title2.html"))); |
| 787 | 788 |
| 788 performance_monitor()->DoTimedCollections(); | 789 performance_monitor()->DoTimedCollections(); |
| 789 | 790 |
| 790 metrics = GetStats(METRIC_NETWORK_BYTES_READ); | 791 metrics = GetStats(METRIC_NETWORK_BYTES_READ); |
| 791 ASSERT_EQ(2u, metrics.size()); | 792 ASSERT_EQ(2u, metrics.size()); |
| 792 EXPECT_GE(metrics[1].value, page1_size + page2_size); | 793 EXPECT_GE(metrics[1].value, page1_size + page2_size); |
| 793 } | 794 } |
| 794 | 795 |
| 795 } // namespace performance_monitor | 796 } // namespace performance_monitor |
| OLD | NEW |