| 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/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/extensions/app_shortcut_manager.h" | 17 #include "chrome/browser/extensions/app_shortcut_manager.h" |
| 18 #include "chrome/browser/extensions/component_loader.h" | 18 #include "chrome/browser/extensions/component_loader.h" |
| 19 #include "chrome/browser/extensions/crx_installer.h" | 19 #include "chrome/browser/extensions/crx_installer.h" |
| 20 #include "chrome/browser/extensions/extension_creator.h" | 20 #include "chrome/browser/extensions/extension_creator.h" |
| 21 #include "chrome/browser/extensions/extension_error_reporter.h" | 21 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 22 #include "chrome/browser/extensions/extension_host.h" | 22 #include "chrome/browser/extensions/extension_host.h" |
| 23 #include "chrome/browser/extensions/extension_install_prompt.h" | 23 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 25 #include "chrome/browser/extensions/extension_system.h" |
| 25 #include "chrome/browser/extensions/unpacked_installer.h" | 26 #include "chrome/browser/extensions/unpacked_installer.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/browser/ui/omnibox/location_bar.h" | 30 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 31 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 32 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/chrome_version_info.h" | 35 #include "chrome/common/chrome_version_info.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 return location_bar->PageActionVisibleCount() == count; | 454 return location_bar->PageActionVisibleCount() == count; |
| 454 } | 455 } |
| 455 | 456 |
| 456 bool ExtensionBrowserTest::WaitForExtensionViewsToLoad() { | 457 bool ExtensionBrowserTest::WaitForExtensionViewsToLoad() { |
| 457 // Wait for all the extension render view hosts that exist to finish loading. | 458 // Wait for all the extension render view hosts that exist to finish loading. |
| 458 content::NotificationRegistrar registrar; | 459 content::NotificationRegistrar registrar; |
| 459 registrar.Add(this, content::NOTIFICATION_LOAD_STOP, | 460 registrar.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 460 content::NotificationService::AllSources()); | 461 content::NotificationService::AllSources()); |
| 461 | 462 |
| 462 ExtensionProcessManager* manager = | 463 ExtensionProcessManager* manager = |
| 463 browser()->profile()->GetExtensionProcessManager(); | 464 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
| 464 ExtensionProcessManager::ViewSet all_views = manager->GetAllViews(); | 465 ExtensionProcessManager::ViewSet all_views = manager->GetAllViews(); |
| 465 for (ExtensionProcessManager::ViewSet::const_iterator iter = | 466 for (ExtensionProcessManager::ViewSet::const_iterator iter = |
| 466 all_views.begin(); | 467 all_views.begin(); |
| 467 iter != all_views.end();) { | 468 iter != all_views.end();) { |
| 468 if (!(*iter)->IsLoading()) { | 469 if (!(*iter)->IsLoading()) { |
| 469 ++iter; | 470 ++iter; |
| 470 } else { | 471 } else { |
| 471 content::RunMessageLoop(); | 472 content::RunMessageLoop(); |
| 472 | 473 |
| 473 // Test activity may have modified the set of extension processes during | 474 // Test activity may have modified the set of extension processes during |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 case content::NOTIFICATION_LOAD_STOP: | 678 case content::NOTIFICATION_LOAD_STOP: |
| 678 VLOG(1) << "Got LOAD_STOP notification."; | 679 VLOG(1) << "Got LOAD_STOP notification."; |
| 679 MessageLoopForUI::current()->Quit(); | 680 MessageLoopForUI::current()->Quit(); |
| 680 break; | 681 break; |
| 681 | 682 |
| 682 default: | 683 default: |
| 683 NOTREACHED(); | 684 NOTREACHED(); |
| 684 break; | 685 break; |
| 685 } | 686 } |
| 686 } | 687 } |
| OLD | NEW |