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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
6 #include "chrome/browser/extensions/extension_install_ui.h" | 6 #include "chrome/browser/extensions/extension_install_prompt.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 8 #include "chrome/browser/infobars/infobar_tab_helper.h" |
9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
10 #include "chrome/browser/themes/theme_service_factory.h" | 10 #include "chrome/browser/themes/theme_service_factory.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
18 #include "chrome/test/ui/ui_test.h" | 18 #include "chrome/test/ui/ui_test.h" |
19 #include "net/test/test_server.h" | 19 #include "net/test/test_server.h" |
20 | 20 |
21 class InfoBarsTest : public InProcessBrowserTest { | 21 class InfoBarsTest : public InProcessBrowserTest { |
22 public: | 22 public: |
23 InfoBarsTest() {} | 23 InfoBarsTest() {} |
24 | 24 |
25 void InstallExtension(const char* filename) { | 25 void InstallExtension(const char* filename) { |
26 FilePath path = ui_test_utils::GetTestFilePath( | 26 FilePath path = ui_test_utils::GetTestFilePath( |
27 FilePath().AppendASCII("extensions"), FilePath().AppendASCII(filename)); | 27 FilePath().AppendASCII("extensions"), FilePath().AppendASCII(filename)); |
28 Profile* profile = browser()->profile(); | 28 Profile* profile = browser()->profile(); |
29 ExtensionService* service = profile->GetExtensionService(); | 29 ExtensionService* service = profile->GetExtensionService(); |
30 | 30 |
31 ui_test_utils::WindowedNotificationObserver observer( | 31 ui_test_utils::WindowedNotificationObserver observer( |
32 chrome::NOTIFICATION_EXTENSION_LOADED, | 32 chrome::NOTIFICATION_EXTENSION_LOADED, |
33 content::NotificationService::AllSources()); | 33 content::NotificationService::AllSources()); |
34 | 34 |
35 ExtensionInstallUI* client = new ExtensionInstallUI(profile); | 35 ExtensionInstallPrompt* client = new ExtensionInstallPrompt(profile); |
36 scoped_refptr<CrxInstaller> installer( | 36 scoped_refptr<CrxInstaller> installer( |
37 CrxInstaller::Create(service, client)); | 37 CrxInstaller::Create(service, client)); |
38 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); | 38 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); |
39 installer->InstallCrx(path); | 39 installer->InstallCrx(path); |
40 | 40 |
41 observer.Wait(); | 41 observer.Wait(); |
42 } | 42 } |
43 }; | 43 }; |
44 | 44 |
45 IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { | 45 IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { |
(...skipping 26 matching lines...) Expand all Loading... |
72 | 72 |
73 ui_test_utils::WindowedNotificationObserver infobar_removed_2( | 73 ui_test_utils::WindowedNotificationObserver infobar_removed_2( |
74 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 74 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
75 content::NotificationService::AllSources()); | 75 content::NotificationService::AllSources()); |
76 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); | 76 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); |
77 infobar_removed_2.Wait(); | 77 infobar_removed_2.Wait(); |
78 EXPECT_EQ(0u, | 78 EXPECT_EQ(0u, |
79 browser()->GetSelectedTabContentsWrapper()->infobar_tab_helper()-> | 79 browser()->GetSelectedTabContentsWrapper()->infobar_tab_helper()-> |
80 infobar_count()); | 80 infobar_count()); |
81 } | 81 } |
OLD | NEW |