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

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

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional cleanup Created 6 years, 10 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 | Annotate | Revision Log
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/confirm_infobar_delegate.h" 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
12 #include "chrome/browser/infobars/infobar.h" 12 #include "chrome/browser/infobars/infobar.h"
13 #include "chrome/browser/infobars/infobar_service.h" 13 #include "chrome/browser/infobars/infobar_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/themes/theme_service.h" 15 #include "chrome/browser/themes/theme_service.h"
16 #include "chrome/browser/themes/theme_service_factory.h" 16 #include "chrome/browser/themes/theme_service_factory.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_commands.h" 18 #include "chrome/browser/ui/browser_commands.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 21 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "chrome/test/base/test_switches.h" 23 #include "chrome/test/base/test_switches.h"
24 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/test/browser_test_utils.h" 26 #include "content/public/test/browser_test_utils.h"
27 #include "extensions/browser/app_sorting.h" 27 #include "extensions/browser/app_sorting.h"
28 #include "extensions/browser/extension_prefs.h"
28 #include "extensions/common/id_util.h" 29 #include "extensions/common/id_util.h"
29 30
30 using content::WebContents; 31 using content::WebContents;
31 using extensions::AppSorting; 32 using extensions::AppSorting;
32 using extensions::Extension; 33 using extensions::Extension;
33 34
34 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { 35 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
35 public: 36 public:
36 // Checks that a theme info bar is currently visible and issues an undo to 37 // Checks that a theme info bar is currently visible and issues an undo to
37 // revert to the previous theme. 38 // revert to the previous theme.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 DISABLED_ReorderDuringInstall) { 221 DISABLED_ReorderDuringInstall) {
221 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 222 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
222 ExtensionService* service = extensions::ExtensionSystem::Get( 223 ExtensionService* service = extensions::ExtensionSystem::Get(
223 browser()->profile())->extension_service(); 224 browser()->profile())->extension_service();
224 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); 225 base::FilePath app_dir = test_data_dir_.AppendASCII("app");
225 const std::string app_id = extensions::id_util::GenerateIdForPath(app_dir); 226 const std::string app_id = extensions::id_util::GenerateIdForPath(app_dir);
226 227
227 const extensions::Extension* webstore_extension = 228 const extensions::Extension* webstore_extension =
228 service->GetInstalledExtension(extension_misc::kWebStoreAppId); 229 service->GetInstalledExtension(extension_misc::kWebStoreAppId);
229 EXPECT_TRUE(webstore_extension); 230 EXPECT_TRUE(webstore_extension);
230 AppSorting* sorting = service->extension_prefs()->app_sorting(); 231 AppSorting* sorting =
232 extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting();
231 233
232 // Register for notifications in the same way as AppLauncherHandler. 234 // Register for notifications in the same way as AppLauncherHandler.
233 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, 235 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED,
234 content::Source<AppSorting>(sorting)); 236 content::Source<AppSorting>(sorting));
235 // ExtensionAppItem calls this when an app install starts. 237 // ExtensionAppItem calls this when an app install starts.
236 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal()); 238 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal());
237 // Vefify the app is not actually installed yet. 239 // Vefify the app is not actually installed yet.
238 EXPECT_FALSE(service->GetInstalledExtension(app_id)); 240 EXPECT_FALSE(service->GetInstalledExtension(app_id));
239 // Move the test app from the end to be before the web store. 241 // Move the test app from the end to be before the web store.
240 service->OnExtensionMoved(app_id, 242 service->OnExtensionMoved(app_id,
241 std::string(), 243 std::string(),
242 extension_misc::kWebStoreAppId); 244 extension_misc::kWebStoreAppId);
243 EXPECT_EQ(app_id, last_reordered_extension_id_); 245 EXPECT_EQ(app_id, last_reordered_extension_id_);
244 246
245 // Now install the app. 247 // Now install the app.
246 const extensions::Extension* test_app = LoadExtension(app_dir); 248 const extensions::Extension* test_app = LoadExtension(app_dir);
247 ASSERT_TRUE(test_app); 249 ASSERT_TRUE(test_app);
248 EXPECT_TRUE(service->GetInstalledExtension(app_id)); 250 EXPECT_TRUE(service->GetInstalledExtension(app_id));
249 EXPECT_EQ(app_id, test_app->id()); 251 EXPECT_EQ(app_id, test_app->id());
250 } 252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698