| 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/input_controller_test.h" | |
| 13 #include "ui/ozone/platform/test/test_window.h" | 12 #include "ui/ozone/platform/test/test_window.h" |
| 14 #include "ui/ozone/platform/test/test_window_manager.h" | 13 #include "ui/ozone/platform/test/test_window_manager.h" |
| 15 #include "ui/ozone/public/cursor_factory_ozone.h" | 14 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 16 #include "ui/ozone/public/gpu_platform_support.h" | 15 #include "ui/ozone/public/gpu_platform_support.h" |
| 17 #include "ui/ozone/public/gpu_platform_support_host.h" | 16 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 17 #include "ui/ozone/public/input_controller.h" |
| 18 #include "ui/ozone/public/ozone_platform.h" | 18 #include "ui/ozone/public/ozone_platform.h" |
| 19 #include "ui/ozone/public/ozone_switches.h" | 19 #include "ui/ozone/public/ozone_switches.h" |
| 20 #include "ui/ozone/public/system_input_injector.h" | 20 #include "ui/ozone/public/system_input_injector.h" |
| 21 | 21 |
| 22 namespace ui { | 22 namespace ui { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // OzonePlatform for testing | 26 // OzonePlatform for testing |
| 27 // | 27 // |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 60 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void InitializeUI() override { | 63 void InitializeUI() override { |
| 64 window_manager_.reset(new TestWindowManager(file_path_)); | 64 window_manager_.reset(new TestWindowManager(file_path_)); |
| 65 window_manager_->Initialize(); | 65 window_manager_->Initialize(); |
| 66 // This unbreaks tests that create their own. | 66 // This unbreaks tests that create their own. |
| 67 if (!PlatformEventSource::GetInstance()) | 67 if (!PlatformEventSource::GetInstance()) |
| 68 platform_event_source_ = PlatformEventSource::CreateDefault(); | 68 platform_event_source_ = PlatformEventSource::CreateDefault(); |
| 69 | 69 |
| 70 input_controller_.reset(new InputControllerTest); | 70 input_controller_ = CreateStubInputController(); |
| 71 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 71 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
| 72 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 72 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void InitializeGPU() override { | 75 void InitializeGPU() override { |
| 76 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 76 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 scoped_ptr<TestWindowManager> window_manager_; | 80 scoped_ptr<TestWindowManager> window_manager_; |
| 81 scoped_ptr<PlatformEventSource> platform_event_source_; | 81 scoped_ptr<PlatformEventSource> platform_event_source_; |
| 82 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 82 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
| 83 scoped_ptr<InputControllerTest> input_controller_; | 83 scoped_ptr<InputController> input_controller_; |
| 84 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | 84 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
| 85 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 85 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 86 base::FilePath file_path_; | 86 base::FilePath file_path_; |
| 87 | 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); | 88 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace | 91 } // namespace |
| 92 | 92 |
| 93 OzonePlatform* CreateOzonePlatformTest() { | 93 OzonePlatform* CreateOzonePlatformTest() { |
| 94 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 94 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 95 base::FilePath location; | 95 base::FilePath location; |
| 96 if (cmd->HasSwitch(switches::kOzoneDumpFile)) | 96 if (cmd->HasSwitch(switches::kOzoneDumpFile)) |
| 97 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); | 97 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); |
| 98 return new OzonePlatformTest(location); | 98 return new OzonePlatformTest(location); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace ui | 101 } // namespace ui |
| OLD | NEW |