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

Unified Diff: third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp

Issue 1464953003: Revert of More regular Platform implementations in unit tests (reland.) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/core/fetch/CachingCorrectnessTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
index ac0c261fbb48894626035f47e8c8baa1383eddec..99066f618a665af6d8d23ad7c97930894bb9380b 100644
--- a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -38,7 +38,6 @@
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourcePtr.h"
#include "platform/network/ResourceRequest.h"
-#include "platform/testing/TestingPlatformSupport.h"
#include "public/platform/Platform.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "wtf/OwnPtr.h"
@@ -55,6 +54,8 @@
const char kOneDayBeforeOriginalRequest[] = "Wed, 24 May 1977 18:30:00 GMT";
const char kOneDayAfterOriginalRequest[] = "Fri, 26 May 1977 18:30:00 GMT";
+
+const unsigned char kAConstUnsignedCharZero = 0;
class MockFetchContext : public FetchContext {
public:
@@ -119,13 +120,23 @@
private:
// A simple platform that mocks out the clock, for cache freshness testing.
- class ProxyPlatform : public TestingPlatformSupport {
+ class ProxyPlatform : public blink::Platform {
public:
- ProxyPlatform() : m_elapsedSeconds(0.) { }
+ ProxyPlatform() : m_platform(blink::Platform::current()), m_elapsedSeconds(0.) { }
+
+ ~ProxyPlatform()
+ {
+ blink::Platform::initialize(m_platform);
+ }
void advanceClock(double seconds)
{
m_elapsedSeconds += seconds;
+ }
+
+ WebThread* currentThread() override
+ {
+ return m_platform->currentThread();
}
private:
@@ -135,11 +146,24 @@
return kOriginalRequestDateAsDouble + m_elapsedSeconds;
}
+ // These blink::Platform methods must be overriden to make a usable object.
+ virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length)
+ {
+ RELEASE_ASSERT_NOT_REACHED();
+ }
+ virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName)
+ {
+ return &kAConstUnsignedCharZero;
+ }
+
+ blink::Platform* m_platform; // Not owned.
double m_elapsedSeconds;
};
virtual void SetUp()
{
+ blink::Platform::initialize(&m_proxyPlatform);
+
// Save the global memory cache to restore it upon teardown.
m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create());
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp ('k') | third_party/WebKit/Source/core/fetch/ResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698