| 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 "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 virtual void SetUpOnMainThread() OVERRIDE { | 124 virtual void SetUpOnMainThread() OVERRIDE { |
| 125 CHECK(db_dir_.CreateUniqueTempDir()); | 125 CHECK(db_dir_.CreateUniqueTempDir()); |
| 126 performance_monitor_ = PerformanceMonitor::GetInstance(); | 126 performance_monitor_ = PerformanceMonitor::GetInstance(); |
| 127 performance_monitor_->SetDatabasePath(db_dir_.path()); | 127 performance_monitor_->SetDatabasePath(db_dir_.path()); |
| 128 | 128 |
| 129 // PerformanceMonitor's initialization process involves a significant | 129 // PerformanceMonitor's initialization process involves a significant |
| 130 // amount of thread-hopping between the UI thread and the background thread. | 130 // amount of thread-hopping between the UI thread and the background thread. |
| 131 // If we begin the tests prior to full initialization, we cannot predict | 131 // If we begin the tests prior to full initialization, we cannot predict |
| 132 // the behavior or mock synchronicity as we must. Wait for initialization | 132 // the behavior or mock synchronicity as we must. Wait for initialization |
| 133 // to complete fully before proceeding with the test. | 133 // to complete fully before proceeding with the test. |
| 134 ui_test_utils::WindowedNotificationObserver windowed_observer( | 134 content::WindowedNotificationObserver windowed_observer( |
| 135 chrome::NOTIFICATION_PERFORMANCE_MONITOR_INITIALIZED, | 135 chrome::NOTIFICATION_PERFORMANCE_MONITOR_INITIALIZED, |
| 136 content::NotificationService::AllSources()); | 136 content::NotificationService::AllSources()); |
| 137 | 137 |
| 138 performance_monitor_->Start(); | 138 performance_monitor_->Start(); |
| 139 | 139 |
| 140 windowed_observer.Wait(); | 140 windowed_observer.Wait(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void GetEventsOnBackgroundThread(std::vector<linked_ptr<Event> >* events) { | 143 void GetEventsOnBackgroundThread(std::vector<linked_ptr<Event> >* events) { |
| 144 // base::Time is potentially flaky in that there is no guarantee that it | 144 // base::Time is potentially flaky in that there is no guarantee that it |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 std::vector<ExtensionBasicInfo> extension_infos; | 282 std::vector<ExtensionBasicInfo> extension_infos; |
| 283 extension_infos.push_back(ExtensionBasicInfo(extension)); | 283 extension_infos.push_back(ExtensionBasicInfo(extension)); |
| 284 | 284 |
| 285 ExtensionService* extension_service = | 285 ExtensionService* extension_service = |
| 286 browser()->profile()->GetExtensionService(); | 286 browser()->profile()->GetExtensionService(); |
| 287 | 287 |
| 288 CrxInstaller* crx_installer = NULL; | 288 CrxInstaller* crx_installer = NULL; |
| 289 | 289 |
| 290 // Create an observer to wait for the update to finish. | 290 // Create an observer to wait for the update to finish. |
| 291 ui_test_utils::WindowedNotificationObserver windowed_observer( | 291 content::WindowedNotificationObserver windowed_observer( |
| 292 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 292 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 293 content::Source<CrxInstaller>(crx_installer)); | 293 content::Source<CrxInstaller>(crx_installer)); |
| 294 ASSERT_TRUE(extension_service-> | 294 ASSERT_TRUE(extension_service-> |
| 295 UpdateExtension(extension->id(), path_v2_, GURL(), &crx_installer)); | 295 UpdateExtension(extension->id(), path_v2_, GURL(), &crx_installer)); |
| 296 windowed_observer.Wait(); | 296 windowed_observer.Wait(); |
| 297 | 297 |
| 298 extension = extension_service->GetExtensionById( | 298 extension = extension_service->GetExtensionById( |
| 299 extension_infos[0].id, false); // don't include disabled extensions. | 299 extension_infos[0].id, false); // don't include disabled extensions. |
| 300 | 300 |
| 301 // The total series of events for this process will be: | 301 // The total series of events for this process will be: |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 DISABLED_RendererCrashEvent) { | 414 DISABLED_RendererCrashEvent) { |
| 415 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); | 415 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); |
| 416 | 416 |
| 417 std::vector<linked_ptr<Event> > events = GetEvents(); | 417 std::vector<linked_ptr<Event> > events = GetEvents(); |
| 418 ASSERT_EQ(1u, events.size()); | 418 ASSERT_EQ(1u, events.size()); |
| 419 | 419 |
| 420 CheckEventType(EVENT_RENDERER_CRASH, events[0]); | 420 CheckEventType(EVENT_RENDERER_CRASH, events[0]); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace performance_monitor | 423 } // namespace performance_monitor |
| OLD | NEW |