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

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

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase 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
« no previous file with comments | « chrome/browser/extensions/webstore_installer.cc ('k') | chrome/browser/first_run/first_run.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_prompt.h" 7 #include "chrome/browser/extensions/extension_install_prompt.h"
8 #include "chrome/browser/extensions/extension_install_ui.h" 8 #include "chrome/browser/extensions/extension_install_ui.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/startup_helper.h" 10 #include "chrome/browser/extensions/startup_helper.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest, 239 class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest,
240 public content::NotificationObserver { 240 public content::NotificationObserver {
241 public: 241 public:
242 CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {} 242 CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {}
243 virtual ~CommandLineWebstoreInstall() {} 243 virtual ~CommandLineWebstoreInstall() {}
244 244
245 virtual void SetUpOnMainThread() OVERRIDE { 245 virtual void SetUpOnMainThread() OVERRIDE {
246 WebstoreStartupInstallerTest::SetUpOnMainThread(); 246 WebstoreStartupInstallerTest::SetUpOnMainThread();
247 registrar_.Add(this, 247 registrar_.Add(
248 chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, 248 this,
249 content::NotificationService::AllSources()); 249 extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
250 content::NotificationService::AllSources());
250 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 251 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
251 content::NotificationService::AllSources()); 252 content::NotificationService::AllSources());
252 } 253 }
253 254
254 bool saw_install() { return saw_install_; } 255 bool saw_install() { return saw_install_; }
255 256
256 int browser_open_count() { return browser_open_count_; } 257 int browser_open_count() { return browser_open_count_; }
257 258
258 // NotificationObserver interface. 259 // NotificationObserver interface.
259 virtual void Observe(int type, 260 virtual void Observe(int type,
260 const content::NotificationSource& source, 261 const content::NotificationSource& source,
261 const content::NotificationDetails& details) OVERRIDE { 262 const content::NotificationDetails& details) OVERRIDE {
262 if (type == chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) { 263 if (type ==
264 extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) {
263 const Extension* extension = 265 const Extension* extension =
264 content::Details<const extensions::InstalledExtensionInfo>(details)-> 266 content::Details<const extensions::InstalledExtensionInfo>(details)->
265 extension; 267 extension;
266 ASSERT_TRUE(extension != NULL); 268 ASSERT_TRUE(extension != NULL);
267 EXPECT_EQ(extension->id(), kTestExtensionId); 269 EXPECT_EQ(extension->id(), kTestExtensionId);
268 saw_install_ = true; 270 saw_install_ = true;
269 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) { 271 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) {
270 browser_open_count_++; 272 browser_open_count_++;
271 } else { 273 } else {
272 ASSERT_TRUE(false) << "Unexpected notification type : " << type; 274 ASSERT_TRUE(false) << "Unexpected notification type : " << type;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 329 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
328 command_line->AppendSwitchASCII( 330 command_line->AppendSwitchASCII(
329 switches::kLimitedInstallFromWebstore, "2"); 331 switches::kLimitedInstallFromWebstore, "2");
330 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(), 332 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(),
331 base::MessageLoop::QuitWhenIdleClosure()); 333 base::MessageLoop::QuitWhenIdleClosure());
332 base::MessageLoop::current()->Run(); 334 base::MessageLoop::current()->Run();
333 335
334 EXPECT_TRUE(saw_install()); 336 EXPECT_TRUE(saw_install());
335 EXPECT_EQ(0, browser_open_count()); 337 EXPECT_EQ(0, browser_open_count());
336 } 338 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_installer.cc ('k') | chrome/browser/first_run/first_run.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698