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

Side by Side Diff: webkit/support/weburl_loader_mock_factory.cc

Issue 6250088: Cleanup everything but net/ for our first clang plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/support/weburl_loader_mock_factory.h" 5 #include "webkit/support/weburl_loader_mock_factory.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h"
13 #include "webkit/support/weburl_loader_mock.h" 13 #include "webkit/support/weburl_loader_mock.h"
14 14
15 using WebKit::WebData; 15 using WebKit::WebData;
16 using WebKit::WebString; 16 using WebKit::WebString;
17 using WebKit::WebURL; 17 using WebKit::WebURL;
18 using WebKit::WebURLError; 18 using WebKit::WebURLError;
19 using WebKit::WebURLLoader; 19 using WebKit::WebURLLoader;
20 using WebKit::WebURLRequest; 20 using WebKit::WebURLRequest;
21 using WebKit::WebURLResponse; 21 using WebKit::WebURLResponse;
22 22
23 struct WebURLLoaderMockFactory::ResponseInfo {
24 WebKit::WebURLResponse response;
25 FilePath file_path;
26 };
27
28 WebURLLoaderMockFactory::WebURLLoaderMockFactory() {}
29
30 WebURLLoaderMockFactory::~WebURLLoaderMockFactory() {}
31
23 void WebURLLoaderMockFactory::RegisterURL(const WebURL& url, 32 void WebURLLoaderMockFactory::RegisterURL(const WebURL& url,
24 const WebURLResponse& response, 33 const WebURLResponse& response,
25 const WebString& file_path) { 34 const WebString& file_path) {
26 ResponseInfo response_info; 35 ResponseInfo response_info;
27 response_info.response = response; 36 response_info.response = response;
28 if (!file_path.isNull() && !file_path.isEmpty()) { 37 if (!file_path.isNull() && !file_path.isEmpty()) {
29 #if defined(OS_POSIX) 38 #if defined(OS_POSIX)
30 // TODO(jcivelli): On Linux, UTF8 might not be correct. 39 // TODO(jcivelli): On Linux, UTF8 might not be correct.
31 response_info.file_path = 40 response_info.file_path =
32 FilePath(static_cast<std::string>(file_path.utf8())); 41 FilePath(static_cast<std::string>(file_path.utf8()));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 scoped_array<char> buffer(new char[size]); 137 scoped_array<char> buffer(new char[size]);
129 data->reset(); 138 data->reset();
130 int read_count = file_util::ReadFile(file_path, buffer.get(), size); 139 int read_count = file_util::ReadFile(file_path, buffer.get(), size);
131 if (read_count == -1) 140 if (read_count == -1)
132 return false; 141 return false;
133 DCHECK(read_count == size); 142 DCHECK(read_count == size);
134 data->assign(buffer.get(), size); 143 data->assign(buffer.get(), size);
135 144
136 return true; 145 return true;
137 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698