Chromium Code Reviews| Index: chrome/browser/extensions/extension_browsertest.cc |
| diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc |
| index 6f29447014552125c8fdd211806e1b20f85de69d..d5d9491fac1a5bc8e15e1f1dddb4bf25c4953469 100644 |
| --- a/chrome/browser/extensions/extension_browsertest.cc |
| +++ b/chrome/browser/extensions/extension_browsertest.cc |
| @@ -120,11 +120,30 @@ class MockAbortExtensionInstallUI : public ExtensionInstallUI { |
| virtual void OnInstallFailure(const std::string& error) {} |
| }; |
| +class MockAutoConfirmExtensionInstallUI : public ExtensionInstallUI { |
| + public: |
| + MockAutoConfirmExtensionInstallUI(Profile* profile) : ExtensionInstallUI(profile) {} |
|
Aaron Boodman
2010/12/14 23:21:44
80 cols
Tessa MacDuff
2010/12/15 00:38:55
Done.
|
| + |
| + // Proceed without confirmation prompt. |
| + virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { |
| + delegate->InstallUIProceed(); |
| + } |
| +}; |
| + |
| bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id, |
| const FilePath& path, |
| InstallUIType ui_type, |
| int expected_change) { |
| - ExtensionService* service = browser()->profile()->GetExtensionService(); |
| + return InstallOrUpdateExtension(id, path, ui_type, expected_change, |
| + browser()->profile()); |
| +} |
| + |
| +bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id, |
| + const FilePath& path, |
| + InstallUIType ui_type, |
| + int expected_change, |
| + Profile* profile) { |
| + ExtensionService* service = profile->GetExtensionService(); |
| service->set_show_extensions_prompts(false); |
| size_t num_before = service->extensions()->size(); |
| @@ -141,7 +160,9 @@ bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id, |
| if (ui_type == INSTALL_UI_TYPE_CANCEL) |
| install_ui = new MockAbortExtensionInstallUI(); |
| else if (ui_type == INSTALL_UI_TYPE_NORMAL) |
| - install_ui = new ExtensionInstallUI(browser()->profile()); |
| + install_ui = new ExtensionInstallUI(profile); |
| + else if (ui_type == INSTALL_UI_TYPE_AUTO_CONFIRM) |
| + install_ui = new MockAutoConfirmExtensionInstallUI(profile); |
| scoped_refptr<CrxInstaller> installer( |
| new CrxInstaller(service, install_ui)); |