| 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 "modules/fetch/Request.h" | 5 #include "modules/fetch/Request.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/V8BindingForTesting.h" | 9 #include "bindings/core/v8/V8BindingForTesting.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 EXPECT_EQ(iter->value, requestHeaders->get(iter->key, exceptionState)); | 92 EXPECT_EQ(iter->value, requestHeaders->get(iter->key, exceptionState)); |
| 93 EXPECT_FALSE(exceptionState.hadException()); | 93 EXPECT_FALSE(exceptionState.hadException()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 WebServiceWorkerRequest secondWebRequest; | 96 WebServiceWorkerRequest secondWebRequest; |
| 97 request->populateWebServiceWorkerRequest(secondWebRequest); | 97 request->populateWebServiceWorkerRequest(secondWebRequest); |
| 98 EXPECT_EQ(url, KURL(secondWebRequest.url())); | 98 EXPECT_EQ(url, KURL(secondWebRequest.url())); |
| 99 EXPECT_EQ(method, String(secondWebRequest.method())); | 99 EXPECT_EQ(method, String(secondWebRequest.method())); |
| 100 EXPECT_EQ(context, secondWebRequest.requestContext()); | 100 EXPECT_EQ(context, secondWebRequest.requestContext()); |
| 101 EXPECT_EQ(referrer, KURL(secondWebRequest.referrerUrl())); | 101 EXPECT_EQ(referrer, KURL(secondWebRequest.referrerUrl())); |
| 102 EXPECT_EQ(WebReferrerPolicyAlways, secondWebRequest.referrerPolicy()); | 102 EXPECT_EQ(WebReferrerPolicyAlways, secondWebRequest.getReferrerPolicy()); |
| 103 EXPECT_EQ(webRequest.headers(), secondWebRequest.headers()); | 103 EXPECT_EQ(webRequest.headers(), secondWebRequest.headers()); |
| 104 EXPECT_EQ(WebURLRequest::FetchRequestModeNoCORS, secondWebRequest.mode()); | 104 EXPECT_EQ(WebURLRequest::FetchRequestModeNoCORS, secondWebRequest.mode()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 TEST(ServiceWorkerRequestTest, ToWebRequestStripsURLFragment) { | 107 TEST(ServiceWorkerRequestTest, ToWebRequestStripsURLFragment) { |
| 108 V8TestingScope scope; | 108 V8TestingScope scope; |
| 109 TrackExceptionState exceptionState; | 109 TrackExceptionState exceptionState; |
| 110 String urlWithoutFragment = "http://www.example.com/"; | 110 String urlWithoutFragment = "http://www.example.com/"; |
| 111 String url = urlWithoutFragment + "#fragment"; | 111 String url = urlWithoutFragment + "#fragment"; |
| 112 Request* request = | 112 Request* request = |
| 113 Request::create(scope.getScriptState(), url, exceptionState); | 113 Request::create(scope.getScriptState(), url, exceptionState); |
| 114 ASSERT(request); | 114 ASSERT(request); |
| 115 | 115 |
| 116 WebServiceWorkerRequest webRequest; | 116 WebServiceWorkerRequest webRequest; |
| 117 request->populateWebServiceWorkerRequest(webRequest); | 117 request->populateWebServiceWorkerRequest(webRequest); |
| 118 EXPECT_EQ(urlWithoutFragment, KURL(webRequest.url())); | 118 EXPECT_EQ(urlWithoutFragment, KURL(webRequest.url())); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |