Index: third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp |
index 4187ec2b13329c4a4c097daf0d82170c6288bc21..e504997a7fc9aa080b5763e2d2512cbfc5c827db 100644 |
--- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp |
@@ -9,6 +9,7 @@ |
#include "platform/graphics/ImageBuffer.h" |
#include "platform/graphics/ImageBufferClient.h" |
#include "platform/graphics/UnacceleratedImageBufferSurface.h" |
+#include "platform/testing/TestingPlatformSupport.h" |
#include "public/platform/Platform.h" |
#include "public/platform/WebTaskRunner.h" |
#include "public/platform/WebThread.h" |
@@ -236,24 +237,13 @@ namespace { |
// for the current thread. The Mock thread is capable of queuing a single non-delayed task |
// and registering a single task observer. The run loop exits immediately after running |
// the single task. |
-class AutoInstallCurrentThreadPlatformMock { |
-public: |
- AutoInstallCurrentThreadPlatformMock() |
- { |
- m_oldPlatform = Platform::current(); |
- Platform::initialize(&m_mockPlatform); |
- } |
- |
- ~AutoInstallCurrentThreadPlatformMock() |
- { |
- Platform::initialize(m_oldPlatform); |
- } |
- void enterRunLoop() |
- { |
- m_mockPlatform.enterRunLoop(); |
- } |
+class CurrentThreadPlatformMock : public TestingPlatformSupport { |
+public: |
+ CurrentThreadPlatformMock() { } |
+ WebThread* currentThread() override { return &m_currentThread; } |
+ void enterRunLoop() { m_currentThread.enterRunLoop(); } |
private: |
class MockWebTaskRunner : public WebTaskRunner { |
public: |
@@ -335,22 +325,7 @@ private: |
TaskObserver* m_taskObserver; |
}; |
- class CurrentThreadPlatformMock : public Platform { |
- public: |
- CurrentThreadPlatformMock() { } |
- virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
- { |
- RELEASE_ASSERT_NOT_REACHED(); |
- } |
- WebThread* currentThread() override { return &m_currentThread; } |
- |
- void enterRunLoop() { m_currentThread.enterRunLoop(); } |
- private: |
- CurrentThreadMock m_currentThread; |
- }; |
- |
- CurrentThreadPlatformMock m_mockPlatform; |
- Platform* m_oldPlatform; |
+ CurrentThreadMock m_currentThread; |
}; |
} // anonymous namespace |
@@ -366,7 +341,7 @@ class TestWrapperTask_ ## TEST_METHOD : public WebTaskRunner::Task { |
#define CALL_TEST_TASK_WRAPPER(TEST_METHOD) \ |
{ \ |
- AutoInstallCurrentThreadPlatformMock ctpm; \ |
+ CurrentThreadPlatformMock ctpm; \ |
Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE, new TestWrapperTask_ ## TEST_METHOD(this)); \ |
ctpm.enterRunLoop(); \ |
} |