| 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 "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); | 135 ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); |
| 136 ASSERT_FALSE(GetTheme()); | 136 ASSERT_FALSE(GetTheme()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 139 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 140 TestInstallThemeInFullScreen) { | 140 TestInstallThemeInFullScreen) { |
| 141 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_FULLSCREEN)); | 141 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_FULLSCREEN)); |
| 142 InstallThemeAndVerify("theme", "camo theme"); | 142 InstallThemeAndVerify("theme", "camo theme"); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // TODO(samarth): remove along with NTP4 code. |
| 145 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 146 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 146 AppInstallConfirmation) { | 147 DISABLED_AppInstallConfirmation) { |
| 147 int num_tabs = browser()->tab_strip_model()->count(); | 148 int num_tabs = browser()->tab_strip_model()->count(); |
| 148 | 149 |
| 149 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); | 150 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 150 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); | 151 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); |
| 151 | 152 |
| 152 if (NewTabUI::ShouldShowApps()) { | 153 if (NewTabUI::ShouldShowApps()) { |
| 153 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); | 154 EXPECT_EQ(num_tabs + 1, browser()->tab_strip_model()->count()); |
| 154 WebContents* web_contents = | 155 WebContents* web_contents = |
| 155 browser()->tab_strip_model()->GetActiveWebContents(); | 156 browser()->tab_strip_model()->GetActiveWebContents(); |
| 156 ASSERT_TRUE(web_contents); | 157 ASSERT_TRUE(web_contents); |
| 157 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), | 158 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), |
| 158 "chrome://newtab/", false)); | 159 "chrome://newtab/", false)); |
| 159 } else { | 160 } else { |
| 160 // TODO(xiyuan): Figure out how to test extension installed bubble? | 161 // TODO(xiyuan): Figure out how to test extension installed bubble? |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 165 // TODO(samarth): remove along with NTP4 code. |
| 164 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 166 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| 165 AppInstallConfirmation_Incognito) { | 167 DISABLED_AppInstallConfirmation_Incognito) { |
| 166 Browser* incognito_browser = CreateIncognitoBrowser(); | 168 Browser* incognito_browser = CreateIncognitoBrowser(); |
| 167 | 169 |
| 168 int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); | 170 int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); |
| 169 int num_normal_tabs = browser()->tab_strip_model()->count(); | 171 int num_normal_tabs = browser()->tab_strip_model()->count(); |
| 170 | 172 |
| 171 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); | 173 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 172 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, | 174 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
| 173 incognito_browser)); | 175 incognito_browser)); |
| 174 | 176 |
| 175 EXPECT_EQ(num_incognito_tabs, | 177 EXPECT_EQ(num_incognito_tabs, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 204 } | 206 } |
| 205 | 207 |
| 206 protected: | 208 protected: |
| 207 std::string last_reordered_extension_id_; | 209 std::string last_reordered_extension_id_; |
| 208 content::NotificationRegistrar registrar_; | 210 content::NotificationRegistrar registrar_; |
| 209 | 211 |
| 210 private: | 212 private: |
| 211 DISALLOW_COPY_AND_ASSIGN(NewTabUISortingBrowserTest); | 213 DISALLOW_COPY_AND_ASSIGN(NewTabUISortingBrowserTest); |
| 212 }; | 214 }; |
| 213 | 215 |
| 214 #if defined(OS_WIN) | 216 // TODO(samarth): remove along with NTP4 code. |
| 215 #define MAYBE_ReorderDuringInstall DISABLED_ReorderDuringInstall | 217 IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest, |
| 216 #else | 218 DISABLED_ReorderDuringInstall) { |
| 217 #define MAYBE_ReorderDuringInstall ReorderDuringInstall | |
| 218 #endif | |
| 219 IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest, MAYBE_ReorderDuringInstall) { | |
| 220 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 219 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 221 ExtensionService* service = extensions::ExtensionSystem::Get( | 220 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 222 browser()->profile())->extension_service(); | 221 browser()->profile())->extension_service(); |
| 223 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); | 222 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); |
| 224 const std::string app_id = extensions::id_util::GenerateIdForPath(app_dir); | 223 const std::string app_id = extensions::id_util::GenerateIdForPath(app_dir); |
| 225 | 224 |
| 226 const extensions::Extension* webstore_extension = | 225 const extensions::Extension* webstore_extension = |
| 227 service->GetInstalledExtension(extension_misc::kWebStoreAppId); | 226 service->GetInstalledExtension(extension_misc::kWebStoreAppId); |
| 228 EXPECT_TRUE(webstore_extension); | 227 EXPECT_TRUE(webstore_extension); |
| 229 ExtensionSorting* sorting = service->extension_prefs()->extension_sorting(); | 228 ExtensionSorting* sorting = service->extension_prefs()->extension_sorting(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 240 std::string(), | 239 std::string(), |
| 241 extension_misc::kWebStoreAppId); | 240 extension_misc::kWebStoreAppId); |
| 242 EXPECT_EQ(app_id, last_reordered_extension_id_); | 241 EXPECT_EQ(app_id, last_reordered_extension_id_); |
| 243 | 242 |
| 244 // Now install the app. | 243 // Now install the app. |
| 245 const extensions::Extension* test_app = LoadExtension(app_dir); | 244 const extensions::Extension* test_app = LoadExtension(app_dir); |
| 246 ASSERT_TRUE(test_app); | 245 ASSERT_TRUE(test_app); |
| 247 EXPECT_TRUE(service->GetInstalledExtension(app_id)); | 246 EXPECT_TRUE(service->GetInstalledExtension(app_id)); |
| 248 EXPECT_EQ(app_id, test_app->id()); | 247 EXPECT_EQ(app_id, test_app->id()); |
| 249 } | 248 } |
| OLD | NEW |