| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |