| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 TitleWatcher title_watcher(shell()->web_contents(), title); | 2024 TitleWatcher title_watcher(shell()->web_contents(), title); |
| 2025 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("RESOLVED")); | 2025 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("RESOLVED")); |
| 2026 NavigateToURL(shell(), page_url); | 2026 NavigateToURL(shell(), page_url); |
| 2027 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); | 2027 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); |
| 2028 | 2028 |
| 2029 // The page request must be sent only once, since the worker responded with | 2029 // The page request must be sent only once, since the worker responded with |
| 2030 // a generated Response. | 2030 // a generated Response. |
| 2031 EXPECT_EQ(1, GetRequestCount(kPageUrl)); | 2031 EXPECT_EQ(1, GetRequestCount(kPageUrl)); |
| 2032 // The redirected request must not be sent. | 2032 // The redirected request must not be sent. |
| 2033 EXPECT_EQ(0, GetRequestCount(kRedirectedPageUrl)); | 2033 EXPECT_EQ(0, GetRequestCount(kRedirectedPageUrl)); |
| 2034 // TODO(horo): When MojoAsyncResourceHandler will support redirection, we | 2034 EXPECT_EQ( |
| 2035 // shold provide more specific error message. | 2035 "NetworkError: Service Worker navigation preload doesn't suport " |
| 2036 EXPECT_EQ("NetworkError: Service Worker navigation preload network error.", | 2036 "redirect.", |
| 2037 GetTextContent()); | 2037 GetTextContent()); |
| 2038 } | 2038 } |
| 2039 | 2039 |
| 2040 // Tests responding with the navigation preload response when the navigation | 2040 // Tests responding with the navigation preload response when the navigation |
| 2041 // occurred after a redirect. | 2041 // occurred after a redirect. |
| 2042 IN_PROC_BROWSER_TEST_P(ServiceWorkerNavigationPreloadTest, | 2042 IN_PROC_BROWSER_TEST_P(ServiceWorkerNavigationPreloadTest, |
| 2043 RedirectAndRespondWithNavigationPreload) { | 2043 RedirectAndRespondWithNavigationPreload) { |
| 2044 const std::string kPageUrl = "/service_worker/navigation_preload.html"; | 2044 const std::string kPageUrl = "/service_worker/navigation_preload.html"; |
| 2045 const char kWorkerUrl[] = "/service_worker/navigation_preload.js"; | 2045 const char kWorkerUrl[] = "/service_worker/navigation_preload.js"; |
| 2046 const char kPage[] = | 2046 const char kPage[] = |
| 2047 "<title></title>\n" | 2047 "<title></title>\n" |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 ServiceWorkerV8CacheStrategiesNormalTest, | 2847 ServiceWorkerV8CacheStrategiesNormalTest, |
| 2848 ::testing::Values(true, false)); | 2848 ::testing::Values(true, false)); |
| 2849 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest, | 2849 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest, |
| 2850 ServiceWorkerV8CacheStrategiesAggressiveTest, | 2850 ServiceWorkerV8CacheStrategiesAggressiveTest, |
| 2851 ::testing::Values(true, false)); | 2851 ::testing::Values(true, false)); |
| 2852 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest, | 2852 INSTANTIATE_TEST_CASE_P(ServiceWorkerBrowserTest, |
| 2853 ServiceWorkerDisableWebSecurityTest, | 2853 ServiceWorkerDisableWebSecurityTest, |
| 2854 ::testing::Values(true, false)); | 2854 ::testing::Values(true, false)); |
| 2855 | 2855 |
| 2856 } // namespace content | 2856 } // namespace content |
| OLD | NEW |