diff options
Diffstat (limited to 'chromium/ui/ozone/platform/test/ozone_platform_test.cc')
-rw-r--r-- | chromium/ui/ozone/platform/test/ozone_platform_test.cc | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/chromium/ui/ozone/platform/test/ozone_platform_test.cc b/chromium/ui/ozone/platform/test/ozone_platform_test.cc index 860837e998a..fa0cedb24f9 100644 --- a/chromium/ui/ozone/platform/test/ozone_platform_test.cc +++ b/chromium/ui/ozone/platform/test/ozone_platform_test.cc @@ -6,23 +6,80 @@ #include "base/command_line.h" #include "base/files/file_path.h" +#include "ui/events/ozone/device/device_manager.h" +#include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/ozone/ozone_platform.h" #include "ui/ozone/ozone_switches.h" +#include "ui/ozone/platform/test/file_surface_factory.h" +#include "ui/ozone/public/cursor_factory_ozone.h" + +#if defined(OS_CHROMEOS) +#include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" +#include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" +#endif namespace ui { -OzonePlatformTest::OzonePlatformTest(const base::FilePath& dump_file) - : surface_factory_ozone_(dump_file) {} +namespace { -OzonePlatformTest::~OzonePlatformTest() {} +// OzonePlatform for testing +// +// This platform dumps images to a file for testing purposes. +class OzonePlatformTest : public OzonePlatform { + public: + OzonePlatformTest(const base::FilePath& dump_file) : file_path_(dump_file) {} + virtual ~OzonePlatformTest() {} -gfx::SurfaceFactoryOzone* OzonePlatformTest::GetSurfaceFactoryOzone() { - return &surface_factory_ozone_; -} + // OzonePlatform: + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + return surface_factory_ozone_.get(); + } + virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { + return event_factory_ozone_.get(); + } + virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { + return cursor_factory_ozone_.get(); + } + virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { + return NULL; // no GPU support + } + virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { + return NULL; // no GPU support + } -ui::EventFactoryOzone* OzonePlatformTest::GetEventFactoryOzone() { - return &event_factory_ozone_; -} +#if defined(OS_CHROMEOS) + virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() + OVERRIDE { + return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); + } + virtual scoped_ptr<TouchscreenDeviceManager> + CreateTouchscreenDeviceManager() OVERRIDE { + return scoped_ptr<TouchscreenDeviceManager>( + new TouchscreenDeviceManagerOzone()); + } +#endif + + virtual void InitializeUI() OVERRIDE { + device_manager_ = CreateDeviceManager(); + surface_factory_ozone_.reset(new FileSurfaceFactory(file_path_)); + event_factory_ozone_.reset( + new EventFactoryEvdev(NULL, device_manager_.get())); + cursor_factory_ozone_.reset(new CursorFactoryOzone()); + } + + virtual void InitializeGPU() OVERRIDE {} + + private: + scoped_ptr<DeviceManager> device_manager_; + scoped_ptr<FileSurfaceFactory> surface_factory_ozone_; + scoped_ptr<EventFactoryEvdev> event_factory_ozone_; + scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; + base::FilePath file_path_; + + DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); +}; + +} // namespace OzonePlatform* CreateOzonePlatformTest() { CommandLine* cmd = CommandLine::ForCurrentProcess(); |