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 "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/extensions/crx_installer.h" | 7 #include "chrome/browser/extensions/crx_installer.h" |
8 #include "chrome/browser/extensions/extension_install_prompt.h" | 8 #include "chrome/browser/extensions/extension_install_prompt.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/themes/theme_service.h" | 12 #include "chrome/browser/themes/theme_service.h" |
13 #include "chrome/browser/themes/theme_service_factory.h" | 13 #include "chrome/browser/themes/theme_service_factory.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "chrome/test/base/test_switches.h" | 18 #include "chrome/test/base/test_switches.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "extensions/browser/extension_dialog_auto_confirm.h" |
21 #include "extensions/browser/extension_system.h" | 22 #include "extensions/browser/extension_system.h" |
22 #include "net/test/embedded_test_server/embedded_test_server.h" | 23 #include "net/test/embedded_test_server/embedded_test_server.h" |
23 | 24 |
24 class InfoBarsTest : public InProcessBrowserTest { | 25 class InfoBarsTest : public InProcessBrowserTest { |
25 public: | 26 public: |
26 InfoBarsTest() {} | 27 InfoBarsTest() {} |
27 | 28 |
28 void InstallExtension(const char* filename) { | 29 void InstallExtension(const char* filename) { |
29 base::FilePath path = ui_test_utils::GetTestFilePath( | 30 base::FilePath path = ui_test_utils::GetTestFilePath( |
30 base::FilePath().AppendASCII("extensions"), | 31 base::FilePath().AppendASCII("extensions"), |
(...skipping 10 matching lines...) Expand all Loading... |
41 scoped_refptr<extensions::CrxInstaller> installer( | 42 scoped_refptr<extensions::CrxInstaller> installer( |
42 extensions::CrxInstaller::Create(service, client.Pass())); | 43 extensions::CrxInstaller::Create(service, client.Pass())); |
43 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); | 44 installer->set_install_cause(extension_misc::INSTALL_CAUSE_AUTOMATION); |
44 installer->InstallCrx(path); | 45 installer->InstallCrx(path); |
45 | 46 |
46 observer.Wait(); | 47 observer.Wait(); |
47 } | 48 } |
48 }; | 49 }; |
49 | 50 |
50 IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { | 51 IN_PROC_BROWSER_TEST_F(InfoBarsTest, TestInfoBarsCloseOnNewTheme) { |
51 ExtensionInstallPrompt::g_auto_confirm_for_tests = | 52 extensions::ScopedExtensionDialogAutoConfirm auto_confirm( |
52 ExtensionInstallPrompt::ACCEPT; | 53 &extensions::g_auto_confirm_install_for_testing, |
| 54 extensions::AUTO_CONFIRM_ACCEPT); |
53 | 55 |
54 #if defined(OS_WIN) && defined(USE_ASH) | 56 #if defined(OS_WIN) && defined(USE_ASH) |
55 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 57 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
56 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 58 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
57 switches::kAshBrowserTests)) | 59 switches::kAshBrowserTests)) |
58 return; | 60 return; |
59 #endif | 61 #endif |
60 | 62 |
61 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 63 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
62 | 64 |
(...skipping 26 matching lines...) Expand all Loading... |
89 content::WindowedNotificationObserver infobar_removed_2( | 91 content::WindowedNotificationObserver infobar_removed_2( |
90 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 92 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
91 content::NotificationService::AllSources()); | 93 content::NotificationService::AllSources()); |
92 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); | 94 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); |
93 infobar_removed_2.Wait(); | 95 infobar_removed_2.Wait(); |
94 EXPECT_EQ(0u, | 96 EXPECT_EQ(0u, |
95 InfoBarService::FromWebContents( | 97 InfoBarService::FromWebContents( |
96 browser()->tab_strip_model()->GetActiveWebContents())-> | 98 browser()->tab_strip_model()->GetActiveWebContents())-> |
97 infobar_count()); | 99 infobar_count()); |
98 } | 100 } |
OLD | NEW |