| 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/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
| 7 #include "chrome/browser/api/infobars/infobar_service.h" | 7 #include "chrome/browser/api/infobars/infobar_service.h" |
| 8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 10 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); | 114 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); |
| 115 ASSERT_FALSE(GetTheme()); | 115 ASSERT_FALSE(GetTheme()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 118 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 119 TestInstallThemeInFullScreen) { | 119 TestInstallThemeInFullScreen) { |
| 120 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_FULLSCREEN)); | 120 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_FULLSCREEN)); |
| 121 InstallThemeAndVerify("theme", "camo theme"); | 121 InstallThemeAndVerify("theme", "camo theme"); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Disabled: http://crbug.com/174399 | |
| 125 #if defined(OS_WIN) && defined(USE_AURA) | |
| 126 #define MAYBE_AppInstallConfirmation DISABLED_AppInstallConfirmation | |
| 127 #define MAYBE_AppInstallConfirmation_Incognito DISABLED_AppInstallConfirmation_I
ncognito | |
| 128 #else | |
| 129 #define MAYBE_AppInstallConfirmation AppInstallConfirmation | |
| 130 #define MAYBE_AppInstallConfirmation_Incognito AppInstallConfirmation_Incognito | |
| 131 #endif | |
| 132 | |
| 133 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 124 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 134 MAYBE_AppInstallConfirmation) { | 125 AppInstallConfirmation) { |
| 135 int num_tabs = browser()->tab_strip_model()->count(); | 126 int num_tabs = browser()->tab_strip_model()->count(); |
| 136 | 127 |
| 137 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); | 128 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 138 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); | 129 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); |
| 139 | 130 |
| 140 if (NewTabUI::ShouldShowApps()) { | 131 if (NewTabUI::ShouldShowApps()) { |
| 141 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); | 132 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); |
| 142 WebContents* web_contents = | 133 WebContents* web_contents = |
| 143 browser()->tab_strip_model()->GetActiveWebContents(); | 134 browser()->tab_strip_model()->GetActiveWebContents(); |
| 144 ASSERT_TRUE(web_contents); | 135 ASSERT_TRUE(web_contents); |
| 145 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 136 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
| 146 "chrome://newtab/", false)); | 137 "chrome://newtab/", false)); |
| 147 } else { | 138 } else { |
| 148 // TODO(xiyuan): Figure out how to test extension installed bubble? | 139 // TODO(xiyuan): Figure out how to test extension installed bubble? |
| 149 } | 140 } |
| 150 } | 141 } |
| 151 | 142 |
| 152 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 143 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 153 MAYBE_AppInstallConfirmation_Incognito) { | 144 AppInstallConfirmation_Incognito) { |
| 154 Browser* incognito_browser = CreateIncognitoBrowser(); | 145 Browser* incognito_browser = CreateIncognitoBrowser(); |
| 155 | 146 |
| 156 int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); | 147 int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); |
| 157 int num_normal_tabs = browser()->tab_strip_model()->count(); | 148 int num_normal_tabs = browser()->tab_strip_model()->count(); |
| 158 | 149 |
| 159 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); | 150 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 160 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, | 151 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
| 161 incognito_browser)); | 152 incognito_browser)); |
| 162 | 153 |
| 163 EXPECT_EQ(num_incognito_tabs, | 154 EXPECT_EQ(num_incognito_tabs, |
| 164 incognito_browser->tab_strip_model()->count()); | 155 incognito_browser->tab_strip_model()->count()); |
| 165 if (NewTabUI::ShouldShowApps()) { | 156 if (NewTabUI::ShouldShowApps()) { |
| 166 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); | 157 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_strip_model()->count()); |
| 167 WebContents* web_contents = | 158 WebContents* web_contents = |
| 168 browser()->tab_strip_model()->GetActiveWebContents(); | 159 browser()->tab_strip_model()->GetActiveWebContents(); |
| 169 ASSERT_TRUE(web_contents); | 160 ASSERT_TRUE(web_contents); |
| 170 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 161 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
| 171 "chrome://newtab/", false)); | 162 "chrome://newtab/", false)); |
| 172 } else { | 163 } else { |
| 173 // TODO(xiyuan): Figure out how to test extension installed bubble? | 164 // TODO(xiyuan): Figure out how to test extension installed bubble? |
| 174 } | 165 } |
| 175 } | 166 } |
| OLD | NEW |