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 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("RESOLVED")); | 2071 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("RESOLVED")); |
2072 NavigateToURL(shell(), page_url); | 2072 NavigateToURL(shell(), page_url); |
2073 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); | 2073 EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); |
2074 | 2074 |
2075 // The page request must be sent only once, since the worker responded with | 2075 // The page request must be sent only once, since the worker responded with |
2076 // a generated Response. | 2076 // a generated Response. |
2077 EXPECT_EQ(1, GetRequestCount(kPageUrl)); | 2077 EXPECT_EQ(1, GetRequestCount(kPageUrl)); |
2078 // The redirected request must not be sent. | 2078 // The redirected request must not be sent. |
2079 EXPECT_EQ(0, GetRequestCount(kRedirectedPageUrl)); | 2079 EXPECT_EQ(0, GetRequestCount(kRedirectedPageUrl)); |
2080 EXPECT_EQ( | 2080 EXPECT_EQ( |
2081 "NetworkError: Service Worker navigation preload doesn't suport " | 2081 "NetworkError: Service Worker navigation preload doesn't support " |
2082 "redirect.", | 2082 "redirect.", |
2083 GetTextContent()); | 2083 GetTextContent()); |
2084 } | 2084 } |
2085 | 2085 |
2086 // Tests responding with the navigation preload response when the navigation | 2086 // Tests responding with the navigation preload response when the navigation |
2087 // occurred after a redirect. | 2087 // occurred after a redirect. |
2088 IN_PROC_BROWSER_TEST_F(ServiceWorkerNavigationPreloadTest, | 2088 IN_PROC_BROWSER_TEST_F(ServiceWorkerNavigationPreloadTest, |
2089 RedirectAndRespondWithNavigationPreload) { | 2089 RedirectAndRespondWithNavigationPreload) { |
2090 const std::string kPageUrl = "/service_worker/navigation_preload.html"; | 2090 const std::string kPageUrl = "/service_worker/navigation_preload.html"; |
2091 const char kWorkerUrl[] = "/service_worker/navigation_preload.js"; | 2091 const char kWorkerUrl[] = "/service_worker/navigation_preload.js"; |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2936 // effect in CanSuspendRenderer(). | 2936 // effect in CanSuspendRenderer(). |
2937 shell()->web_contents()->WasHidden(); | 2937 shell()->web_contents()->WasHidden(); |
2938 EXPECT_TRUE(rph->IsProcessBackgrounded()); | 2938 EXPECT_TRUE(rph->IsProcessBackgrounded()); |
2939 | 2939 |
2940 // The process which has service worker thread shouldn't be suspended. | 2940 // The process which has service worker thread shouldn't be suspended. |
2941 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); | 2941 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); |
2942 } | 2942 } |
2943 #endif | 2943 #endif |
2944 | 2944 |
2945 } // namespace content | 2945 } // namespace content |
OLD | NEW |