Index: content/test/test_client_native_pixmap_manager_ozone.cc |
diff --git a/content/test/test_client_native_pixmap_manager_ozone.cc b/content/test/test_client_native_pixmap_manager_ozone.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f162f38b6f25b011f9d22fce1a2b26e936720be2 |
--- /dev/null |
+++ b/content/test/test_client_native_pixmap_manager_ozone.cc |
@@ -0,0 +1,52 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/test/test_client_native_pixmap_manager_ozone.h" |
+ |
+#include "base/file_descriptor_posix.h" |
+#include "base/memory/singleton.h" |
+#include "ui/ozone/public/ozone_platform.h" |
+ |
+namespace content { |
+ |
+struct TestClientNativePixmapManagerTrait |
+ : public DefaultSingletonTraits<TestClientNativePixmapManager> { |
+ static TestClientNativePixmapManager* New() { |
+ TestClientNativePixmapManager* manager = |
+ new TestClientNativePixmapManager(); |
+ manager->Initialize(ui::OzonePlatform::GetInstance()->GetVirtualDeviceFd()); |
+ return manager; |
+ } |
+}; |
+ |
+// static |
+TestClientNativePixmapManager* TestClientNativePixmapManager::GetInstance() { |
+ return Singleton<TestClientNativePixmapManager, |
+ TestClientNativePixmapManagerTrait>::get(); |
+} |
+ |
+TestClientNativePixmapManager::TestClientNativePixmapManager() {} |
+ |
+TestClientNativePixmapManager::~TestClientNativePixmapManager() {} |
+ |
+void TestClientNativePixmapManager::Initialize( |
+ const base::FileDescriptor& virtual_device) { |
+ pixmap_manager_ = ui::ClientNativePixmapManager::Create(virtual_device); |
+} |
+ |
+std::vector<ui::ClientNativePixmapManager::Configuration> |
+TestClientNativePixmapManager::GetSupportedConfigurations() const { |
+ return pixmap_manager_->GetSupportedConfigurations(); |
+} |
+ |
+scoped_ptr<ui::ClientNativePixmap> |
+TestClientNativePixmapManager::ImportClientNativePixmap( |
+ base::FileDescriptor handle, |
+ gfx::Size size, |
+ ui::NativePixmapFormat format, |
+ ui::NativePixmapUsage usage) { |
+ return pixmap_manager_->ImportClientNativePixmap(handle, size, format, usage); |
+} |
+ |
+} // namespace content |