| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ozone/platform/test/ozone_platform_test.h" | 5 #include "ui/ozone/platform/test/ozone_platform_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 10 #include "ui/events/platform/platform_event_source.h" | 10 #include "ui/events/platform/platform_event_source.h" |
| 11 #include "ui/ozone/common/native_display_delegate_ozone.h" | 11 #include "ui/ozone/common/native_display_delegate_ozone.h" |
| 12 #include "ui/ozone/platform/test/test_window.h" | 12 #include "ui/ozone/platform/test/test_window.h" |
| 13 #include "ui/ozone/platform/test/test_window_manager.h" | 13 #include "ui/ozone/platform/test/test_window_manager.h" |
| 14 #include "ui/ozone/public/cursor_factory_ozone.h" | 14 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 15 #include "ui/ozone/public/gpu_platform_support.h" | 15 #include "ui/ozone/public/gpu_platform_support.h" |
| 16 #include "ui/ozone/public/gpu_platform_support_host.h" | 16 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 17 #include "ui/ozone/public/ozone_platform.h" | 17 #include "ui/ozone/public/ozone_platform.h" |
| 18 #include "ui/ozone/public/ozone_switches.h" | 18 #include "ui/ozone/public/ozone_switches.h" |
| 19 #include "ui/ozone/public/system_input_injector.h" |
| 19 | 20 |
| 20 namespace ui { | 21 namespace ui { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 // OzonePlatform for testing | 25 // OzonePlatform for testing |
| 25 // | 26 // |
| 26 // This platform dumps images to a file for testing purposes. | 27 // This platform dumps images to a file for testing purposes. |
| 27 class OzonePlatformTest : public OzonePlatform { | 28 class OzonePlatformTest : public OzonePlatform { |
| 28 public: | 29 public: |
| 29 OzonePlatformTest(const base::FilePath& dump_file) : file_path_(dump_file) {} | 30 OzonePlatformTest(const base::FilePath& dump_file) : file_path_(dump_file) {} |
| 30 ~OzonePlatformTest() override {} | 31 ~OzonePlatformTest() override {} |
| 31 | 32 |
| 32 // OzonePlatform: | 33 // OzonePlatform: |
| 33 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { | 34 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
| 34 return window_manager_.get(); | 35 return window_manager_.get(); |
| 35 } | 36 } |
| 36 CursorFactoryOzone* GetCursorFactoryOzone() override { | 37 CursorFactoryOzone* GetCursorFactoryOzone() override { |
| 37 return cursor_factory_ozone_.get(); | 38 return cursor_factory_ozone_.get(); |
| 38 } | 39 } |
| 39 GpuPlatformSupport* GetGpuPlatformSupport() override { | 40 GpuPlatformSupport* GetGpuPlatformSupport() override { |
| 40 return gpu_platform_support_.get(); | 41 return gpu_platform_support_.get(); |
| 41 } | 42 } |
| 42 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 43 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| 43 return gpu_platform_support_host_.get(); | 44 return gpu_platform_support_host_.get(); |
| 44 } | 45 } |
| 46 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
| 47 return nullptr; // no input injection support. |
| 48 } |
| 45 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 49 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 46 PlatformWindowDelegate* delegate, | 50 PlatformWindowDelegate* delegate, |
| 47 const gfx::Rect& bounds) override { | 51 const gfx::Rect& bounds) override { |
| 48 return make_scoped_ptr<PlatformWindow>( | 52 return make_scoped_ptr<PlatformWindow>( |
| 49 new TestWindow(delegate, window_manager_.get(), bounds)); | 53 new TestWindow(delegate, window_manager_.get(), bounds)); |
| 50 } | 54 } |
| 51 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 55 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
| 52 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 56 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
| 53 } | 57 } |
| 54 | 58 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 | 86 |
| 83 OzonePlatform* CreateOzonePlatformTest() { | 87 OzonePlatform* CreateOzonePlatformTest() { |
| 84 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 88 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 85 base::FilePath location; | 89 base::FilePath location; |
| 86 if (cmd->HasSwitch(switches::kOzoneDumpFile)) | 90 if (cmd->HasSwitch(switches::kOzoneDumpFile)) |
| 87 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); | 91 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); |
| 88 return new OzonePlatformTest(location); | 92 return new OzonePlatformTest(location); |
| 89 } | 93 } |
| 90 | 94 |
| 91 } // namespace ui | 95 } // namespace ui |
| OLD | NEW |