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..da50edad79e104202d2608ac3bb9fb0b84bebd00 100644 |
--- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp |
+++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp |
@@ -38,13 +38,16 @@ |
#include "base/test/test_discardable_memory_allocator.h" |
#include "cc/blink/web_compositor_support_impl.h" |
#include "cc/test/ordered_simple_task_runner.h" |
+#include "mojo/public/cpp/bindings/strong_binding.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 +61,23 @@ |
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_) { |
+ mojo::MakeStrongBinding( |
+ wrapUnique(new MockMimeRegistry()), |
+ mojo::MakeRequest<mojom::blink::MimeRegistry>(std::move(handle))); |
+ return; |
+ } |
+ } |
+}; |
+ |
namespace { |
double dummyCurrentTime() { |
@@ -115,7 +135,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(new TestingInterfaceProvider) { |
ASSERT(m_oldPlatform); |
Platform::setCurrentPlatformForTesting(this); |
} |
@@ -155,10 +177,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 +193,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:: |