Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: ui/ozone/platform/test/ozone_platform_test.cc

Issue 312393002: ozone: Move the factory interfaces into a common target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r278697 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/test/file_surface_factory.cc ('k') | ui/ozone/platform/test/test.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cursor_factory_ozone.h"
10 #include "ui/events/ozone/device/device_manager.h" 9 #include "ui/events/ozone/device/device_manager.h"
11 #include "ui/events/ozone/evdev/event_factory_evdev.h" 10 #include "ui/events/ozone/evdev/event_factory_evdev.h"
12 #include "ui/gfx/ozone/impl/file_surface_factory.h"
13 #include "ui/ozone/ozone_platform.h" 11 #include "ui/ozone/ozone_platform.h"
14 #include "ui/ozone/ozone_switches.h" 12 #include "ui/ozone/ozone_switches.h"
13 #include "ui/ozone/platform/test/file_surface_factory.h"
14 #include "ui/ozone/public/cursor_factory_ozone.h"
15 15
16 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
17 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" 17 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h"
18 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" 18 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h"
19 #endif 19 #endif
20 20
21 namespace ui { 21 namespace ui {
22 22
23 namespace { 23 namespace {
24 24
25 // OzonePlatform for testing 25 // OzonePlatform for testing
26 // 26 //
27 // This platform dumps images to a file for testing purposes. 27 // This platform dumps images to a file for testing purposes.
28 class OzonePlatformTest : public OzonePlatform { 28 class OzonePlatformTest : public OzonePlatform {
29 public: 29 public:
30 OzonePlatformTest(const base::FilePath& dump_file) : file_path_(dump_file) {} 30 OzonePlatformTest(const base::FilePath& dump_file) : file_path_(dump_file) {}
31 virtual ~OzonePlatformTest() {} 31 virtual ~OzonePlatformTest() {}
32 32
33 // OzonePlatform: 33 // OzonePlatform:
34 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { 34 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
35 return surface_factory_ozone_.get(); 35 return surface_factory_ozone_.get();
36 } 36 }
37 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { 37 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
38 return event_factory_ozone_.get(); 38 return event_factory_ozone_.get();
39 } 39 }
40 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { 40 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
41 return cursor_factory_ozone_.get(); 41 return cursor_factory_ozone_.get();
42 } 42 }
43 43
44 #if defined(OS_CHROMEOS) 44 #if defined(OS_CHROMEOS)
45 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() 45 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
46 OVERRIDE { 46 OVERRIDE {
47 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); 47 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone());
48 } 48 }
49 virtual scoped_ptr<TouchscreenDeviceManager> 49 virtual scoped_ptr<TouchscreenDeviceManager>
50 CreateTouchscreenDeviceManager() OVERRIDE { 50 CreateTouchscreenDeviceManager() OVERRIDE {
51 return scoped_ptr<TouchscreenDeviceManager>( 51 return scoped_ptr<TouchscreenDeviceManager>(
52 new TouchscreenDeviceManagerOzone()); 52 new TouchscreenDeviceManagerOzone());
53 } 53 }
54 #endif 54 #endif
55 55
56 virtual void InitializeUI() OVERRIDE { 56 virtual void InitializeUI() OVERRIDE {
57 device_manager_ = CreateDeviceManager(); 57 device_manager_ = CreateDeviceManager();
58 surface_factory_ozone_.reset(new gfx::FileSurfaceFactory(file_path_)); 58 surface_factory_ozone_.reset(new FileSurfaceFactory(file_path_));
59 event_factory_ozone_.reset( 59 event_factory_ozone_.reset(
60 new EventFactoryEvdev(NULL, device_manager_.get())); 60 new EventFactoryEvdev(NULL, device_manager_.get()));
61 cursor_factory_ozone_.reset(new CursorFactoryOzone()); 61 cursor_factory_ozone_.reset(new CursorFactoryOzone());
62 } 62 }
63 63
64 virtual void InitializeGPU() OVERRIDE {} 64 virtual void InitializeGPU() OVERRIDE {}
65 65
66 private: 66 private:
67 scoped_ptr<DeviceManager> device_manager_; 67 scoped_ptr<DeviceManager> device_manager_;
68 scoped_ptr<gfx::FileSurfaceFactory> surface_factory_ozone_; 68 scoped_ptr<FileSurfaceFactory> surface_factory_ozone_;
69 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 69 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
70 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; 70 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
71 base::FilePath file_path_; 71 base::FilePath file_path_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); 73 DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest);
74 }; 74 };
75 75
76 } // namespace 76 } // namespace
77 77
78 OzonePlatform* CreateOzonePlatformTest() { 78 OzonePlatform* CreateOzonePlatformTest() {
79 CommandLine* cmd = CommandLine::ForCurrentProcess(); 79 CommandLine* cmd = CommandLine::ForCurrentProcess();
80 base::FilePath location = base::FilePath("/dev/null"); 80 base::FilePath location = base::FilePath("/dev/null");
81 if (cmd->HasSwitch(switches::kOzoneDumpFile)) 81 if (cmd->HasSwitch(switches::kOzoneDumpFile))
82 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); 82 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile);
83 return new OzonePlatformTest(location); 83 return new OzonePlatformTest(location);
84 } 84 }
85 85
86 } // namespace ui 86 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/test/file_surface_factory.cc ('k') | ui/ozone/platform/test/test.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698