Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: third_party/WebKit/Source/platform/testing/WebURLLoaderMockFactoryImpl.cpp

Issue 2657793002: Make WebURLLoaderMockFactoryImpl::createURLLoader accept nullptr (Closed)
Patch Set: base change Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/WebURLLoaderMockFactoryImpl.h" 5 #include "platform/testing/WebURLLoaderMockFactoryImpl.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "platform/testing/TestingPlatformSupport.h" 9 #include "platform/testing/TestingPlatformSupport.h"
10 #include "platform/testing/UnitTestHelpers.h" 10 #include "platform/testing/UnitTestHelpers.h"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 WebURLLoaderMockFactoryImpl::WebURLLoaderMockFactoryImpl( 27 WebURLLoaderMockFactoryImpl::WebURLLoaderMockFactoryImpl(
28 TestingPlatformSupport* platform) 28 TestingPlatformSupport* platform)
29 : m_platform(platform) {} 29 : m_platform(platform) {}
30 30
31 WebURLLoaderMockFactoryImpl::~WebURLLoaderMockFactoryImpl() {} 31 WebURLLoaderMockFactoryImpl::~WebURLLoaderMockFactoryImpl() {}
32 32
33 WebURLLoader* WebURLLoaderMockFactoryImpl::createURLLoader( 33 WebURLLoader* WebURLLoaderMockFactoryImpl::createURLLoader(
34 WebURLLoader* defaultLoader) { 34 WebURLLoader* defaultLoader) {
35 DCHECK(defaultLoader);
36 return new WebURLLoaderMock(this, defaultLoader); 35 return new WebURLLoaderMock(this, defaultLoader);
37 } 36 }
38 37
39 void WebURLLoaderMockFactoryImpl::registerURL(const WebURL& url, 38 void WebURLLoaderMockFactoryImpl::registerURL(const WebURL& url,
40 const WebURLResponse& response, 39 const WebURLResponse& response,
41 const WebString& filePath) { 40 const WebString& filePath) {
42 ResponseInfo responseInfo; 41 ResponseInfo responseInfo;
43 responseInfo.response = response; 42 responseInfo.response = response;
44 if (!filePath.isNull() && !filePath.isEmpty()) { 43 if (!filePath.isNull() && !filePath.isEmpty()) {
45 responseInfo.filePath = blink::WebStringToFilePath(filePath); 44 responseInfo.filePath = blink::WebStringToFilePath(filePath);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 172
174 std::string buffer; 173 std::string buffer;
175 if (!base::ReadFileToString(filePath, &buffer)) 174 if (!base::ReadFileToString(filePath, &buffer))
176 return false; 175 return false;
177 176
178 data->assign(buffer.data(), buffer.size()); 177 data->assign(buffer.data(), buffer.size());
179 return true; 178 return true;
180 } 179 }
181 180
182 } // namespace blink 181 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698