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

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

Issue 298883006: Rename NOTIFICATION_EXTENSION_INSTALLED to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 6 years, 7 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 "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.h"
7 #include "chrome/browser/extensions/extension_install_ui.h" 7 #include "chrome/browser/extensions/extension_install_ui.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/startup_helper.h" 9 #include "chrome/browser/extensions/startup_helper.h"
10 #include "chrome/browser/extensions/webstore_installer_test.h" 10 #include "chrome/browser/extensions/webstore_installer_test.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest, 238 class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest,
239 public content::NotificationObserver { 239 public content::NotificationObserver {
240 public: 240 public:
241 CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {} 241 CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {}
242 virtual ~CommandLineWebstoreInstall() {} 242 virtual ~CommandLineWebstoreInstall() {}
243 243
244 virtual void SetUpOnMainThread() OVERRIDE { 244 virtual void SetUpOnMainThread() OVERRIDE {
245 WebstoreStartupInstallerTest::SetUpOnMainThread(); 245 WebstoreStartupInstallerTest::SetUpOnMainThread();
246 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, 246 registrar_.Add(this,
247 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED,
247 content::NotificationService::AllSources()); 248 content::NotificationService::AllSources());
248 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 249 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
249 content::NotificationService::AllSources()); 250 content::NotificationService::AllSources());
250 } 251 }
251 252
252 bool saw_install() { return saw_install_; } 253 bool saw_install() { return saw_install_; }
253 254
254 int browser_open_count() { return browser_open_count_; } 255 int browser_open_count() { return browser_open_count_; }
255 256
256 // NotificationObserver interface. 257 // NotificationObserver interface.
257 virtual void Observe(int type, 258 virtual void Observe(int type,
258 const content::NotificationSource& source, 259 const content::NotificationSource& source,
259 const content::NotificationDetails& details) OVERRIDE { 260 const content::NotificationDetails& details) OVERRIDE {
260 if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) { 261 if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED) {
261 const Extension* extension = 262 const Extension* extension =
262 content::Details<const extensions::InstalledExtensionInfo>(details)-> 263 content::Details<const extensions::InstalledExtensionInfo>(details)->
263 extension; 264 extension;
264 ASSERT_TRUE(extension != NULL); 265 ASSERT_TRUE(extension != NULL);
265 EXPECT_EQ(extension->id(), kTestExtensionId); 266 EXPECT_EQ(extension->id(), kTestExtensionId);
266 saw_install_ = true; 267 saw_install_ = true;
267 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) { 268 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) {
268 browser_open_count_++; 269 browser_open_count_++;
269 } else { 270 } else {
270 ASSERT_TRUE(false) << "Unexpected notification type : " << type; 271 ASSERT_TRUE(false) << "Unexpected notification type : " << type;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 326 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
326 command_line->AppendSwitchASCII( 327 command_line->AppendSwitchASCII(
327 switches::kLimitedInstallFromWebstore, "2"); 328 switches::kLimitedInstallFromWebstore, "2");
328 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(), 329 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(),
329 base::MessageLoop::QuitWhenIdleClosure()); 330 base::MessageLoop::QuitWhenIdleClosure());
330 base::MessageLoop::current()->Run(); 331 base::MessageLoop::current()->Run();
331 332
332 EXPECT_TRUE(saw_install()); 333 EXPECT_TRUE(saw_install());
333 EXPECT_EQ(0, browser_open_count()); 334 EXPECT_EQ(0, browser_open_count());
334 } 335 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater.cc ('k') | chrome/browser/performance_monitor/performance_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698