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

Unified Diff: chrome/browser/extensions/crx_installer_browsertest.cc

Issue 10699057: Move application creation and extension install prompt showing off Browser and onto ExtensionTabHel… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/bundle_installer.cc ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/crx_installer_browsertest.cc
===================================================================
--- chrome/browser/extensions/crx_installer_browsertest.cc (revision 145357)
+++ chrome/browser/extensions/crx_installer_browsertest.cc (working copy)
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_file_util.h"
@@ -31,8 +32,10 @@
class MockInstallPrompt : public ExtensionInstallPrompt {
public:
- explicit MockInstallPrompt(Browser* browser) :
- ExtensionInstallPrompt(browser),
+ explicit MockInstallPrompt(gfx::NativeWindow parent,
+ content::PageNavigator* navigator,
+ Profile* profile) :
+ ExtensionInstallPrompt(parent, navigator, profile),
confirmation_requested_(false),
extension_(NULL) {}
@@ -64,6 +67,12 @@
const Extension* extension_;
};
+MockInstallPrompt* CreateMockInstallPromptForBrowser(Browser* browser) {
+ gfx::NativeWindow parent =
+ browser->window() ? browser->window()->GetNativeWindow() : NULL;
+ return new MockInstallPrompt(parent, browser, browser->profile());
+}
+
} // namespace
class ExtensionCrxInstallerTest : public ExtensionBrowserTest {
@@ -113,7 +122,8 @@
ExtensionService* service = browser()->profile()->GetExtensionService();
- MockInstallPrompt* mock_prompt = new MockInstallPrompt(browser());
+ MockInstallPrompt* mock_prompt =
+ CreateMockInstallPromptForBrowser(browser());
mock_prompt->set_record_oauth2_grant(record_oauth2_grant);
scoped_refptr<CrxInstaller> installer =
InstallWithPrompt("browsertest/scopes", std::string(), mock_prompt);
@@ -136,7 +146,8 @@
ExtensionService* service = browser()->profile()->GetExtensionService();
// Even whitelisted extensions with NPAPI should not prompt.
- MockInstallPrompt* mock_prompt = new MockInstallPrompt(browser());
+ MockInstallPrompt* mock_prompt =
+ CreateMockInstallPromptForBrowser(browser());
scoped_refptr<CrxInstaller> installer =
InstallWithPrompt("uitest/plugins", id, mock_prompt);
EXPECT_FALSE(mock_prompt->confirmation_requested());
@@ -183,7 +194,8 @@
std::string crx_path_string(crx_path.value().begin(), crx_path.value().end());
GURL url = GURL(std::string("file:///").append(crx_path_string));
- MockInstallPrompt* mock_prompt = new MockInstallPrompt(browser());
+ MockInstallPrompt* mock_prompt =
+ CreateMockInstallPromptForBrowser(browser());
download_crx_util::SetMockInstallPromptForTesting(mock_prompt);
LOG(ERROR) << "PackAndInstallExtension: Getting download manager";
@@ -228,7 +240,8 @@
const bool kTestData[] = {false, true};
for (size_t i = 0; i < arraysize(kTestData); ++i) {
- MockInstallPrompt* mock_prompt = new MockInstallPrompt(browser());
+ MockInstallPrompt* mock_prompt =
+ CreateMockInstallPromptForBrowser(browser());
scoped_refptr<CrxInstaller> crx_installer(
CrxInstaller::Create(service, mock_prompt));
crx_installer->set_install_cause(
« no previous file with comments | « chrome/browser/extensions/bundle_installer.cc ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698