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/platform/test/test_window.h" | 11 #include "ui/ozone/platform/test/test_window.h" |
12 #include "ui/ozone/platform/test/test_window_manager.h" | 12 #include "ui/ozone/platform/test/test_window_manager.h" |
13 #include "ui/ozone/public/cursor_factory_ozone.h" | 13 #include "ui/ozone/public/cursor_factory_ozone.h" |
14 #include "ui/ozone/public/gpu_platform_support.h" | 14 #include "ui/ozone/public/gpu_platform_support.h" |
15 #include "ui/ozone/public/gpu_platform_support_host.h" | 15 #include "ui/ozone/public/gpu_platform_support_host.h" |
16 #include "ui/ozone/public/ozone_platform.h" | 16 #include "ui/ozone/public/ozone_platform.h" |
17 #include "ui/ozone/public/ozone_switches.h" | 17 #include "ui/ozone/public/ozone_switches.h" |
18 | 18 |
19 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
20 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" | 20 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" |
21 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" | |
22 #endif | 21 #endif |
23 | 22 |
24 namespace ui { | 23 namespace ui { |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 // OzonePlatform for testing | 27 // OzonePlatform for testing |
29 // | 28 // |
30 // This platform dumps images to a file for testing purposes. | 29 // This platform dumps images to a file for testing purposes. |
31 class OzonePlatformTest : public OzonePlatform { | 30 class OzonePlatformTest : public OzonePlatform { |
(...skipping 19 matching lines...) Expand all Loading... |
51 const gfx::Rect& bounds) OVERRIDE { | 50 const gfx::Rect& bounds) OVERRIDE { |
52 return make_scoped_ptr<PlatformWindow>( | 51 return make_scoped_ptr<PlatformWindow>( |
53 new TestWindow(delegate, window_manager_.get(), bounds)); | 52 new TestWindow(delegate, window_manager_.get(), bounds)); |
54 } | 53 } |
55 | 54 |
56 #if defined(OS_CHROMEOS) | 55 #if defined(OS_CHROMEOS) |
57 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 56 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
58 OVERRIDE { | 57 OVERRIDE { |
59 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 58 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
60 } | 59 } |
61 virtual scoped_ptr<TouchscreenDeviceManager> | |
62 CreateTouchscreenDeviceManager() OVERRIDE { | |
63 return scoped_ptr<TouchscreenDeviceManager>( | |
64 new TouchscreenDeviceManagerOzone()); | |
65 } | |
66 #endif | 60 #endif |
67 | 61 |
68 virtual void InitializeUI() OVERRIDE { | 62 virtual void InitializeUI() OVERRIDE { |
69 window_manager_.reset(new TestWindowManager(file_path_)); | 63 window_manager_.reset(new TestWindowManager(file_path_)); |
70 window_manager_->Initialize(); | 64 window_manager_->Initialize(); |
71 // This unbreaks tests that create their own. | 65 // This unbreaks tests that create their own. |
72 if (!PlatformEventSource::GetInstance()) | 66 if (!PlatformEventSource::GetInstance()) |
73 platform_event_source_ = PlatformEventSource::CreateDefault(); | 67 platform_event_source_ = PlatformEventSource::CreateDefault(); |
74 | 68 |
75 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 69 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
(...skipping 19 matching lines...) Expand all Loading... |
95 | 89 |
96 OzonePlatform* CreateOzonePlatformTest() { | 90 OzonePlatform* CreateOzonePlatformTest() { |
97 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 91 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
98 base::FilePath location; | 92 base::FilePath location; |
99 if (cmd->HasSwitch(switches::kOzoneDumpFile)) | 93 if (cmd->HasSwitch(switches::kOzoneDumpFile)) |
100 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); | 94 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); |
101 return new OzonePlatformTest(location); | 95 return new OzonePlatformTest(location); |
102 } | 96 } |
103 | 97 |
104 } // namespace ui | 98 } // namespace ui |
OLD | NEW |