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

Unified Diff: Source/platform/TestingPlatformSupport.cpp

Issue 316343004: Add unittest for OpenTypeSanitizer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: PLATFORM_EXPORT for tests Created 6 years, 6 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
« no previous file with comments | « Source/platform/TestingPlatformSupport.h ('k') | Source/platform/blink_platform.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/platform/TestingPlatformSupport.h ('k') | Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698