Chromium Code Reviews| Index: content/browser/service_worker/service_worker_browsertest.cc |
| diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc |
| index ec45a26a2f7ca97674b9ad3fbdf0bd29549e386b..f9d92a8f1b1a6a082059a81b90abb1e27dc75101 100644 |
| --- a/content/browser/service_worker/service_worker_browsertest.cc |
| +++ b/content/browser/service_worker/service_worker_browsertest.cc |
| @@ -21,11 +21,14 @@ |
| #include "content/common/service_worker/service_worker_types.h" |
| #include "content/public/browser/browser_context.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/storage_partition.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/referrer.h" |
| +#include "content/public/common/security_style.h" |
| +#include "content/public/common/ssl_status.h" |
| #include "content/public/test/browser_test_utils.h" |
| #include "content/public/test/content_browser_test.h" |
| #include "content/public/test/content_browser_test_utils.h" |
| @@ -800,6 +803,45 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, Reload) { |
| } |
| } |
| +IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, Secure) { |
|
falken
2015/01/27 03:57:54
Can you give a name that describes more what this
horo
2015/01/27 06:04:41
Done.
|
| + net::SpawnedTestServer https_server( |
| + net::SpawnedTestServer::TYPE_HTTPS, |
| + net::BaseTestServer::SSLOptions( |
| + net::BaseTestServer::SSLOptions::CERT_OK), |
| + base::FilePath(FILE_PATH_LITERAL("content/test/data/"))); |
| + ASSERT_TRUE(https_server.Start()); |
| + const std::string kPageUrl = "files/service_worker/fetch_event_blob.html"; |
| + const std::string kWorkerUrl = "files/service_worker/fetch_event_blob.js"; |
| + { |
| + scoped_refptr<WorkerActivatedObserver> observer = |
| + new WorkerActivatedObserver(wrapper()); |
| + observer->Init(); |
| + public_context()->RegisterServiceWorker( |
| + https_server.GetURL(kPageUrl), |
| + https_server.GetURL(kWorkerUrl), |
| + base::Bind(&ExpectResultAndRun, true, base::Bind(&base::DoNothing))); |
| + observer->Wait(); |
| + } |
| + { |
| + const base::string16 title = base::ASCIIToUTF16("Title"); |
| + TitleWatcher title_watcher(shell()->web_contents(), title); |
| + NavigateToURL(shell(), https_server.GetURL(kPageUrl)); |
| + EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); |
| + EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); |
| + NavigationEntry* entry = |
| + shell()->web_contents()->GetController().GetActiveEntry(); |
|
falken
2015/01/27 03:57:54
GetActiveEntry comments say "THIS IS DEPRECATED. D
horo
2015/01/27 06:04:41
Done.
|
| + EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->GetSSL().security_style); |
| + } |
| + shell()->Close(); |
| + { |
| + base::RunLoop run_loop; |
| + public_context()->UnregisterServiceWorker( |
| + https_server.GetURL(kPageUrl), |
| + base::Bind(&ExpectResultAndRun, true, run_loop.QuitClosure())); |
| + run_loop.Run(); |
| + } |
| +} |
| + |
| IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, ImportsBustMemcache) { |
| const std::string kScopeUrl = "/service_worker/imports_bust_memcache_scope/"; |
| const std::string kPageUrl = "/service_worker/imports_bust_memcache.html"; |