Index: content/test/content_test_suite.cc |
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc |
index 42cb92b367dfc832108ee999c43187c4ed95194d..476caf5890f8b614f27c8b782275291375ea30db 100644 |
--- a/content/test/content_test_suite.cc |
+++ b/content/test/content_test_suite.cc |
@@ -25,7 +25,10 @@ |
#if defined(OS_MACOSX) |
#include "base/mac/scoped_nsautorelease_pool.h" |
#if !defined(OS_IOS) |
+#include "base/mac/scoped_mach_port.h" |
+#include "base/memory/linked_ptr.h" |
#include "base/test/mock_chrome_application_mac.h" |
+#include "content/common/mac/io_surface_manager.h" |
#endif |
#endif |
@@ -94,6 +97,32 @@ class SurfaceTextureManagerImpl : public SurfaceTextureManager { |
}; |
#endif |
+#if defined(OS_MACOSX) && !defined(OS_IOS) |
+class IOSurfaceManagerImpl : public IOSurfaceManager { |
Avi (use Gerrit)
2015/05/09 18:00:28
Is this a simplified test implementation? Can you
reveman
2015/05/09 19:24:23
Sure, let me just land a patch that changes Surfac
reveman
2015/05/10 18:45:08
Done.
|
+ public: |
+ // Overridden from IOSurfaceManager: |
+ bool RegisterIOSurface(int io_surface_id, |
+ int client_id, |
+ IOSurfaceRef io_surface) override { |
+ mach_ports_[io_surface_id] = |
+ make_linked_ptr(new base::mac::ScopedMachSendRight( |
+ IOSurfaceCreateMachPort(io_surface))); |
+ return true; |
+ } |
+ void UnregisterIOSurface(int io_surface_id, int client_id) override { |
+ mach_ports_.erase(io_surface_id); |
+ } |
+ IOSurfaceRef AcquireIOSurface(int io_surface_id) override { |
+ return IOSurfaceLookupFromMachPort(mach_ports_[io_surface_id]->get()); |
+ } |
+ |
+ private: |
+ typedef std::map<int, linked_ptr<base::mac::ScopedMachSendRight>> |
+ MachSendRightMap; |
+ MachSendRightMap mach_ports_; |
+}; |
+#endif |
+ |
} // namespace |
ContentTestSuite::ContentTestSuite(int argc, char** argv) |
@@ -137,6 +166,9 @@ void ContentTestSuite::Initialize() { |
#if defined(OS_ANDROID) |
SurfaceTextureManager::InitInstance(new SurfaceTextureManagerImpl); |
#endif |
+#if defined(OS_MACOSX) && !defined(OS_IOS) |
+ IOSurfaceManager::InitInstance(new IOSurfaceManagerImpl); |
Avi (use Gerrit)
2015/05/09 18:00:28
We're also calling InitInstance at the end of Cont
reveman
2015/05/09 19:24:23
Pretty sure ContentMainRunnerImpl::Initialize is n
Avi (use Gerrit)
2015/05/09 20:41:02
That makes sense.
|
+#endif |
} |
} // namespace content |