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

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

Issue 19462009: [DRAFT] Allow a user to revert to their previous theme without closing infobar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_sorting.h" 10 #include "chrome/browser/extensions/extension_sorting.h"
(...skipping 30 matching lines...) Expand all
41 ConfirmInfoBarDelegate* delegate = 41 ConfirmInfoBarDelegate* delegate =
42 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate(); 42 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
43 ASSERT_TRUE(delegate); 43 ASSERT_TRUE(delegate);
44 delegate->Cancel(); 44 delegate->Cancel();
45 ASSERT_EQ(0U, infobar_service->infobar_count()); 45 ASSERT_EQ(0U, infobar_service->infobar_count());
46 } 46 }
47 47
48 // Install the given theme from the data dir and verify expected name. 48 // Install the given theme from the data dir and verify expected name.
49 void InstallThemeAndVerify(const char* theme_name, 49 void InstallThemeAndVerify(const char* theme_name,
50 const std::string& expected_name) { 50 const std::string& expected_name) {
51 // If there is already a theme installed, the current theme should be
52 // disabled and the new one installed + enabled.
53 int expected_change = GetTheme() ? 0 : 1;
51 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_name); 54 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_name);
52 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); 55 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, expected_change,
56 browser()));
53 const Extension* theme = GetTheme(); 57 const Extension* theme = GetTheme();
54 ASSERT_TRUE(theme); 58 ASSERT_TRUE(theme);
55 ASSERT_EQ(theme->name(), expected_name); 59 ASSERT_EQ(theme->name(), expected_name);
56 } 60 }
57 61
58 const Extension* GetTheme() const { 62 const Extension* GetTheme() const {
59 return ThemeServiceFactory::GetThemeForProfile(browser()->profile()); 63 return ThemeServiceFactory::GetThemeForProfile(browser()->profile());
60 } 64 }
61 }; 65 };
62 66
(...skipping 10 matching lines...) Expand all
73 // Install theme once and undo to verify we go back to default theme. 77 // Install theme once and undo to verify we go back to default theme.
74 base::FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); 78 base::FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme"));
75 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); 79 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser()));
76 const Extension* theme = GetTheme(); 80 const Extension* theme = GetTheme();
77 ASSERT_TRUE(theme); 81 ASSERT_TRUE(theme);
78 std::string theme_id = theme->id(); 82 std::string theme_id = theme->id();
79 VerifyThemeInfoBarAndUndoInstall(); 83 VerifyThemeInfoBarAndUndoInstall();
80 ASSERT_EQ(NULL, GetTheme()); 84 ASSERT_EQ(NULL, GetTheme());
81 85
82 // Set the same theme twice and undo to verify we go back to default theme. 86 // Set the same theme twice and undo to verify we go back to default theme.
83 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); 87 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser()));
84 theme = GetTheme(); 88 theme = GetTheme();
85 ASSERT_TRUE(theme); 89 ASSERT_TRUE(theme);
86 ASSERT_EQ(theme_id, theme->id()); 90 ASSERT_EQ(theme_id, theme->id());
87 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser())); 91 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 0, browser()));
88 theme = GetTheme(); 92 theme = GetTheme();
89 ASSERT_TRUE(theme); 93 ASSERT_TRUE(theme);
90 ASSERT_EQ(theme_id, theme->id()); 94 ASSERT_EQ(theme_id, theme->id());
91 VerifyThemeInfoBarAndUndoInstall(); 95 VerifyThemeInfoBarAndUndoInstall();
92 ASSERT_EQ(NULL, GetTheme()); 96 ASSERT_EQ(NULL, GetTheme());
93 } 97 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 std::string(), 220 std::string(),
217 extension_misc::kWebStoreAppId); 221 extension_misc::kWebStoreAppId);
218 EXPECT_EQ(app_id, last_reordered_extension_id_); 222 EXPECT_EQ(app_id, last_reordered_extension_id_);
219 223
220 // Now install the app. 224 // Now install the app.
221 const extensions::Extension* test_app = LoadExtension(app_dir); 225 const extensions::Extension* test_app = LoadExtension(app_dir);
222 ASSERT_TRUE(test_app); 226 ASSERT_TRUE(test_app);
223 EXPECT_TRUE(service->GetInstalledExtension(app_id)); 227 EXPECT_TRUE(service->GetInstalledExtension(app_id));
224 EXPECT_EQ(app_id, test_app->id()); 228 EXPECT_EQ(app_id, test_app->id());
225 } 229 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | chrome/browser/themes/theme_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698