diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 17:36:20 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 17:36:20 +0000 |
commit | 7469188609cb06b487f04139bfc6cbc7504ca3e4 (patch) | |
tree | a6393552fefb5cf368a78d215e62f5e9bb5f04de /chrome/browser/ssl | |
parent | 0f1fd858ccc4f6f472d33e7e5f11bab40e86f0a1 (diff) | |
download | chromium_src-7469188609cb06b487f04139bfc6cbc7504ca3e4.zip chromium_src-7469188609cb06b487f04139bfc6cbc7504ca3e4.tar.gz chromium_src-7469188609cb06b487f04139bfc6cbc7504ca3e4.tar.bz2 |
Fix SSLUITest.TestUnsafeContentsInWorker*.
These still expected fixed port testserver's, but were undetected as failing since marked FLAKY.
BUG=64785
TEST=browser_tests --gtest_filter="*TestUnsafeContentsInWorker*"
Review URL: http://codereview.chromium.org/5472001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ssl')
-rw-r--r-- | chrome/browser/ssl/ssl_browser_tests.cc | 37 |
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); } |