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/ozone/layout/keyboard_layout_engine_manager.h" | 10 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
11 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | 11 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
12 #include "ui/events/platform/platform_event_source.h" | 12 #include "ui/events/platform/platform_event_source.h" |
13 #include "ui/ozone/common/native_display_delegate_ozone.h" | 13 #include "ui/ozone/common/native_display_delegate_ozone.h" |
14 #include "ui/ozone/platform/test/test_window.h" | 14 #include "ui/ozone/platform/test/test_window.h" |
15 #include "ui/ozone/platform/test/test_window_manager.h" | 15 #include "ui/ozone/platform/test/test_window_manager.h" |
16 #include "ui/ozone/public/cursor_factory_ozone.h" | 16 #include "ui/ozone/public/cursor_factory_ozone.h" |
17 #include "ui/ozone/public/gpu_platform_support.h" | 17 #include "ui/ozone/public/gpu_platform_support.h" |
18 #include "ui/ozone/public/gpu_platform_support_host.h" | 18 #include "ui/ozone/public/gpu_platform_support_host.h" |
19 #include "ui/ozone/public/input_controller.h" | 19 #include "ui/ozone/public/input_controller.h" |
| 20 #include "ui/ozone/public/ozone_client.h" |
20 #include "ui/ozone/public/ozone_platform.h" | 21 #include "ui/ozone/public/ozone_platform.h" |
21 #include "ui/ozone/public/ozone_switches.h" | 22 #include "ui/ozone/public/ozone_switches.h" |
| 23 #include "ui/ozone/public/surface_client_factory_ozone.h" |
22 #include "ui/ozone/public/system_input_injector.h" | 24 #include "ui/ozone/public/system_input_injector.h" |
23 | 25 |
24 namespace ui { | 26 namespace ui { |
25 | 27 |
26 namespace { | 28 namespace { |
27 | 29 |
28 // A test implementation of PlatformEventSource that we can instantiate to make | 30 // A test implementation of PlatformEventSource that we can instantiate to make |
29 // sure that the PlatformEventSource has an instance while in unit tests. | 31 // sure that the PlatformEventSource has an instance while in unit tests. |
30 class TestPlatformEventSource : public ui::PlatformEventSource { | 32 class TestPlatformEventSource : public ui::PlatformEventSource { |
31 public: | 33 public: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 scoped_ptr<PlatformEventSource> platform_event_source_; | 98 scoped_ptr<PlatformEventSource> platform_event_source_; |
97 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 99 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
98 scoped_ptr<InputController> input_controller_; | 100 scoped_ptr<InputController> input_controller_; |
99 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | 101 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
100 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 102 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
101 base::FilePath file_path_; | 103 base::FilePath file_path_; |
102 | 104 |
103 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); | 105 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); |
104 }; | 106 }; |
105 | 107 |
| 108 class OzoneClientTest : public OzoneClient { |
| 109 public: |
| 110 OzoneClientTest() {} |
| 111 ~OzoneClientTest() override {} |
| 112 |
| 113 // OzoneClient: |
| 114 SurfaceClientFactoryOzone* GetSurfaceClientFactoryOzone() override { |
| 115 return surface_client_.get(); |
| 116 } |
| 117 |
| 118 void InitializeUI() override { |
| 119 if (!surface_client_) |
| 120 surface_client_.reset(new SurfaceClientFactoryOzone); |
| 121 } |
| 122 |
| 123 void InitializeRenderer() override { |
| 124 if (!surface_client_) |
| 125 surface_client_.reset(new SurfaceClientFactoryOzone); |
| 126 } |
| 127 |
| 128 private: |
| 129 scoped_ptr<SurfaceClientFactoryOzone> surface_client_; |
| 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(OzoneClientTest); |
| 132 }; |
| 133 |
106 } // namespace | 134 } // namespace |
107 | 135 |
108 OzonePlatform* CreateOzonePlatformTest() { | 136 OzonePlatform* CreateOzonePlatformTest() { |
109 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 137 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
110 base::FilePath location; | 138 base::FilePath location; |
111 if (cmd->HasSwitch(switches::kOzoneDumpFile)) | 139 if (cmd->HasSwitch(switches::kOzoneDumpFile)) |
112 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); | 140 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); |
113 return new OzonePlatformTest(location); | 141 return new OzonePlatformTest(location); |
114 } | 142 } |
115 | 143 |
| 144 OzoneClient* CreateOzoneClientTest() { |
| 145 return new OzoneClientTest; |
| 146 } |
| 147 |
116 } // namespace ui | 148 } // namespace ui |
OLD | NEW |