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

Unified Diff: content/test/weburl_loader_mock_factory.cc

Issue 1686263008: Add utility method for WebString to base::FilePath conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase! Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/test/weburl_loader_mock_factory.cc
diff --git a/content/test/weburl_loader_mock_factory.cc b/content/test/weburl_loader_mock_factory.cc
index 112c44230c9fd18ada50e38994ec66679568090f..6e0f02b3422ba5f9bd615d160fca81a456e1fa5b 100644
--- a/content/test/weburl_loader_mock_factory.cc
+++ b/content/test/weburl_loader_mock_factory.cc
@@ -11,6 +11,7 @@
#include "base/run_loop.h"
#include "build/build_config.h"
#include "content/test/weburl_loader_mock.h"
+#include "third_party/WebKit/public/platform/FilePathConversion.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
@@ -36,15 +37,7 @@ void WebURLLoaderMockFactory::RegisterURL(const WebURL& url,
ResponseInfo response_info;
response_info.response = response;
if (!file_path.isNull() && !file_path.isEmpty()) {
-#if defined(OS_POSIX)
- // TODO(jcivelli): On Linux, UTF8 might not be correct.
- response_info.file_path =
- base::FilePath(static_cast<std::string>(file_path.utf8()));
-#elif defined(OS_WIN)
- base::string16 file_path_16 = file_path;
- response_info.file_path = base::FilePath(std::wstring(
- file_path_16.data(), file_path_16.length()));
-#endif
+ response_info.file_path = blink::WebStringToFilePath(file_path);
DCHECK(base::PathExists(response_info.file_path))
<< response_info.file_path.MaybeAsASCII() << " does not exist.";
}
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.cc ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698