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

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

Issue 14238037: Made it possible to tell whether an extension is being installed or updated. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added extra check. Created 7 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 "base/stringprintf.h" 6 #include "base/stringprintf.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 bool saw_install() { return saw_install_; } 283 bool saw_install() { return saw_install_; }
284 284
285 int browser_open_count() { return browser_open_count_; } 285 int browser_open_count() { return browser_open_count_; }
286 286
287 // NotificationObserver interface. 287 // NotificationObserver interface.
288 virtual void Observe(int type, 288 virtual void Observe(int type,
289 const content::NotificationSource& source, 289 const content::NotificationSource& source,
290 const content::NotificationDetails& details) OVERRIDE { 290 const content::NotificationDetails& details) OVERRIDE {
291 if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) { 291 if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) {
292 const Extension* extension = content::Details<Extension>(details).ptr(); 292 const Extension* extension =
293 content::Details<const extensions::InstalledExtensionInfo>(details)->
294 extension;
293 ASSERT_TRUE(extension != NULL); 295 ASSERT_TRUE(extension != NULL);
294 EXPECT_EQ(extension->id(), kTestExtensionId); 296 EXPECT_EQ(extension->id(), kTestExtensionId);
295 saw_install_ = true; 297 saw_install_ = true;
296 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) { 298 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) {
297 browser_open_count_++; 299 browser_open_count_++;
298 } else { 300 } else {
299 ASSERT_TRUE(false) << "Unexpected notification type : " << type; 301 ASSERT_TRUE(false) << "Unexpected notification type : " << type;
300 } 302 }
301 } 303 }
302 304
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 CommandLine* command_line = CommandLine::ForCurrentProcess(); 356 CommandLine* command_line = CommandLine::ForCurrentProcess();
355 command_line->AppendSwitchASCII( 357 command_line->AppendSwitchASCII(
356 switches::kLimitedInstallFromWebstore, "2"); 358 switches::kLimitedInstallFromWebstore, "2");
357 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(), 359 helper.LimitedInstallFromWebstore(*command_line, browser()->profile(),
358 MessageLoop::QuitWhenIdleClosure()); 360 MessageLoop::QuitWhenIdleClosure());
359 MessageLoop::current()->Run(); 361 MessageLoop::current()->Run();
360 362
361 EXPECT_TRUE(saw_install()); 363 EXPECT_TRUE(saw_install());
362 EXPECT_EQ(0, browser_open_count()); 364 EXPECT_EQ(0, browser_open_count());
363 } 365 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_installer.cc ('k') | chrome/browser/managed_mode/managed_user_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698