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

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

Issue 1052103004: Make test proxy Platform objects provide currentThread(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Code formatting only Created 5 years, 7 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/core/animation/CompositorAnimationsTestHelper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/CachingCorrectnessTest.cpp
diff --git a/Source/core/fetch/CachingCorrectnessTest.cpp b/Source/core/fetch/CachingCorrectnessTest.cpp
index b729004a7782da1ba3c50864f2a29f05119eb7d0..9071c165b1612dd6803c62bd7497d8c70b98d990 100644
--- a/Source/core/fetch/CachingCorrectnessTest.cpp
+++ b/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -124,13 +124,23 @@ private:
// A simple platform that mocks out the clock, for cache freshness testing.
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:
// From blink::Platform:
virtual double currentTime()
@@ -145,12 +155,12 @@ private:
return &kAConstUnsignedCharZero;
}
+ blink::Platform* m_platform; // Not owned.
double m_elapsedSeconds;
};
virtual void SetUp()
{
- m_savedPlatform = blink::Platform::current();
blink::Platform::initialize(&m_proxyPlatform);
// Save the global memory cache to restore it upon teardown.
@@ -165,11 +175,8 @@ private:
// Yield the ownership of the global memory cache back.
replaceMemoryCacheForTesting(m_globalMemoryCache.release());
-
- blink::Platform::initialize(m_savedPlatform);
}
- blink::Platform* m_savedPlatform;
ProxyPlatform m_proxyPlatform;
OwnPtrWillBePersistent<MemoryCache> m_globalMemoryCache;
« no previous file with comments | « Source/core/animation/CompositorAnimationsTestHelper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698