Chromium Code Reviews| Index: content/child/web_url_loader_impl_unittest.cc |
| diff --git a/content/child/web_url_loader_impl_unittest.cc b/content/child/web_url_loader_impl_unittest.cc |
| index a85dd049118521032fd0490e46ddc52aeab8b072..a2169494c2310efd1801071b79896c622c06bc5c 100644 |
| --- a/content/child/web_url_loader_impl_unittest.cc |
| +++ b/content/child/web_url_loader_impl_unittest.cc |
| @@ -71,6 +71,7 @@ class TestResourceDispatcher : public ResourceDispatcher { |
| peer_ = std::move(peer); |
| url_ = request_info.url; |
| stream_url_ = request_info.resource_body_stream_url; |
| + empty_body_in_service_worker_ = request_info.empty_body_in_service_worker; |
| return 1; |
| } |
| @@ -85,12 +86,16 @@ class TestResourceDispatcher : public ResourceDispatcher { |
| const GURL& url() { return url_; } |
| const GURL& stream_url() { return stream_url_; } |
| + bool empty_body_in_service_worker() const { |
| + return empty_body_in_service_worker_; |
| + } |
| private: |
| scoped_ptr<RequestPeer> peer_; |
| bool canceled_; |
| GURL url_; |
| GURL stream_url_; |
| + bool empty_body_in_service_worker_; |
| DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher); |
| }; |
| @@ -598,6 +603,34 @@ TEST_F(WebURLLoaderImplTest, BrowserSideNavigationCommit) { |
| EXPECT_EQ(kTestData, client()->received_data()); |
| } |
| +TEST_F(WebURLLoaderImplTest, EmptyBodyInServiceWorkerNoCredential) { |
| + // Initialize the request and kick off the load |
| + blink::WebURLRequest request; |
| + request.initialize(); |
| + request.setURL(GURL(kTestURL)); |
| + request.setHTTPMethod("POST"); |
| + client()->loader()->loadAsynchronously(request, client()); |
| + |
| + // No credential body, so the body can be given to the service worker. |
| + EXPECT_FALSE(dispatcher()->empty_body_in_service_worker()); |
| +} |
| + |
| +TEST_F(WebURLLoaderImplTest, EmptyBodyInServiceWorkerWithCredential) { |
| + // Initialize the request and kick off the load |
| + blink::WebURLRequest request; |
| + request.initialize(); |
| + request.setHTTPMethod("POST"); |
| + request.setURL(GURL(kTestURL)); |
|
tyoshino (SeeGerritForStatus)
2016/04/12 16:30:25
order these two lines the same as EmptyBodyInServi
|
| + |
| + blink::WebHTTPBody body; |
| + body.initialize(); |
| + request.setAttachedCredentialBody(body); |
| + client()->loader()->loadAsynchronously(request, client()); |
| + |
| + // No credential body, so the body can be given to the service worker. |
| + EXPECT_TRUE(dispatcher()->empty_body_in_service_worker()); |
| +} |
| + |
| TEST_F(WebURLLoaderImplTest, ResponseIPAddress) { |
| GURL url("http://example.test/"); |