| 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/api/infobars/infobar_service.h" | 5 #include "chrome/browser/api/infobars/infobar_service.h" |
| 6 #include "chrome/browser/extensions/crx_installer.h" | 6 #include "chrome/browser/extensions/crx_installer.h" |
| 7 #include "chrome/browser/extensions/extension_install_prompt.h" | 7 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| 11 #include "chrome/browser/themes/theme_service_factory.h" | 11 #include "chrome/browser/themes/theme_service_factory.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/extensions/api/requirements/requirements_handler.h" |
| 17 #include "chrome/common/extensions/manifest_handler.h" |
| 16 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "chrome/test/ui/ui_test.h" | 20 #include "chrome/test/ui/ui_test.h" |
| 19 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 20 #include "net/test/test_server.h" | 22 #include "net/test/test_server.h" |
| 21 | 23 |
| 22 class InfoBarsTest : public InProcessBrowserTest { | 24 class InfoBarsTest : public InProcessBrowserTest { |
| 23 public: | 25 public: |
| 24 InfoBarsTest() {} | 26 InfoBarsTest() {} |
| 25 | 27 |
| 28 protected: |
| 26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 27 command_line->AppendSwitchASCII( | 30 command_line->AppendSwitchASCII( |
| 28 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); | 31 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); |
| 29 } | 32 } |
| 30 | 33 |
| 34 virtual void SetUpOnMainThread() OVERRIDE { |
| 35 InProcessBrowserTest::SetUpOnMainThread(); |
| 36 (new extensions::RequirementsHandler)->Register(); |
| 37 } |
| 38 |
| 39 virtual void CleanUpOnMainThread() OVERRIDE { |
| 40 extensions::ManifestHandler::ClearRegistryForTesting(); |
| 41 InProcessBrowserTest::CleanUpOnMainThread(); |
| 42 } |
| 43 |
| 31 void InstallExtension(const char* filename) { | 44 void InstallExtension(const char* filename) { |
| 32 base::FilePath path = ui_test_utils::GetTestFilePath( | 45 base::FilePath path = ui_test_utils::GetTestFilePath( |
| 33 base::FilePath().AppendASCII("extensions"), | 46 base::FilePath().AppendASCII("extensions"), |
| 34 base::FilePath().AppendASCII(filename)); | 47 base::FilePath().AppendASCII(filename)); |
| 35 Profile* profile = browser()->profile(); | 48 Profile* profile = browser()->profile(); |
| 36 ExtensionService* service = profile->GetExtensionService(); | 49 ExtensionService* service = profile->GetExtensionService(); |
| 37 | 50 |
| 38 content::WindowedNotificationObserver observer( | 51 content::WindowedNotificationObserver observer( |
| 39 chrome::NOTIFICATION_EXTENSION_LOADED, | 52 chrome::NOTIFICATION_EXTENSION_LOADED, |
| 40 content::NotificationService::AllSources()); | 53 content::NotificationService::AllSources()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 93 |
| 81 content::WindowedNotificationObserver infobar_removed_2( | 94 content::WindowedNotificationObserver infobar_removed_2( |
| 82 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 95 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
| 83 content::NotificationService::AllSources()); | 96 content::NotificationService::AllSources()); |
| 84 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); | 97 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); |
| 85 infobar_removed_2.Wait(); | 98 infobar_removed_2.Wait(); |
| 86 EXPECT_EQ(0u, | 99 EXPECT_EQ(0u, |
| 87 InfoBarService::FromWebContents(browser()->tab_strip_model()-> | 100 InfoBarService::FromWebContents(browser()->tab_strip_model()-> |
| 88 GetActiveWebContents())->GetInfoBarCount()); | 101 GetActiveWebContents())->GetInfoBarCount()); |
| 89 } | 102 } |
| OLD | NEW |