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 "content/common/gpu/media/video_decode_factory_ozone.h" |
9 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" | 10 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" |
10 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 11 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
11 #include "ui/gfx/ozone/impl/file_surface_factory.h" | 12 #include "ui/gfx/ozone/impl/file_surface_factory.h" |
12 #include "ui/ozone/ime/input_method_context_factory_ozone.h" | 13 #include "ui/ozone/ime/input_method_context_factory_ozone.h" |
13 #include "ui/ozone/ozone_platform.h" | 14 #include "ui/ozone/ozone_platform.h" |
14 #include "ui/ozone/ozone_switches.h" | 15 #include "ui/ozone/ozone_switches.h" |
15 | 16 |
16 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
17 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" | 18 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" |
18 #endif | 19 #endif |
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) | 30 OzonePlatformTest(const base::FilePath& dump_file) |
30 : surface_factory_ozone_(dump_file) {} | 31 : surface_factory_ozone_(dump_file) {} |
31 virtual ~OzonePlatformTest() {} | 32 virtual ~OzonePlatformTest() {} |
32 | 33 |
33 // OzonePlatform: | 34 // OzonePlatform: |
| 35 virtual content::VideoDecodeFactoryOzone* GetVideoDecodeFactoryOzone() |
| 36 OVERRIDE { |
| 37 return &video_decode_factory_ozone_; |
| 38 } |
34 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 39 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { |
35 return &surface_factory_ozone_; | 40 return &surface_factory_ozone_; |
36 } | 41 } |
37 virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { | 42 virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { |
38 return &event_factory_ozone_; | 43 return &event_factory_ozone_; |
39 } | 44 } |
40 virtual ui::InputMethodContextFactoryOzone* | 45 virtual ui::InputMethodContextFactoryOzone* |
41 GetInputMethodContextFactoryOzone() OVERRIDE { | 46 GetInputMethodContextFactoryOzone() OVERRIDE { |
42 return &input_method_context_factory_ozone_; | 47 return &input_method_context_factory_ozone_; |
43 } | 48 } |
44 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 49 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { |
45 return &cursor_factory_ozone_; | 50 return &cursor_factory_ozone_; |
46 } | 51 } |
47 | 52 |
48 #if defined(OS_CHROMEOS) | 53 #if defined(OS_CHROMEOS) |
49 virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() | 54 virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() |
50 OVERRIDE { | 55 OVERRIDE { |
51 return scoped_ptr<ui::NativeDisplayDelegate>( | 56 return scoped_ptr<ui::NativeDisplayDelegate>( |
52 new NativeDisplayDelegateOzone()); | 57 new NativeDisplayDelegateOzone()); |
53 } | 58 } |
54 #endif | 59 #endif |
55 | 60 |
56 private: | 61 private: |
| 62 content::VideoDecodeFactoryOzone video_decode_factory_ozone_; |
57 gfx::FileSurfaceFactory surface_factory_ozone_; | 63 gfx::FileSurfaceFactory surface_factory_ozone_; |
58 ui::EventFactoryEvdev event_factory_ozone_; | 64 ui::EventFactoryEvdev event_factory_ozone_; |
59 ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_; | 65 ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_; |
60 ui::CursorFactoryOzone cursor_factory_ozone_; | 66 ui::CursorFactoryOzone cursor_factory_ozone_; |
61 | 67 |
62 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); | 68 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); |
63 }; | 69 }; |
64 | 70 |
65 } // namespace | 71 } // namespace |
66 | 72 |
67 OzonePlatform* CreateOzonePlatformTest() { | 73 OzonePlatform* CreateOzonePlatformTest() { |
68 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 74 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
69 base::FilePath location = base::FilePath("/dev/null"); | 75 base::FilePath location = base::FilePath("/dev/null"); |
70 if (cmd->HasSwitch(switches::kOzoneDumpFile)) | 76 if (cmd->HasSwitch(switches::kOzoneDumpFile)) |
71 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); | 77 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); |
72 return new OzonePlatformTest(location); | 78 return new OzonePlatformTest(location); |
73 } | 79 } |
74 | 80 |
75 } // namespace ui | 81 } // namespace ui |
OLD | NEW |