Chromium Code Reviews| Index: third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp |
| diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp |
| index 0497600ee4c8e2c347f4b2f58c961af59027c670..cc6c416d1121715f7b2908ad60be033780c196ae 100644 |
| --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp |
| +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp |
| @@ -40,11 +40,13 @@ |
| #include "cc/test/ordered_simple_task_runner.h" |
| #include "platform/HTTPNames.h" |
| #include "platform/heap/Heap.h" |
| +#include "platform/network/mime/MockMimeRegistry.h" |
| #include "platform/scheduler/base/real_time_domain.h" |
| #include "platform/scheduler/base/task_queue_manager.h" |
| #include "platform/scheduler/base/test_time_source.h" |
| #include "platform/scheduler/child/scheduler_tqm_delegate_for_test.h" |
| #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| +#include "public/platform/InterfaceProvider.h" |
| #include "public/platform/WebContentLayer.h" |
| #include "public/platform/WebExternalTextureLayer.h" |
| #include "public/platform/WebImageLayer.h" |
| @@ -58,6 +60,25 @@ |
| namespace blink { |
| +class TestingPlatformSupport::TestingInterfaceProvider |
| + : public blink::InterfaceProvider { |
| + public: |
| + TestingInterfaceProvider() = default; |
| + virtual ~TestingInterfaceProvider() = default; |
| + |
| + void getInterface(const char* name, |
| + mojo::ScopedMessagePipeHandle handle) override { |
| + if (std::string(name) == mojom::blink::MimeRegistry::Name_) { |
| + m_mockMimeRegistry = wrapUnique(new MockMimeRegistry( |
| + mojo::MakeRequest<mojom::blink::MimeRegistry>(std::move(handle)))); |
|
Reilly Grant (use Gerrit)
2016/10/28 01:12:41
Instead of saving the MockMimeRegistry here, which
kinuko
2016/10/28 01:18:46
Cool, done.
|
| + return; |
| + } |
| + } |
| + |
| + private: |
| + std::unique_ptr<MockMimeRegistry> m_mockMimeRegistry; |
| +}; |
| + |
| namespace { |
| double dummyCurrentTime() { |
| @@ -115,7 +136,9 @@ TestingPlatformSupport::TestingPlatformSupport() |
| : TestingPlatformSupport(TestingPlatformSupport::Config()) {} |
| TestingPlatformSupport::TestingPlatformSupport(const Config& config) |
| - : m_config(config), m_oldPlatform(Platform::current()) { |
| + : m_config(config), |
| + m_oldPlatform(Platform::current()), |
| + m_interfaceProvider(wrapUnique(new TestingInterfaceProvider)) { |
| ASSERT(m_oldPlatform); |
| Platform::setCurrentPlatformForTesting(this); |
| } |
| @@ -155,10 +178,6 @@ WebIDBFactory* TestingPlatformSupport::idbFactory() { |
| return m_oldPlatform ? m_oldPlatform->idbFactory() : nullptr; |
| } |
| -WebMimeRegistry* TestingPlatformSupport::mimeRegistry() { |
| - return m_oldPlatform ? m_oldPlatform->mimeRegistry() : nullptr; |
| -} |
| - |
| WebURLLoaderMockFactory* TestingPlatformSupport::getURLLoaderMockFactory() { |
| return m_oldPlatform ? m_oldPlatform->getURLLoaderMockFactory() : nullptr; |
| } |
| @@ -175,6 +194,10 @@ WebURLError TestingPlatformSupport::cancelledError(const WebURL& url) const { |
| return m_oldPlatform ? m_oldPlatform->cancelledError(url) : WebURLError(); |
| } |
| +InterfaceProvider* TestingPlatformSupport::interfaceProvider() { |
| + return m_interfaceProvider.get(); |
| +} |
| + |
| // TestingPlatformSupportWithMockScheduler definition: |
| TestingPlatformSupportWithMockScheduler:: |