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

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

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/scoped_observer.h" 6 #include "base/scoped_observer.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_install_prompt.h" 8 #include "chrome/browser/extensions/extension_install_prompt.h"
9 #include "chrome/browser/extensions/extension_install_ui.h" 9 #include "chrome/browser/extensions/extension_install_ui.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 EXPECT_FALSE(extension_service->extensions()->Contains(kTestExtensionId)); 172 EXPECT_FALSE(extension_service->extensions()->Contains(kTestExtensionId));
173 RunTest("runTest"); 173 RunTest("runTest");
174 EXPECT_TRUE(extension_service->extensions()->Contains(kTestExtensionId)); 174 EXPECT_TRUE(extension_service->extensions()->Contains(kTestExtensionId));
175 } 175 }
176 176
177 class WebstoreStartupInstallerSupervisedUsersTest 177 class WebstoreStartupInstallerSupervisedUsersTest
178 : public WebstoreStartupInstallerTest { 178 : public WebstoreStartupInstallerTest {
179 public: 179 public:
180 // InProcessBrowserTest overrides: 180 // InProcessBrowserTest overrides:
181 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { 181 virtual void SetUpCommandLine(base::CommandLine* command_line) override {
182 WebstoreStartupInstallerTest::SetUpCommandLine(command_line); 182 WebstoreStartupInstallerTest::SetUpCommandLine(command_line);
183 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf"); 183 command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf");
184 } 184 }
185 }; 185 };
186 186
187 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerSupervisedUsersTest, 187 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerSupervisedUsersTest,
188 InstallProhibited) { 188 InstallProhibited) {
189 #if defined(OS_WIN) && defined(USE_ASH) 189 #if defined(OS_WIN) && defined(USE_ASH)
190 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 190 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
191 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 191 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 13 matching lines...) Expand all
205 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 205 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
206 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents); 206 InfoBarService* infobar_service = InfoBarService::FromWebContents(contents);
207 EXPECT_EQ(0u, infobar_service->infobar_count()); 207 EXPECT_EQ(0u, infobar_service->infobar_count());
208 } 208 }
209 209
210 // The unpack failure test needs to use a different install .crx, which is 210 // The unpack failure test needs to use a different install .crx, which is
211 // specified via a command-line flag, so it needs its own test subclass. 211 // specified via a command-line flag, so it needs its own test subclass.
212 class WebstoreStartupInstallUnpackFailureTest 212 class WebstoreStartupInstallUnpackFailureTest
213 : public WebstoreStartupInstallerTest { 213 : public WebstoreStartupInstallerTest {
214 public: 214 public:
215 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { 215 virtual void SetUpCommandLine(base::CommandLine* command_line) override {
216 WebstoreStartupInstallerTest::SetUpCommandLine(command_line); 216 WebstoreStartupInstallerTest::SetUpCommandLine(command_line);
217 217
218 GURL crx_url = GenerateTestServerUrl( 218 GURL crx_url = GenerateTestServerUrl(
219 kWebstoreDomain, "malformed_extension.crx"); 219 kWebstoreDomain, "malformed_extension.crx");
220 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 220 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
221 switches::kAppsGalleryUpdateURL, crx_url.spec()); 221 switches::kAppsGalleryUpdateURL, crx_url.spec());
222 } 222 }
223 223
224 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 224 virtual void SetUpInProcessBrowserTestFixture() override {
225 WebstoreStartupInstallerTest::SetUpInProcessBrowserTestFixture(); 225 WebstoreStartupInstallerTest::SetUpInProcessBrowserTestFixture();
226 ExtensionInstallUI::set_disable_failure_ui_for_tests(); 226 ExtensionInstallUI::set_disable_failure_ui_for_tests();
227 } 227 }
228 }; 228 };
229 229
230 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallUnpackFailureTest, 230 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallUnpackFailureTest,
231 WebstoreStartupInstallUnpackFailureTest) { 231 WebstoreStartupInstallUnpackFailureTest) {
232 ExtensionInstallPrompt::g_auto_confirm_for_tests = 232 ExtensionInstallPrompt::g_auto_confirm_for_tests =
233 ExtensionInstallPrompt::ACCEPT; 233 ExtensionInstallPrompt::ACCEPT;
234 234
235 ui_test_utils::NavigateToURL(browser(), 235 ui_test_utils::NavigateToURL(browser(),
236 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html")); 236 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html"));
237 237
238 RunTest("runTest"); 238 RunTest("runTest");
239 } 239 }
240 240
241 class CommandLineWebstoreInstall 241 class CommandLineWebstoreInstall
242 : public WebstoreStartupInstallerTest, 242 : public WebstoreStartupInstallerTest,
243 public content::NotificationObserver, 243 public content::NotificationObserver,
244 public extensions::ExtensionRegistryObserver { 244 public extensions::ExtensionRegistryObserver {
245 public: 245 public:
246 CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {} 246 CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {}
247 virtual ~CommandLineWebstoreInstall() {} 247 virtual ~CommandLineWebstoreInstall() {}
248 248
249 virtual void SetUpOnMainThread() OVERRIDE { 249 virtual void SetUpOnMainThread() override {
250 WebstoreStartupInstallerTest::SetUpOnMainThread(); 250 WebstoreStartupInstallerTest::SetUpOnMainThread();
251 extensions::ExtensionRegistry::Get(browser()->profile())->AddObserver(this); 251 extensions::ExtensionRegistry::Get(browser()->profile())->AddObserver(this);
252 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 252 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
253 content::NotificationService::AllSources()); 253 content::NotificationService::AllSources());
254 } 254 }
255 255
256 virtual void TearDownOnMainThread() OVERRIDE { 256 virtual void TearDownOnMainThread() override {
257 extensions::ExtensionRegistry::Get(browser()->profile()) 257 extensions::ExtensionRegistry::Get(browser()->profile())
258 ->RemoveObserver(this); 258 ->RemoveObserver(this);
259 WebstoreStartupInstallerTest::TearDownOnMainThread(); 259 WebstoreStartupInstallerTest::TearDownOnMainThread();
260 } 260 }
261 261
262 bool saw_install() { return saw_install_; } 262 bool saw_install() { return saw_install_; }
263 263
264 int browser_open_count() { return browser_open_count_; } 264 int browser_open_count() { return browser_open_count_; }
265 265
266 // NotificationObserver interface. 266 // NotificationObserver interface.
267 virtual void Observe(int type, 267 virtual void Observe(int type,
268 const content::NotificationSource& source, 268 const content::NotificationSource& source,
269 const content::NotificationDetails& details) OVERRIDE { 269 const content::NotificationDetails& details) override {
270 DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_OPENED); 270 DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_OPENED);
271 ++browser_open_count_; 271 ++browser_open_count_;
272 } 272 }
273 273
274 virtual void OnExtensionWillBeInstalled( 274 virtual void OnExtensionWillBeInstalled(
275 content::BrowserContext* browser_context, 275 content::BrowserContext* browser_context,
276 const extensions::Extension* extension, 276 const extensions::Extension* extension,
277 bool is_update, 277 bool is_update,
278 bool from_ephemeral, 278 bool from_ephemeral,
279 const std::string& old_name) OVERRIDE { 279 const std::string& old_name) override {
280 EXPECT_EQ(extension->id(), kTestExtensionId); 280 EXPECT_EQ(extension->id(), kTestExtensionId);
281 saw_install_ = true; 281 saw_install_ = true;
282 } 282 }
283 283
284 content::NotificationRegistrar registrar_; 284 content::NotificationRegistrar registrar_;
285 285
286 // Have we seen an installation notification for kTestExtensionId ? 286 // Have we seen an installation notification for kTestExtensionId ?
287 bool saw_install_; 287 bool saw_install_;
288 288
289 // How many NOTIFICATION_BROWSER_OPENED notifications have we seen? 289 // How many NOTIFICATION_BROWSER_OPENED notifications have we seen?
290 int browser_open_count_; 290 int browser_open_count_;
291 }; 291 };
292 292
293 IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, CannotInstallNonEphemeral) { 293 IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, CannotInstallNonEphemeral) {
294 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 294 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
295 command_line->AppendSwitchASCII( 295 command_line->AppendSwitchASCII(
296 switches::kInstallEphemeralAppFromWebstore, kTestExtensionId); 296 switches::kInstallEphemeralAppFromWebstore, kTestExtensionId);
297 ExtensionInstallPrompt::g_auto_confirm_for_tests = 297 ExtensionInstallPrompt::g_auto_confirm_for_tests =
298 ExtensionInstallPrompt::ACCEPT; 298 ExtensionInstallPrompt::ACCEPT;
299 extensions::StartupHelper helper; 299 extensions::StartupHelper helper;
300 EXPECT_FALSE(helper.InstallEphemeralApp(*command_line, browser()->profile())); 300 EXPECT_FALSE(helper.InstallEphemeralApp(*command_line, browser()->profile()));
301 EXPECT_FALSE(saw_install()); 301 EXPECT_FALSE(saw_install());
302 EXPECT_EQ(0, browser_open_count()); 302 EXPECT_EQ(0, browser_open_count());
303 } 303 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_startup_installer.h ('k') | chrome/browser/extensions/window_open_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698