| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "platform/testing/ScopedMockedURL.h" |
| 6 |
| 7 #include "platform/testing/URLTestHelpers.h" |
| 8 #include "public/platform/Platform.h" |
| 9 #include "public/platform/WebURLLoaderMockFactory.h" |
| 10 |
| 11 namespace blink { |
| 12 namespace testing { |
| 13 |
| 14 ScopedMockedURL::ScopedMockedURL(const WebURL& url) : m_url(url) {} |
| 15 |
| 16 ScopedMockedURL::~ScopedMockedURL() { |
| 17 Platform::current()->getURLLoaderMockFactory()->unregisterURL(m_url); |
| 18 } |
| 19 |
| 20 ScopedMockedURLLoadFromBase::ScopedMockedURLLoadFromBase( |
| 21 const WebString& baseURL, |
| 22 const WebString& basePath, |
| 23 const WebString& fileName, |
| 24 const WebString& mimeType) |
| 25 : ScopedMockedURL(URLTestHelpers::registerMockedURLLoadFromBase(baseURL, |
| 26 basePath, |
| 27 fileName, |
| 28 mimeType)) { |
| 29 } |
| 30 |
| 31 ScopedMockedURLLoad::ScopedMockedURLLoad(const WebURL& fullURL, |
| 32 const WebString& filePath, |
| 33 const WebString& mimeType) |
| 34 : ScopedMockedURL(fullURL) { |
| 35 URLTestHelpers::registerMockedURLLoad(fullURL, filePath, mimeType); |
| 36 } |
| 37 |
| 38 ScopedMockedURLLoadWithCustomResponse::ScopedMockedURLLoadWithCustomResponse( |
| 39 const WebURL& fullURL, |
| 40 const WebString& filePath, |
| 41 WebURLResponse response) |
| 42 : ScopedMockedURL(fullURL) { |
| 43 URLTestHelpers::registerMockedURLLoadWithCustomResponse(fullURL, filePath, |
| 44 response); |
| 45 } |
| 46 |
| 47 ScopedMockedErrorURLLoad::ScopedMockedErrorURLLoad(const WebURL& fullURL) |
| 48 : ScopedMockedURL(fullURL) { |
| 49 URLTestHelpers::registerMockedErrorURLLoad(fullURL); |
| 50 } |
| 51 |
| 52 } // namespace testing |
| 53 } // namespace blink |
| OLD | NEW |