Index: content/test/content_test_suite.cc |
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc |
index 6a3610a46ac4a425edbc5b4891f2a03eb60ee8f2..7346fd6fc6822bd21b1d4089b8bacaecb268571a 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 TestSurfaceTextureManager : public SurfaceTextureManager { |
}; |
#endif |
+#if defined(OS_MACOSX) && !defined(OS_IOS) |
+class TestIOSurfaceManager : public IOSurfaceManager { |
+ 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>> |
Robert Sesek
2015/05/15 21:45:05
Why is this a linked_ptr?
reveman
2015/05/18 18:15:39
To be consistent with TestSurfaceTextureManager ab
|
+ 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 TestSurfaceTextureManager); |
#endif |
+#if defined(OS_MACOSX) && !defined(OS_IOS) |
+ IOSurfaceManager::SetInstance(new TestIOSurfaceManager); |
+#endif |
} |
} // namespace content |