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/file_descriptor_posix.h" |
8 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 10 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
10 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 11 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
11 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | 12 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
12 #include "ui/events/platform/platform_event_source.h" | 13 #include "ui/events/platform/platform_event_source.h" |
13 #include "ui/ozone/common/native_display_delegate_ozone.h" | 14 #include "ui/ozone/common/native_display_delegate_ozone.h" |
14 #include "ui/ozone/common/stub_overlay_manager.h" | 15 #include "ui/ozone/common/stub_overlay_manager.h" |
15 #include "ui/ozone/platform/test/test_window.h" | 16 #include "ui/ozone/platform/test/test_window.h" |
16 #include "ui/ozone/platform/test/test_window_manager.h" | 17 #include "ui/ozone/platform/test/test_window_manager.h" |
17 #include "ui/ozone/public/cursor_factory_ozone.h" | 18 #include "ui/ozone/public/cursor_factory_ozone.h" |
18 #include "ui/ozone/public/gpu_platform_support.h" | 19 #include "ui/ozone/public/gpu_platform_support.h" |
19 #include "ui/ozone/public/gpu_platform_support_host.h" | 20 #include "ui/ozone/public/gpu_platform_support_host.h" |
20 #include "ui/ozone/public/input_controller.h" | 21 #include "ui/ozone/public/input_controller.h" |
| 22 #include "ui/ozone/public/native_pixmap_manager.h" |
21 #include "ui/ozone/public/ozone_platform.h" | 23 #include "ui/ozone/public/ozone_platform.h" |
22 #include "ui/ozone/public/ozone_switches.h" | 24 #include "ui/ozone/public/ozone_switches.h" |
23 #include "ui/ozone/public/system_input_injector.h" | 25 #include "ui/ozone/public/system_input_injector.h" |
24 | 26 |
25 namespace ui { | 27 namespace ui { |
26 | 28 |
27 namespace { | 29 namespace { |
28 | 30 |
29 // A test implementation of PlatformEventSource that we can instantiate to make | 31 // A test implementation of PlatformEventSource that we can instantiate to make |
30 // sure that the PlatformEventSource has an instance while in unit tests. | 32 // sure that the PlatformEventSource has an instance while in unit tests. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 71 } |
70 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 72 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
71 PlatformWindowDelegate* delegate, | 73 PlatformWindowDelegate* delegate, |
72 const gfx::Rect& bounds) override { | 74 const gfx::Rect& bounds) override { |
73 return make_scoped_ptr<PlatformWindow>( | 75 return make_scoped_ptr<PlatformWindow>( |
74 new TestWindow(delegate, window_manager_.get(), bounds)); | 76 new TestWindow(delegate, window_manager_.get(), bounds)); |
75 } | 77 } |
76 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 78 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
77 return make_scoped_ptr(new NativeDisplayDelegateOzone()); | 79 return make_scoped_ptr(new NativeDisplayDelegateOzone()); |
78 } | 80 } |
| 81 base::FileDescriptor GetVirtualDeviceFd() override { |
| 82 return base::FileDescriptor(); |
| 83 } |
79 | 84 |
80 void InitializeUI() override { | 85 void InitializeUI() override { |
81 window_manager_.reset(new TestWindowManager(file_path_)); | 86 window_manager_.reset(new TestWindowManager(file_path_)); |
82 window_manager_->Initialize(); | 87 window_manager_->Initialize(); |
83 // This unbreaks tests that create their own. | 88 // This unbreaks tests that create their own. |
84 if (!PlatformEventSource::GetInstance()) | 89 if (!PlatformEventSource::GetInstance()) |
85 platform_event_source_.reset(new TestPlatformEventSource); | 90 platform_event_source_.reset(new TestPlatformEventSource); |
86 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 91 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
87 make_scoped_ptr(new StubKeyboardLayoutEngine())); | 92 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
88 | 93 |
(...skipping 23 matching lines...) Expand all Loading... |
112 } // namespace | 117 } // namespace |
113 | 118 |
114 OzonePlatform* CreateOzonePlatformTest() { | 119 OzonePlatform* CreateOzonePlatformTest() { |
115 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 120 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
116 base::FilePath location; | 121 base::FilePath location; |
117 if (cmd->HasSwitch(switches::kOzoneDumpFile)) | 122 if (cmd->HasSwitch(switches::kOzoneDumpFile)) |
118 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); | 123 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); |
119 return new OzonePlatformTest(location); | 124 return new OzonePlatformTest(location); |
120 } | 125 } |
121 | 126 |
| 127 NativePixmapManager* CreateNativePixmapManagerTest() { |
| 128 return CreateStubNativePixmapManager(); |
| 129 } |
| 130 |
122 } // namespace ui | 131 } // namespace ui |
OLD | NEW |