Chromium Code Reviews| Index: Source/platform/TestingPlatformSupport.cpp |
| diff --git a/Source/platform/TestingPlatformSupport.cpp b/Source/platform/TestingPlatformSupport.cpp |
| index 366766bd7aed8a1e9b88dcceea1155fb503c4f4c..14da1c2d66497daeb05693cf3684d83cc91aa8b3 100644 |
| --- a/Source/platform/TestingPlatformSupport.cpp |
| +++ b/Source/platform/TestingPlatformSupport.cpp |
| @@ -32,6 +32,11 @@ |
| #include "platform/TestingPlatformSupport.h" |
| +#include <base/file_util.h> |
|
jamesr
2014/06/06 18:56:04
<> style includes should only be used for standard
|
| +#include <base/files/file_path.h> |
| +#include <base/path_service.h> |
| +#include <string> |
| + |
| namespace WebCore { |
| TestingDiscardableMemory::TestingDiscardableMemory(size_t size) : m_data(size), m_isLocked(true) |
| @@ -90,4 +95,31 @@ const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const c |
| return &tracingIsDisabled; |
| } |
| +blink::WebUnitTestSupport* TestingPlatformSupport::unitTestSupport() |
| +{ |
| + return this; |
| +} |
| + |
| +blink::WebString TestingPlatformSupport::webKitRootDir() |
| +{ |
| + base::FilePath path; |
| + PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| + path = path.Append(FILE_PATH_LITERAL("third_party/WebKit")); |
| + path = base::MakeAbsoluteFilePath(path); |
| + ASSERT(!path.empty()); |
| + std::string pathAscii = path.MaybeAsASCII(); |
| + ASSERT(!pathAscii.empty()); |
| + return blink::WebString::fromUTF8(pathAscii.c_str()); |
| +} |
| + |
| +blink::WebData TestingPlatformSupport::readFromFile(const blink::WebString& path) |
| +{ |
| + base::FilePath filePath = base::FilePath::FromUTF8Unsafe(path.utf8()); |
| + |
| + std::string buffer; |
| + base::ReadFileToString(filePath, &buffer); |
| + |
| + return blink::WebData(buffer.data(), buffer.size()); |
| +} |
| + |
| } // namespace WebCore |