Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/test/base/view_event_test_platform_part.h" | 8 #include "chrome/test/base/view_event_test_platform_part.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/display/screen.h" | 10 #include "ui/display/screen.h" |
| 11 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 11 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 12 | 12 |
| 13 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) | 13 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) |
| 14 #include "ui/views/test/test_desktop_screen_x11.h" | 14 #include "ui/views/test/test_desktop_screen_x11.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // ViewEventTestPlatformPart implementation for Views, but non-CrOS. | 19 // ViewEventTestPlatformPart implementation for Views, but non-CrOS. |
| 20 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { | 20 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { |
| 21 public: | 21 public: |
| 22 explicit ViewEventTestPlatformPartDefault( | 22 explicit ViewEventTestPlatformPartDefault( |
| 23 ui::ContextFactory* context_factory) { | 23 ui::ContextFactory* context_factory) { |
| 24 #if defined(USE_AURA) | 24 #if defined(USE_AURA) |
| 25 DCHECK(!display::Screen::GetScreen()); | 25 DCHECK(!display::Screen::GetScreen()); |
| 26 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) | 26 #if defined(USE_X11) |
|
tonikitoo
2016/11/08 15:44:56
would not the proper check here be
#if !defined(O
Tom (Use chromium acct)
2016/11/08 18:21:48
Done.
| |
| 27 display::Screen::SetScreenInstance( | 27 display::Screen::SetScreenInstance( |
| 28 views::test::TestDesktopScreenX11::GetInstance()); | 28 views::test::TestDesktopScreenX11::GetInstance()); |
| 29 #else | 29 #else |
| 30 screen_.reset(views::CreateDesktopScreen()); | 30 screen_.reset(views::CreateDesktopScreen()); |
| 31 display::Screen::SetScreenInstance(screen_.get()); | 31 display::Screen::SetScreenInstance(screen_.get()); |
| 32 #endif | 32 #endif |
| 33 env_ = aura::Env::CreateInstance(); | 33 env_ = aura::Env::CreateInstance(); |
| 34 env_->set_context_factory(context_factory); | 34 env_->set_context_factory(context_factory); |
| 35 #endif | 35 #endif |
| 36 } | 36 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 52 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault); | 52 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( | 58 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( |
| 59 ui::ContextFactory* context_factory) { | 59 ui::ContextFactory* context_factory) { |
| 60 return new ViewEventTestPlatformPartDefault(context_factory); | 60 return new ViewEventTestPlatformPartDefault(context_factory); |
| 61 } | 61 } |
| OLD | NEW |