diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-12 13:13:00 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-12 13:13:00 +0000 |
commit | 7512416413ac8d59daa0b039fe5a42b20b3c8271 (patch) | |
tree | 971327f69842a58476edb42b8c7f895e9b032c80 /webkit | |
parent | 8b06946efbc2231e9f7df7e914c84c8353e8563f (diff) | |
download | chromium_src-7512416413ac8d59daa0b039fe5a42b20b3c8271.zip chromium_src-7512416413ac8d59daa0b039fe5a42b20b3c8271.tar.gz chromium_src-7512416413ac8d59daa0b039fe5a42b20b3c8271.tar.bz2 |
Implement UnitTestSupport::readFromFile
This allows us to remove all PlatformFileHandle related code
in Blink core.
(Blink side patch: https://codereview.chromium.org/22645008/)
BUG=267341
Review URL: https://chromiumcodereview.appspot.com/22738002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/support/test_webkit_platform_support.cc | 10 | ||||
-rw-r--r-- | webkit/support/test_webkit_platform_support.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index 5156568..19d208a 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/metrics/stats_counters.h" #include "base/path_service.h" @@ -344,3 +345,12 @@ WebKit::WebLayerTreeView* return createLayerTreeViewForTesting(); } +WebKit::WebData TestWebKitPlatformSupport::readFromFile( + const WebKit::WebString& path) { + base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); + + std::string buffer; + file_util::ReadFileToString(file_path, &buffer); + + return WebKit::WebData(buffer.data(), buffer.size()); +} diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h index 3939a59..7b3ee85 100644 --- a/webkit/support/test_webkit_platform_support.h +++ b/webkit/support/test_webkit_platform_support.h @@ -106,6 +106,7 @@ class TestWebKitPlatformSupport : virtual WebKit::WebLayerTreeView* createLayerTreeViewForTesting(); virtual WebKit::WebLayerTreeView* createLayerTreeViewForTesting( TestViewType type); + virtual WebKit::WebData readFromFile(const WebKit::WebString& path); private: webkit_glue::SimpleWebMimeRegistryImpl mime_registry_; |