| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 25 #include "content/public/browser/storage_partition.h" | 25 #include "content/public/browser/storage_partition.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
| 29 #include "content/public/test/content_browser_test.h" | 29 #include "content/public/test/content_browser_test.h" |
| 30 #include "content/public/test/content_browser_test_utils.h" | 30 #include "content/public/test/content_browser_test_utils.h" |
| 31 #include "content/shell/browser/shell.h" | 31 #include "content/shell/browser/shell.h" |
| 32 #include "content/shell/browser/shell_content_browser_client.h" |
| 32 #include "net/test/embedded_test_server/embedded_test_server.h" | 33 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 33 #include "net/test/embedded_test_server/http_request.h" | 34 #include "net/test/embedded_test_server/http_request.h" |
| 34 #include "net/test/embedded_test_server/http_response.h" | 35 #include "net/test/embedded_test_server/http_response.h" |
| 35 #include "net/url_request/url_request_filter.h" | 36 #include "net/url_request/url_request_filter.h" |
| 36 #include "net/url_request/url_request_interceptor.h" | 37 #include "net/url_request/url_request_interceptor.h" |
| 37 #include "net/url_request/url_request_test_job.h" | 38 #include "net/url_request/url_request_test_job.h" |
| 38 #include "storage/browser/blob/blob_data_handle.h" | 39 #include "storage/browser/blob/blob_data_handle.h" |
| 39 #include "storage/browser/blob/blob_storage_context.h" | 40 #include "storage/browser/blob/blob_storage_context.h" |
| 40 #include "storage/common/blob/blob_data.h" | 41 #include "storage/common/blob/blob_data.h" |
| 41 | 42 |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 941 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
| 941 RunOnIOThread( | 942 RunOnIOThread( |
| 942 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, | 943 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, |
| 943 this, | 944 this, |
| 944 embedded_test_server()->GetURL("/service_worker/empty.html"), | 945 embedded_test_server()->GetURL("/service_worker/empty.html"), |
| 945 &status)); | 946 &status)); |
| 946 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); | 947 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); |
| 947 } | 948 } |
| 948 } | 949 } |
| 949 | 950 |
| 951 IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, CrossSiteTransfer) { |
| 952 // The first page registers a service worker. |
| 953 const std::string kRegisterPageUrl = "/service_worker/cross_site_xfer.html"; |
| 954 const base::string16 kOKTitle1(base::ASCIIToUTF16("OK_1")); |
| 955 const base::string16 kFailTitle1(base::ASCIIToUTF16("FAIL_1")); |
| 956 content::TitleWatcher title_watcher1(shell()->web_contents(), kOKTitle1); |
| 957 title_watcher1.AlsoWaitForTitle(kFailTitle1); |
| 958 |
| 959 NavigateToURL(shell(), embedded_test_server()->GetURL(kRegisterPageUrl)); |
| 960 ASSERT_EQ(kOKTitle1, title_watcher1.WaitAndGetTitle()); |
| 961 |
| 962 // Force process swapping behavior. |
| 963 ShellContentBrowserClient::SetSwapProcessesForRedirect(true); |
| 964 |
| 965 // The second pages loads via the serviceworker including a subresource. |
| 966 const std::string kConfirmPageUrl = |
| 967 "/service_worker/cross_site_xfer_scope/" |
| 968 "cross_site_xfer_confirm_via_serviceworker.html"; |
| 969 const base::string16 kOKTitle2(base::ASCIIToUTF16("OK_2")); |
| 970 const base::string16 kFailTitle2(base::ASCIIToUTF16("FAIL_2")); |
| 971 content::TitleWatcher title_watcher2(shell()->web_contents(), kOKTitle2); |
| 972 title_watcher2.AlsoWaitForTitle(kFailTitle2); |
| 973 |
| 974 NavigateToURL(shell(), embedded_test_server()->GetURL(kConfirmPageUrl)); |
| 975 EXPECT_EQ(kOKTitle2, title_watcher2.WaitAndGetTitle()); |
| 976 } |
| 977 |
| 950 } // namespace content | 978 } // namespace content |
| OLD | NEW |