summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ssl/ssl_browser_tests.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ssl/ssl_browser_tests.cc')
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc37
1 files changed, 35 insertions, 2 deletions
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index ad614d4..a2a8db2 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -164,6 +164,33 @@ class SSLUITest : public InProcessBrowserTest {
top_frame_path);
}
+ static bool GetPageWithUnsafeWorkerPath(
+ const net::TestServer& expired_https_server,
+ std::string* page_with_unsafe_worker_path) {
+ // Get the "imported.js" URL from the expired https server and
+ // substitute it into the unsafe_worker.js file.
+ GURL imported_js_url = expired_https_server.GetURL("files/ssl/imported.js");
+ std::vector<net::TestServer::StringPair> replacement_text_for_unsafe_worker;
+ replacement_text_for_unsafe_worker.push_back(
+ make_pair("REPLACE_WITH_IMPORTED_JS_URL", imported_js_url.spec()));
+ std::string unsafe_worker_path;
+ if (!net::TestServer::GetFilePathWithReplacements(
+ "unsafe_worker.js",
+ replacement_text_for_unsafe_worker,
+ &unsafe_worker_path))
+ return false;
+
+ // Now, substitute this into the page with unsafe worker.
+ std::vector<net::TestServer::StringPair>
+ replacement_text_for_page_with_unsafe_worker;
+ replacement_text_for_page_with_unsafe_worker.push_back(
+ make_pair("REPLACE_WITH_UNSAFE_WORKER_PATH", unsafe_worker_path));
+ return net::TestServer::GetFilePathWithReplacements(
+ "files/ssl/page_with_unsafe_worker.html",
+ replacement_text_for_page_with_unsafe_worker,
+ page_with_unsafe_worker_path);
+ }
+
net::TestServer https_server_;
net::TestServer https_server_expired_;
net::TestServer https_server_mismatched_;
@@ -1031,8 +1058,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorkerFiltered) {
// This page will spawn a Worker which will try to load content from
// BadCertServer.
+ std::string page_with_unsafe_worker_path;
+ ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_,
+ &page_with_unsafe_worker_path));
ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
- "files/ssl/page_with_unsafe_worker.html"));
+ page_with_unsafe_worker_path));
TabContents* tab = browser()->GetSelectedTabContents();
// Expect Worker not to load insecure content.
CheckWorkerLoadResult(tab, false);
@@ -1059,8 +1089,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) {
// Navigate to safe page that has Worker loading unsafe content.
// Expect content to load but be marked as auth broken due to running insecure
// content.
+ std::string page_with_unsafe_worker_path;
+ ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_,
+ &page_with_unsafe_worker_path));
ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
- "files/ssl/page_with_unsafe_worker.html"));
+ page_with_unsafe_worker_path));
CheckWorkerLoadResult(tab, true); // Worker loads insecure content
CheckAuthenticationBrokenState(tab, 0, true, false);
}