| Index: content/test/test_client_native_pixmap_factory_ozone.cc
|
| diff --git a/content/test/test_client_native_pixmap_factory_ozone.cc b/content/test/test_client_native_pixmap_factory_ozone.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..87e99272219b211cea59274ceb113029c557bffb
|
| --- /dev/null
|
| +++ b/content/test/test_client_native_pixmap_factory_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_factory_ozone.h"
|
| +
|
| +#include "base/file_descriptor_posix.h"
|
| +#include "base/memory/singleton.h"
|
| +#include "ui/ozone/public/ozone_platform.h"
|
| +
|
| +namespace content {
|
| +
|
| +struct TestClientNativePixmapFactoryTrait
|
| + : public DefaultSingletonTraits<TestClientNativePixmapFactory> {
|
| + static TestClientNativePixmapFactory* New() {
|
| + TestClientNativePixmapFactory* manager =
|
| + new TestClientNativePixmapFactory();
|
| + manager->Initialize(ui::OzonePlatform::GetInstance()->GetVirtualDeviceFd());
|
| + return manager;
|
| + }
|
| +};
|
| +
|
| +// static
|
| +TestClientNativePixmapFactory* TestClientNativePixmapFactory::GetInstance() {
|
| + return Singleton<TestClientNativePixmapFactory,
|
| + TestClientNativePixmapFactoryTrait>::get();
|
| +}
|
| +
|
| +TestClientNativePixmapFactory::TestClientNativePixmapFactory() {}
|
| +
|
| +TestClientNativePixmapFactory::~TestClientNativePixmapFactory() {}
|
| +
|
| +void TestClientNativePixmapFactory::Initialize(
|
| + const base::FileDescriptor& virtual_device) {
|
| + pixmap_factory_ = ui::ClientNativePixmapFactory::Create(virtual_device);
|
| +}
|
| +
|
| +std::vector<ui::ClientNativePixmapFactory::Configuration>
|
| +TestClientNativePixmapFactory::GetSupportedConfigurations() const {
|
| + return pixmap_factory_->GetSupportedConfigurations();
|
| +}
|
| +
|
| +scoped_ptr<ui::ClientNativePixmap>
|
| +TestClientNativePixmapFactory::ImportNativePixmap(
|
| + const base::FileDescriptor& handle,
|
| + const gfx::Size& size,
|
| + gfx::BufferFormat format,
|
| + gfx::BufferUsage usage) {
|
| + return pixmap_factory_->ImportNativePixmap(handle, size, format, usage);
|
| +}
|
| +
|
| +} // namespace content
|
|
|