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

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

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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/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"
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/infobars/core/confirm_infobar_delegate.h" 25 #include "components/infobars/core/confirm_infobar_delegate.h"
25 #include "components/infobars/core/infobar.h" 26 #include "components/infobars/core/infobar.h"
26 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
27 #include "content/public/test/browser_test_utils.h" 28 #include "content/public/test/browser_test_utils.h"
28 #include "extensions/browser/app_sorting.h" 29 #include "extensions/browser/app_sorting.h"
29 #include "extensions/browser/extension_prefs.h" 30 #include "extensions/browser/extension_prefs.h"
30 #include "extensions/common/id_util.h"
31 31
32 using content::WebContents; 32 using content::WebContents;
33 using extensions::AppSorting; 33 using extensions::AppSorting;
34 using extensions::Extension; 34 using extensions::Extension;
35 35
36 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { 36 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
37 public: 37 public:
38 // Checks that a theme info bar is currently visible and issues an undo to 38 // Checks that a theme info bar is currently visible and issues an undo to
39 // revert to the previous theme. 39 // revert to the previous theme.
40 void VerifyThemeInfoBarAndUndoInstall() { 40 void VerifyThemeInfoBarAndUndoInstall() {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 DISALLOW_COPY_AND_ASSIGN(NewTabUISortingBrowserTest); 217 DISALLOW_COPY_AND_ASSIGN(NewTabUISortingBrowserTest);
218 }; 218 };
219 219
220 // TODO(samarth): remove along with NTP4 code. 220 // TODO(samarth): remove along with NTP4 code.
221 IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest, 221 IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest,
222 DISABLED_ReorderDuringInstall) { 222 DISABLED_ReorderDuringInstall) {
223 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); 223 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
224 ExtensionService* service = extensions::ExtensionSystem::Get( 224 ExtensionService* service = extensions::ExtensionSystem::Get(
225 browser()->profile())->extension_service(); 225 browser()->profile())->extension_service();
226 base::FilePath app_dir = test_data_dir_.AppendASCII("app"); 226 base::FilePath app_dir = test_data_dir_.AppendASCII("app");
227 const std::string app_id = extensions::id_util::GenerateIdForPath(app_dir); 227 const std::string app_id = crx_file::id_util::GenerateIdForPath(app_dir);
228 228
229 const extensions::Extension* webstore_extension = 229 const extensions::Extension* webstore_extension =
230 service->GetInstalledExtension(extension_misc::kWebStoreAppId); 230 service->GetInstalledExtension(extension_misc::kWebStoreAppId);
231 EXPECT_TRUE(webstore_extension); 231 EXPECT_TRUE(webstore_extension);
232 AppSorting* sorting = 232 AppSorting* sorting =
233 extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting(); 233 extensions::ExtensionPrefs::Get(browser()->profile())->app_sorting();
234 234
235 // Register for notifications in the same way as AppLauncherHandler. 235 // Register for notifications in the same way as AppLauncherHandler.
236 registrar_.Add(this, 236 registrar_.Add(this,
237 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, 237 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
238 content::Source<AppSorting>(sorting)); 238 content::Source<AppSorting>(sorting));
239 // ExtensionAppItem calls this when an app install starts. 239 // ExtensionAppItem calls this when an app install starts.
240 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal()); 240 sorting->EnsureValidOrdinals(app_id, syncer::StringOrdinal());
241 // Vefify the app is not actually installed yet. 241 // Vefify the app is not actually installed yet.
242 EXPECT_FALSE(service->GetInstalledExtension(app_id)); 242 EXPECT_FALSE(service->GetInstalledExtension(app_id));
243 // Move the test app from the end to be before the web store. 243 // Move the test app from the end to be before the web store.
244 sorting->OnExtensionMoved( 244 sorting->OnExtensionMoved(
245 app_id, std::string(), extension_misc::kWebStoreAppId); 245 app_id, std::string(), extension_misc::kWebStoreAppId);
246 EXPECT_EQ(app_id, last_reordered_extension_id_); 246 EXPECT_EQ(app_id, last_reordered_extension_id_);
247 247
248 // Now install the app. 248 // Now install the app.
249 const extensions::Extension* test_app = LoadExtension(app_dir); 249 const extensions::Extension* test_app = LoadExtension(app_dir);
250 ASSERT_TRUE(test_app); 250 ASSERT_TRUE(test_app);
251 EXPECT_TRUE(service->GetInstalledExtension(app_id)); 251 EXPECT_TRUE(service->GetInstalledExtension(app_id));
252 EXPECT_EQ(app_id, test_app->id()); 252 EXPECT_EQ(app_id, test_app->id());
253 } 253 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_manager_unittest.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698