| 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 #ifndef WebURLLoaderMock_h | 5 #ifndef WebURLLoaderMock_h |
| 6 #define WebURLLoaderMock_h | 6 #define WebURLLoaderMock_h |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "public/platform/WebURLLoader.h" | 9 #include "public/platform/WebURLLoader.h" |
| 10 #include "wtf/WeakPtr.h" | 10 #include "wtf/WeakPtr.h" |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class WebData; | 15 class WebData; |
| 16 struct WebURLError; | 16 struct WebURLError; |
| 17 class WebURLLoaderClient; | 17 class WebURLLoaderClient; |
| 18 class WebURLLoaderMockFactoryImpl; | 18 class WebURLLoaderMockFactoryImpl; |
| 19 class WebURLLoaderTestDelegate; | 19 class WebURLLoaderTestDelegate; |
| 20 class WebURLRequest; | 20 class WebURLRequest; |
| 21 class WebURLResponse; | 21 class WebURLResponse; |
| 22 | 22 |
| 23 const int kRedirectResponseOverheadBytes = 300; |
| 24 |
| 23 // A simple class for mocking WebURLLoader. | 25 // A simple class for mocking WebURLLoader. |
| 24 // If the WebURLLoaderMockFactory it is associated with has been configured to | 26 // If the WebURLLoaderMockFactory it is associated with has been configured to |
| 25 // mock the request it gets, it serves the mocked resource. Otherwise it just | 27 // mock the request it gets, it serves the mocked resource. Otherwise it just |
| 26 // forwards it to the default loader. | 28 // forwards it to the default loader. |
| 27 class WebURLLoaderMock : public WebURLLoader { | 29 class WebURLLoaderMock : public WebURLLoader { |
| 28 public: | 30 public: |
| 29 // This object becomes the owner of |default_loader|. | 31 // This object becomes the owner of |default_loader|. |
| 30 WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, | 32 WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory, |
| 31 WebURLLoader* default_loader); | 33 WebURLLoader* default_loader); |
| 32 ~WebURLLoaderMock() override; | 34 ~WebURLLoaderMock() override; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 bool is_deferred_ = false; | 68 bool is_deferred_ = false; |
| 67 | 69 |
| 68 WeakPtrFactory<WebURLLoaderMock> weak_factory_; | 70 WeakPtrFactory<WebURLLoaderMock> weak_factory_; |
| 69 | 71 |
| 70 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock); | 72 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock); |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 } // namespace blink | 75 } // namespace blink |
| 74 | 76 |
| 75 #endif // WebURLLoaderMock_h | 77 #endif // WebURLLoaderMock_h |
| OLD | NEW |