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

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

Issue 1419823011: app_sorting() calls should go via ExtensionSystem intsead of prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 227 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
228 ExtensionService* service = extensions::ExtensionSystem::Get( 228 ExtensionService* service = extensions::ExtensionSystem::Get(
229 browser()->profile())->extension_service(); 229 browser()->profile())->extension_service();
230 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); 230 base::FilePath app_dir = test_data_dir_.AppendASCII("app");
231 const std::string app_id = crx_file::id_util::GenerateIdForPath(app_dir); 231 const std::string app_id = crx_file::id_util::GenerateIdForPath(app_dir);
232 232
233 const extensions::Extension* webstore_extension = 233 const extensions::Extension* webstore_extension =
234 service->GetInstalledExtension(extensions::kWebStoreAppId); 234 service->GetInstalledExtension(extensions::kWebStoreAppId);
235 EXPECT_TRUE(webstore_extension); 235 EXPECT_TRUE(webstore_extension);
236 AppSorting* sorting = 236 AppSorting* sorting =
237 extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting(); 237 extensions::ExtensionSystem::Get(browser()->profile())->app_sorting();
238 238
239 // Register for notifications in the same way as AppLauncherHandler. 239 // Register for notifications in the same way as AppLauncherHandler.
240 registrar_.Add(this, 240 registrar_.Add(this,
241 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, 241 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
242 content::Source<AppSorting>(sorting)); 242 content::Source<AppSorting>(sorting));
243 // ExtensionAppItem calls this when an app install starts. 243 // ExtensionAppItem calls this when an app install starts.
244 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal()); 244 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal());
245 // Vefify the app is not actually installed yet. 245 // Vefify the app is not actually installed yet.
246 EXPECT_FALSE(service->GetInstalledExtension(app_id)); 246 EXPECT_FALSE(service->GetInstalledExtension(app_id));
247 // Move the test app from the end to be before the web store. 247 // Move the test app from the end to be before the web store.
248 sorting->OnExtensionMoved( 248 sorting->OnExtensionMoved(
249 app_id, std::string(), extensions::kWebStoreAppId); 249 app_id, std::string(), extensions::kWebStoreAppId);
250 EXPECT_EQ(app_id, last_reordered_extension_id_); 250 EXPECT_EQ(app_id, last_reordered_extension_id_);
251 251
252 // Now install the app. 252 // Now install the app.
253 const extensions::Extension* test_app = LoadExtension(app_dir); 253 const extensions::Extension* test_app = LoadExtension(app_dir);
254 ASSERT_TRUE(test_app); 254 ASSERT_TRUE(test_app);
255 EXPECT_TRUE(service->GetInstalledExtension(app_id)); 255 EXPECT_TRUE(service->GetInstalledExtension(app_id));
256 EXPECT_EQ(app_id, test_app->id()); 256 EXPECT_EQ(app_id, test_app->id());
257 } 257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698