Index: chrome/browser/extensions/webstore_inline_install_browsertest.cc |
diff --git a/chrome/browser/extensions/webstore_inline_install_browsertest.cc b/chrome/browser/extensions/webstore_inline_install_browsertest.cc |
index 3ef8184b6653a10c58bb7f4d97ae83062253dee4..b0fe006df650b5df509ba906529e728706525860 100644 |
--- a/chrome/browser/extensions/webstore_inline_install_browsertest.cc |
+++ b/chrome/browser/extensions/webstore_inline_install_browsertest.cc |
@@ -23,6 +23,7 @@ |
const char kWebstoreDomain[] = "cws.com"; |
const char kAppDomain[] = "app.com"; |
+const char kNonAppDomain[] = "nonapp.com"; |
class WebstoreInlineInstallTest : public InProcessBrowserTest { |
public: |
@@ -52,6 +53,7 @@ class WebstoreInlineInstallTest : public InProcessBrowserTest { |
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
host_resolver()->AddRule(kWebstoreDomain, "127.0.0.1"); |
host_resolver()->AddRule(kAppDomain, "127.0.0.1"); |
+ host_resolver()->AddRule(kNonAppDomain, "127.0.0.1"); |
} |
protected: |
@@ -65,6 +67,16 @@ class WebstoreInlineInstallTest : public InProcessBrowserTest { |
return page_url.ReplaceComponents(replace_host); |
} |
+ void RunInlineInstallTest() { |
+ bool result = false; |
+ std::string script = |
+ StringPrintf("runTest('%s')", test_gallery_url_.c_str()); |
+ ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
+ browser()->GetSelectedTabContents()->render_view_host(), L"", |
+ UTF8ToWide(script), &result)); |
+ EXPECT_TRUE(result); |
+ } |
+ |
std::string test_gallery_url_; |
}; |
@@ -78,12 +90,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) { |
ui_test_utils::NavigateToURL( |
browser(), GenerateTestServerUrl(kAppDomain, "install.html")); |
- bool result = false; |
- std::string script = StringPrintf("runTest('%s')", test_gallery_url_.c_str()); |
- ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- browser()->GetSelectedTabContents()->render_view_host(), L"", |
- UTF8ToWide(script), &result)); |
- EXPECT_TRUE(result); |
+ RunInlineInstallTest(); |
load_signal.Wait(); |
@@ -92,6 +99,16 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) { |
EXPECT_TRUE(extension != NULL); |
} |
+IN_PROC_BROWSER_TEST_F( |
+ WebstoreInlineInstallTest, InstallNotAllowedFromNonVerifiedDomains) { |
+ SetExtensionInstallDialogForManifestAutoConfirmForTests(false); |
+ ui_test_utils::NavigateToURL( |
+ browser(), |
+ GenerateTestServerUrl(kNonAppDomain, "install-non-verified-domain.html")); |
+ |
+ RunInlineInstallTest(); |
+} |
+ |
// Flakily fails on Linux. http://crbug.com/95280 |
#if defined(OS_LINUX) |
#define MAYBE_FindLink FLAKY_FindLink |
@@ -103,10 +120,13 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, MAYBE_FindLink) { |
ui_test_utils::NavigateToURL( |
browser(), GenerateTestServerUrl(kAppDomain, "find_link.html")); |
- bool result = false; |
- std::string script = StringPrintf("runTest('%s')", test_gallery_url_.c_str()); |
- ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
- browser()->GetSelectedTabContents()->render_view_host(), L"", |
- UTF8ToWide(script), &result)); |
- EXPECT_TRUE(result); |
+ RunInlineInstallTest(); |
+} |
+ |
+IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, ArgumentValidation) { |
+ SetExtensionInstallDialogForManifestAutoConfirmForTests(false); |
+ ui_test_utils::NavigateToURL( |
+ browser(), GenerateTestServerUrl(kAppDomain, "argument_validation.html")); |
+ |
+ RunInlineInstallTest(); |
} |