Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: content/test/content_test_suite.cc

Issue 1171293005: Revert of content: Single process support for native GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dm-browsertests-refactor
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_browser.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/content_test_suite.cc
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index 116bd0ce472064bf8445bc610e3bafd172f4f860..e3b2ae2865549dc3a65ad8992acf1e1061fef063 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -3,6 +3,11 @@
// found in the LICENSE file.
#include "content/test/content_test_suite.h"
+
+#if defined(OS_ANDROID)
+#include <android/native_window.h>
+#include <android/native_window_jni.h>
+#endif
#include "base/base_paths.h"
#include "base/logging.h"
@@ -19,8 +24,11 @@
#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
#if !defined(OS_IOS)
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/mac/scoped_mach_port.h"
+#include "base/memory/scoped_ptr.h"
#include "base/test/mock_chrome_application_mac.h"
-#include "content/browser/in_process_io_surface_manager_mac.h"
+#include "content/common/mac/io_surface_manager.h"
#endif
#endif
@@ -32,7 +40,12 @@
#endif
#if defined(OS_ANDROID)
-#include "content/browser/android/in_process_surface_texture_manager.h"
+#include "base/android/jni_android.h"
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/common/android/surface_texture_manager.h"
+#include "ui/gl/android/scoped_java_surface.h"
+#include "ui/gl/android/surface_texture.h"
#endif
namespace content {
@@ -57,6 +70,60 @@
DISALLOW_COPY_AND_ASSIGN(TestInitializationListener);
};
+
+#if defined(OS_ANDROID)
+class TestSurfaceTextureManager : public SurfaceTextureManager {
+ public:
+ // Overridden from SurfaceTextureManager:
+ void RegisterSurfaceTexture(int surface_texture_id,
+ int client_id,
+ gfx::SurfaceTexture* surface_texture) override {
+ surfaces_.add(surface_texture_id,
+ make_scoped_ptr(new gfx::ScopedJavaSurface(surface_texture)));
+ }
+ void UnregisterSurfaceTexture(int surface_texture_id,
+ int client_id) override {
+ surfaces_.erase(surface_texture_id);
+ }
+ gfx::AcceleratedWidget AcquireNativeWidgetForSurfaceTexture(
+ int surface_texture_id) override {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ return ANativeWindow_fromSurface(
+ env, surfaces_.get(surface_texture_id)->j_surface().obj());
+ }
+
+ private:
+ using SurfaceMap =
+ base::ScopedPtrHashMap<int, scoped_ptr<gfx::ScopedJavaSurface>>;
+ SurfaceMap surfaces_;
+};
+#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 {
+ io_surfaces_.add(io_surface_id,
+ make_scoped_ptr(new base::mac::ScopedMachSendRight(
+ IOSurfaceCreateMachPort(io_surface))));
+ return true;
+ }
+ void UnregisterIOSurface(int io_surface_id, int client_id) override {
+ io_surfaces_.erase(io_surface_id);
+ }
+ IOSurfaceRef AcquireIOSurface(int io_surface_id) override {
+ return IOSurfaceLookupFromMachPort(io_surfaces_.get(io_surface_id)->get());
+ }
+
+ private:
+ using IOSurfaceMap =
+ base::ScopedPtrHashMap<int, scoped_ptr<base::mac::ScopedMachSendRight>>;
+ IOSurfaceMap io_surfaces_;
+};
+#endif
} // namespace
@@ -99,11 +166,10 @@
testing::UnitTest::GetInstance()->listeners();
listeners.Append(new TestInitializationListener);
#if defined(OS_ANDROID)
- SurfaceTextureManager::SetInstance(
- InProcessSurfaceTextureManager::GetInstance());
+ SurfaceTextureManager::SetInstance(new TestSurfaceTextureManager);
#endif
#if defined(OS_MACOSX) && !defined(OS_IOS)
- IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance());
+ IOSurfaceManager::SetInstance(new TestIOSurfaceManager);
#endif
}
« no previous file with comments | « content/content_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698