| Index: Source/core/fetch/CachingCorrectnessTest.cpp
|
| diff --git a/Source/core/fetch/CachingCorrectnessTest.cpp b/Source/core/fetch/CachingCorrectnessTest.cpp
|
| index b729004a7782da1ba3c50864f2a29f05119eb7d0..55793eb383c42d683054373f0c9ffdd1289c704f 100644
|
| --- a/Source/core/fetch/CachingCorrectnessTest.cpp
|
| +++ b/Source/core/fetch/CachingCorrectnessTest.cpp
|
| @@ -124,13 +124,30 @@ 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_elapsedSeconds(0.)
|
| + , m_platform(Platform::current())
|
| + {
|
| + }
|
| +
|
| + ~ProxyPlatform()
|
| + {
|
| + blink::Platform::initialize(m_platform);
|
| + }
|
|
|
| void advanceClock(double seconds)
|
| {
|
| m_elapsedSeconds += seconds;
|
| }
|
|
|
| + virtual WebThread* currentThread() override
|
| + {
|
| + if (m_platform)
|
| + return m_platform->currentThread();
|
| +
|
| + return nullptr;
|
| + }
|
| +
|
| private:
|
| // From blink::Platform:
|
| virtual double currentTime()
|
| @@ -146,11 +163,12 @@ private:
|
| }
|
|
|
| double m_elapsedSeconds;
|
| +
|
| + Platform* m_platform;
|
| };
|
|
|
| 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 +183,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;
|
|
|