| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/testing/weburl_loader_mock.h" | 5 #include "platform/testing/weburl_loader_mock.h" |
| 6 | 6 |
| 7 #include "platform/testing/weburl_loader_mock_factory_impl.h" | 7 #include "platform/testing/weburl_loader_mock_factory_impl.h" |
| 8 #include "public/platform/URLConversion.h" | 8 #include "public/platform/URLConversion.h" |
| 9 #include "public/platform/WebData.h" | 9 #include "public/platform/WebData.h" |
| 10 #include "public/platform/WebURLError.h" | 10 #include "public/platform/WebURLError.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 newRequest.setFrameType(request.getFrameType()); | 75 newRequest.setFrameType(request.getFrameType()); |
| 76 newRequest.setSkipServiceWorker(request.skipServiceWorker()); | 76 newRequest.setSkipServiceWorker(request.skipServiceWorker()); |
| 77 newRequest.setShouldResetAppCache(request.shouldResetAppCache()); | 77 newRequest.setShouldResetAppCache(request.shouldResetAppCache()); |
| 78 newRequest.setFetchRequestMode(request.getFetchRequestMode()); | 78 newRequest.setFetchRequestMode(request.getFetchRequestMode()); |
| 79 newRequest.setFetchCredentialsMode(request.getFetchCredentialsMode()); | 79 newRequest.setFetchCredentialsMode(request.getFetchCredentialsMode()); |
| 80 newRequest.setHTTPMethod(request.httpMethod()); | 80 newRequest.setHTTPMethod(request.httpMethod()); |
| 81 newRequest.setHTTPBody(request.httpBody()); | 81 newRequest.setHTTPBody(request.httpBody()); |
| 82 | 82 |
| 83 WeakPtr<WebURLLoaderMock> self = weak_factory_.createWeakPtr(); | 83 WeakPtr<WebURLLoaderMock> self = weak_factory_.createWeakPtr(); |
| 84 | 84 |
| 85 client_->willFollowRedirect(this, newRequest, redirectResponse, | 85 client_->willFollowRedirect(this, newRequest, redirectResponse); |
| 86 kRedirectResponseOverheadBytes); | |
| 87 | 86 |
| 88 // |this| might be deleted in willFollowRedirect(). | 87 // |this| might be deleted in willFollowRedirect(). |
| 89 if (!self) | 88 if (!self) |
| 90 return newRequest; | 89 return newRequest; |
| 91 | 90 |
| 92 if (redirectURL != KURL(newRequest.url())) { | 91 if (redirectURL != KURL(newRequest.url())) { |
| 93 // Only follow the redirect if WebKit left the URL unmodified. | 92 // Only follow the redirect if WebKit left the URL unmodified. |
| 94 // We assume that WebKit only changes the URL to suppress a redirect, and we | 93 // We assume that WebKit only changes the URL to suppress a redirect, and we |
| 95 // assume that it does so by setting it to be invalid. | 94 // assume that it does so by setting it to be invalid. |
| 96 DCHECK(!newRequest.url().isValid()); | 95 DCHECK(!newRequest.url().isValid()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods | 160 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods |
| 162 // the console during webkit unit tests, so we leave the function empty. | 161 // the console during webkit unit tests, so we leave the function empty. |
| 163 DCHECK(runner); | 162 DCHECK(runner); |
| 164 } | 163 } |
| 165 | 164 |
| 166 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() { | 165 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() { |
| 167 return weak_factory_.createWeakPtr(); | 166 return weak_factory_.createWeakPtr(); |
| 168 } | 167 } |
| 169 | 168 |
| 170 } // namespace blink | 169 } // namespace blink |
| OLD | NEW |