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

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

Issue 1456873003: More regular Platform implementations in unit tests (reland.) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: have GN disable c4267 also 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 99066f618a665af6d8d23ad7c97930894bb9380b..ac0c261fbb48894626035f47e8c8baa1383eddec 100644
--- a/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -38,6 +38,7 @@
#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,8 +56,6 @@ const double kOriginalRequestDateAsDouble = 233433000.;
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:
static MockFetchContext* create()
@@ -120,25 +119,15 @@ protected:
private:
// A simple platform that mocks out the clock, for cache freshness testing.
- class ProxyPlatform : public blink::Platform {
+ class ProxyPlatform : public TestingPlatformSupport {
public:
- ProxyPlatform() : m_platform(blink::Platform::current()), m_elapsedSeconds(0.) { }
-
- ~ProxyPlatform()
- {
- blink::Platform::initialize(m_platform);
- }
+ ProxyPlatform() : m_elapsedSeconds(0.) { }
void advanceClock(double seconds)
{
m_elapsedSeconds += seconds;
}
- WebThread* currentThread() override
- {
- return m_platform->currentThread();
- }
-
private:
// From blink::Platform:
double currentTimeSeconds() override
@@ -146,24 +135,11 @@ private:
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