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 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 const GURL worker_url = embedded_test_server()->GetURL(kWorkerUrl); | 2165 const GURL worker_url = embedded_test_server()->GetURL(kWorkerUrl); |
2166 RegisterCustomResponse(kPageUrl, kPageResponse); | 2166 RegisterCustomResponse(kPageUrl, kPageResponse); |
2167 RegisterStaticFile( | 2167 RegisterStaticFile( |
2168 kWorkerUrl, kEnableNavigationPreloadScript + kPreloadResponseTestScript, | 2168 kWorkerUrl, kEnableNavigationPreloadScript + kPreloadResponseTestScript, |
2169 "text/javascript"); | 2169 "text/javascript"); |
2170 | 2170 |
2171 // TODO(horo): According to the spec, even if the location URL is invalid, the | 2171 // TODO(horo): According to the spec, even if the location URL is invalid, the |
2172 // preloadResponse must be resolve with an opaque redirect response. But | 2172 // preloadResponse must be resolve with an opaque redirect response. But |
2173 // currently Chrome handles the invalid location URL in the browser process as | 2173 // currently Chrome handles the invalid location URL in the browser process as |
2174 // an error. crbug.com/707185 | 2174 // an error. crbug.com/707185 |
2175 EXPECT_EQ("NetworkError: " + kNavigationPreloadAbortError, | 2175 EXPECT_EQ("NetworkError: " + kNavigationPreloadNetworkError, |
2176 LoadNavigationPreloadTestPage(page_url, worker_url, "REJECTED")); | 2176 LoadNavigationPreloadTestPage(page_url, worker_url, "REJECTED")); |
2177 | 2177 |
2178 // The page request must be sent only once, since the worker responded with | 2178 // The page request must be sent only once, since the worker responded with |
2179 // a generated Response. | 2179 // a generated Response. |
2180 EXPECT_EQ(1, GetRequestCount(kPageUrl)); | 2180 EXPECT_EQ(1, GetRequestCount(kPageUrl)); |
2181 } | 2181 } |
2182 | 2182 |
2183 // Tests responding with the navigation preload response when the navigation | 2183 // Tests responding with the navigation preload response when the navigation |
2184 // occurred after a redirect. | 2184 // occurred after a redirect. |
2185 IN_PROC_BROWSER_TEST_F(ServiceWorkerNavigationPreloadTest, | 2185 IN_PROC_BROWSER_TEST_F(ServiceWorkerNavigationPreloadTest, |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3030 // effect in CanSuspendRenderer(). | 3030 // effect in CanSuspendRenderer(). |
3031 shell()->web_contents()->WasHidden(); | 3031 shell()->web_contents()->WasHidden(); |
3032 EXPECT_TRUE(rph->IsProcessBackgrounded()); | 3032 EXPECT_TRUE(rph->IsProcessBackgrounded()); |
3033 | 3033 |
3034 // The process which has service worker thread shouldn't be suspended. | 3034 // The process which has service worker thread shouldn't be suspended. |
3035 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); | 3035 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); |
3036 } | 3036 } |
3037 #endif | 3037 #endif |
3038 | 3038 |
3039 } // namespace content | 3039 } // namespace content |
OLD | NEW |