Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: chrome/browser/extensions/extension_install_ui_browsertest.cc

Issue 515563003: Remove dependency of chrome in WebRequestPermissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move KWebStoreAppId to extensions. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/themes/theme_service.h" 13 #include "chrome/browser/themes/theme_service.h"
14 #include "chrome/browser/themes/theme_service_factory.h" 14 #include "chrome/browser/themes/theme_service_factory.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_commands.h" 16 #include "chrome/browser/ui/browser_commands.h"
17 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 19 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
20 #include "chrome/common/extensions/extension_constants.h" 20 #include "chrome/common/extensions/extension_constants.h"
Fady Samuel 2014/08/29 19:39:46 Is this still necessary?
Xi Han 2014/08/29 19:52:54 Removed.
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "chrome/test/base/test_switches.h" 22 #include "chrome/test/base/test_switches.h"
23 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
24 #include "components/crx_file/id_util.h" 24 #include "components/crx_file/id_util.h"
25 #include "components/infobars/core/confirm_infobar_delegate.h" 25 #include "components/infobars/core/confirm_infobar_delegate.h"
26 #include "components/infobars/core/infobar.h" 26 #include "components/infobars/core/infobar.h"
27 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
28 #include "content/public/test/browser_test_utils.h" 28 #include "content/public/test/browser_test_utils.h"
29 #include "extensions/browser/app_sorting.h" 29 #include "extensions/browser/app_sorting.h"
30 #include "extensions/browser/extension_prefs.h" 30 #include "extensions/browser/extension_prefs.h"
31 #include "extensions/common/constants.h"
31 32
32 using content::WebContents; 33 using content::WebContents;
33 using extensions::AppSorting; 34 using extensions::AppSorting;
34 using extensions::Extension; 35 using extensions::Extension;
35 36
36 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { 37 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
37 public: 38 public:
38 // Checks that a theme info bar is currently visible and issues an undo to 39 // Checks that a theme info bar is currently visible and issues an undo to
39 // revert to the previous theme. 40 // revert to the previous theme.
40 void VerifyThemeInfoBarAndUndoInstall() { 41 void VerifyThemeInfoBarAndUndoInstall() {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // TODO(samarth): remove along with NTP4 code. 221 // TODO(samarth): remove along with NTP4 code.
221 IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest, 222 IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest,
222 DISABLED_ReorderDuringInstall) { 223 DISABLED_ReorderDuringInstall) {
223 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 224 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
224 ExtensionService* service = extensions::ExtensionSystem::Get( 225 ExtensionService* service = extensions::ExtensionSystem::Get(
225 browser()->profile())->extension_service(); 226 browser()->profile())->extension_service();
226 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); 227 base::FilePath app_dir = test_data_dir_.AppendASCII("app");
227 const std::string app_id = crx_file::id_util::GenerateIdForPath(app_dir); 228 const std::string app_id = crx_file::id_util::GenerateIdForPath(app_dir);
228 229
229 const extensions::Extension* webstore_extension = 230 const extensions::Extension* webstore_extension =
230 service->GetInstalledExtension(extension_misc::kWebStoreAppId); 231 service->GetInstalledExtension(extensions::kWebStoreAppId);
231 EXPECT_TRUE(webstore_extension); 232 EXPECT_TRUE(webstore_extension);
232 AppSorting* sorting = 233 AppSorting* sorting =
233 extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting(); 234 extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting();
234 235
235 // Register for notifications in the same way as AppLauncherHandler. 236 // Register for notifications in the same way as AppLauncherHandler.
236 registrar_.Add(this, 237 registrar_.Add(this,
237 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, 238 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
238 content::Source<AppSorting>(sorting)); 239 content::Source<AppSorting>(sorting));
239 // ExtensionAppItem calls this when an app install starts. 240 // ExtensionAppItem calls this when an app install starts.
240 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal()); 241 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal());
241 // Vefify the app is not actually installed yet. 242 // Vefify the app is not actually installed yet.
242 EXPECT_FALSE(service->GetInstalledExtension(app_id)); 243 EXPECT_FALSE(service->GetInstalledExtension(app_id));
243 // Move the test app from the end to be before the web store. 244 // Move the test app from the end to be before the web store.
244 sorting->OnExtensionMoved( 245 sorting->OnExtensionMoved(
245 app_id, std::string(), extension_misc::kWebStoreAppId); 246 app_id, std::string(), extensions::kWebStoreAppId);
246 EXPECT_EQ(app_id, last_reordered_extension_id_); 247 EXPECT_EQ(app_id, last_reordered_extension_id_);
247 248
248 // Now install the app. 249 // Now install the app.
249 const extensions::Extension* test_app = LoadExtension(app_dir); 250 const extensions::Extension* test_app = LoadExtension(app_dir);
250 ASSERT_TRUE(test_app); 251 ASSERT_TRUE(test_app);
251 EXPECT_TRUE(service->GetInstalledExtension(app_id)); 252 EXPECT_TRUE(service->GetInstalledExtension(app_id));
252 EXPECT_EQ(app_id, test_app->id()); 253 EXPECT_EQ(app_id, test_app->id());
253 } 254 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698