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

Unified Diff: third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp

Issue 1686263008: Add utility method for WebString to base::FilePath conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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: third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp
diff --git a/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp b/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp
index 6dc019faf1f46d191d072bd906a786711cf86051..c192ed121b74581d52f2d2f2b1df9cd576251c56 100644
--- a/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp
+++ b/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp
@@ -30,7 +30,9 @@
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "platform/SharedBuffer.h"
+#include "public/platform/FilePathConversion.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebString.h"
#include "public/platform/WebTaskRunner.h"
#include "public/platform/WebThread.h"
#include "public/platform/WebTraceLocation.h"
@@ -65,11 +67,9 @@ String blinkRootDir()
PassRefPtr<SharedBuffer> readFromFile(const String& path)
{
- StringUTF8Adaptor utf8(path);
- base::FilePath file_path = base::FilePath::FromUTF8Unsafe(
- std::string(utf8.data(), utf8.length()));
+ base::FilePath filePath = blink::WebStringToFilePath(path);
std::string buffer;
- base::ReadFileToString(file_path, &buffer);
+ base::ReadFileToString(filePath, &buffer);
return SharedBuffer::create(buffer.data(), buffer.size());
}

Powered by Google App Engine
This is Rietveld 408576698