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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « webkit/support/webkit_support.cc ('k') | win8/delegate_execute/chrome_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/platform/WebString.h" 9 #include "third_party/WebKit/public/platform/WebString.h"
10 #include "third_party/WebKit/public/platform/WebURLError.h" 10 #include "third_party/WebKit/public/platform/WebURLError.h"
(...skipping 29 matching lines...) Expand all
40 if (!file_path.isNull() && !file_path.isEmpty()) { 40 if (!file_path.isNull() && !file_path.isEmpty()) {
41 #if defined(OS_POSIX) 41 #if defined(OS_POSIX)
42 // TODO(jcivelli): On Linux, UTF8 might not be correct. 42 // TODO(jcivelli): On Linux, UTF8 might not be correct.
43 response_info.file_path = 43 response_info.file_path =
44 base::FilePath(static_cast<std::string>(file_path.utf8())); 44 base::FilePath(static_cast<std::string>(file_path.utf8()));
45 #elif defined(OS_WIN) 45 #elif defined(OS_WIN)
46 string16 file_path_16 = file_path; 46 string16 file_path_16 = file_path;
47 response_info.file_path = base::FilePath(std::wstring( 47 response_info.file_path = base::FilePath(std::wstring(
48 file_path_16.data(), file_path_16.length())); 48 file_path_16.data(), file_path_16.length()));
49 #endif 49 #endif
50 DCHECK(file_util::PathExists(response_info.file_path)) 50 DCHECK(base::PathExists(response_info.file_path))
51 << response_info.file_path.MaybeAsASCII() << " does not exist."; 51 << response_info.file_path.MaybeAsASCII() << " does not exist.";
52 } 52 }
53 53
54 DCHECK(url_to_reponse_info_.find(url) == url_to_reponse_info_.end()); 54 DCHECK(url_to_reponse_info_.find(url) == url_to_reponse_info_.end());
55 url_to_reponse_info_[url] = response_info; 55 url_to_reponse_info_[url] = response_info;
56 } 56 }
57 57
58 58
59 void WebURLLoaderMockFactory::RegisterErrorURL(const WebURL& url, 59 void WebURLLoaderMockFactory::RegisterErrorURL(const WebURL& url,
60 const WebURLResponse& response, 60 const WebURLResponse& response,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 scoped_ptr<char[]> buffer(new char[size]); 187 scoped_ptr<char[]> buffer(new char[size]);
188 data->reset(); 188 data->reset();
189 int read_count = file_util::ReadFile(file_path, buffer.get(), size); 189 int read_count = file_util::ReadFile(file_path, buffer.get(), size);
190 if (read_count == -1) 190 if (read_count == -1)
191 return false; 191 return false;
192 DCHECK(read_count == size); 192 DCHECK(read_count == size);
193 data->assign(buffer.get(), size); 193 data->assign(buffer.get(), size);
194 194
195 return true; 195 return true;
196 } 196 }
OLDNEW
« no previous file with comments | « webkit/support/webkit_support.cc ('k') | win8/delegate_execute/chrome_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698