ozone_platform_test.cc revision a02191e04bc25c4935f804f2c080ae28663d096d
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
3// found in the LICENSE file.
4
5#include "ui/ozone/platform/test/ozone_platform_test.h"
6
7#include "base/command_line.h"
8#include "base/files/file_path.h"
9#include "ui/ozone/ozone_platform.h"
10#include "ui/ozone/ozone_switches.h"
11
12#if defined(OS_CHROMEOS)
13#include "ui/ozone/common/chromeos/native_display_delegate_ozone.h"
14#endif
15
16namespace ui {
17
18OzonePlatformTest::OzonePlatformTest(const base::FilePath& dump_file)
19    : surface_factory_ozone_(dump_file) {}
20
21OzonePlatformTest::~OzonePlatformTest() {}
22
23gfx::SurfaceFactoryOzone* OzonePlatformTest::GetSurfaceFactoryOzone() {
24  return &surface_factory_ozone_;
25}
26
27ui::EventFactoryOzone* OzonePlatformTest::GetEventFactoryOzone() {
28  return &event_factory_ozone_;
29}
30
31ui::InputMethodContextFactoryOzone*
32OzonePlatformTest::GetInputMethodContextFactoryOzone() {
33  return &input_method_context_factory_ozone_;
34}
35
36ui::CursorFactoryOzone* OzonePlatformTest::GetCursorFactoryOzone() {
37  return &cursor_factory_ozone_;
38}
39
40#if defined(OS_CHROMEOS)
41scoped_ptr<ui::NativeDisplayDelegate>
42OzonePlatformTest::CreateNativeDisplayDelegate() {
43  return scoped_ptr<ui::NativeDisplayDelegate>(
44      new NativeDisplayDelegateOzone());
45  return scoped_ptr<ui::NativeDisplayDelegate>();
46}
47#endif
48
49OzonePlatform* CreateOzonePlatformTest() {
50  CommandLine* cmd = CommandLine::ForCurrentProcess();
51  base::FilePath location = base::FilePath("/dev/null");
52  if (cmd->HasSwitch(switches::kOzoneDumpFile))
53    location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile);
54  return new OzonePlatformTest(location);
55}
56
57}  // namespace ui
58