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/file_path.h" | 6 #include "base/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/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 base::Unretained(performance_monitor()))); | 260 base::Unretained(performance_monitor()))); |
261 | 261 |
262 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 262 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
263 } | 263 } |
264 | 264 |
265 PerformanceMonitor* performance_monitor() const { | 265 PerformanceMonitor* performance_monitor() const { |
266 return performance_monitor_; | 266 return performance_monitor_; |
267 } | 267 } |
268 | 268 |
269 protected: | 269 protected: |
270 ScopedTempDir db_dir_; | 270 base::ScopedTempDir db_dir_; |
271 PerformanceMonitor* performance_monitor_; | 271 PerformanceMonitor* performance_monitor_; |
272 }; | 272 }; |
273 | 273 |
274 class PerformanceMonitorUncleanExitBrowserTest | 274 class PerformanceMonitorUncleanExitBrowserTest |
275 : public PerformanceMonitorBrowserTest { | 275 : public PerformanceMonitorBrowserTest { |
276 public: | 276 public: |
277 virtual bool SetUpUserDataDirectory() OVERRIDE { | 277 virtual bool SetUpUserDataDirectory() OVERRIDE { |
278 FilePath user_data_directory; | 278 FilePath user_data_directory; |
279 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); | 279 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); |
280 | 280 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 expected_event_types.push_back(EVENT_EXTENSION_INSTALL); | 427 expected_event_types.push_back(EVENT_EXTENSION_INSTALL); |
428 expected_event_types.push_back(EVENT_EXTENSION_DISABLE); | 428 expected_event_types.push_back(EVENT_EXTENSION_DISABLE); |
429 expected_event_types.push_back(EVENT_EXTENSION_ENABLE); | 429 expected_event_types.push_back(EVENT_EXTENSION_ENABLE); |
430 | 430 |
431 Database::EventVector events = GetEvents(); | 431 Database::EventVector events = GetEvents(); |
432 CheckExtensionEvents(expected_event_types, events, extension_infos); | 432 CheckExtensionEvents(expected_event_types, events, extension_infos); |
433 } | 433 } |
434 | 434 |
435 // Test that PerformanceMonitor correctly records an extension update event. | 435 // Test that PerformanceMonitor correctly records an extension update event. |
436 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UpdateExtensionEvent) { | 436 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UpdateExtensionEvent) { |
437 ScopedTempDir temp_dir; | 437 base::ScopedTempDir temp_dir; |
438 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 438 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
439 | 439 |
440 FilePath test_data_dir; | 440 FilePath test_data_dir; |
441 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 441 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
442 test_data_dir = test_data_dir.AppendASCII("performance_monitor") | 442 test_data_dir = test_data_dir.AppendASCII("performance_monitor") |
443 .AppendASCII("extensions"); | 443 .AppendASCII("extensions"); |
444 | 444 |
445 // We need two versions of the same extension. | 445 // We need two versions of the same extension. |
446 FilePath pem_path = test_data_dir.AppendASCII("simple_extension.pem"); | 446 FilePath pem_path = test_data_dir.AppendASCII("simple_extension.pem"); |
447 FilePath path_v1_ = PackExtensionWithOptions( | 447 FilePath path_v1_ = PackExtensionWithOptions( |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 test_server()->GetURL(std::string("files/").append("title2.html"))); | 774 test_server()->GetURL(std::string("files/").append("title2.html"))); |
775 | 775 |
776 performance_monitor()->DoTimedCollections(); | 776 performance_monitor()->DoTimedCollections(); |
777 | 777 |
778 metrics = GetStats(METRIC_NETWORK_BYTES_READ); | 778 metrics = GetStats(METRIC_NETWORK_BYTES_READ); |
779 ASSERT_EQ(2u, metrics.size()); | 779 ASSERT_EQ(2u, metrics.size()); |
780 EXPECT_GE(metrics[1].value, page1_size + page2_size); | 780 EXPECT_GE(metrics[1].value, page1_size + page2_size); |
781 } | 781 } |
782 | 782 |
783 } // namespace performance_monitor | 783 } // namespace performance_monitor |
OLD | NEW |