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

Side by Side Diff: chrome/test/base/view_event_test_platform_part_default.cc

Issue 2327623002: X11: Add TestDesktopScreenX11 to simulate mouse movement in ui tests (Closed)
Patch Set: Move test_desktop_screen_x11 to test_support_internal Created 4 years, 3 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
« no previous file with comments | « chrome/test/base/in_process_browser_test.cc ('k') | ui/views/BUILD.gn » ('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 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)
14 #include "ui/views/test/test_desktop_screen_x11.h"
15 #endif
16
13 namespace { 17 namespace {
14 18
15 // ViewEventTestPlatformPart implementation for Views, but non-CrOS. 19 // ViewEventTestPlatformPart implementation for Views, but non-CrOS.
16 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart { 20 class ViewEventTestPlatformPartDefault : public ViewEventTestPlatformPart {
17 public: 21 public:
18 explicit ViewEventTestPlatformPartDefault( 22 explicit ViewEventTestPlatformPartDefault(
19 ui::ContextFactory* context_factory) { 23 ui::ContextFactory* context_factory) {
20 #if defined(USE_AURA) 24 #if defined(USE_AURA)
25 DCHECK(!display::Screen::GetScreen());
26 #if !defined(OS_CHROMEOS) && defined(OS_LINUX)
27 display::Screen::SetScreenInstance(
28 views::test::TestDesktopScreenX11::GetInstance());
29 #else
21 screen_.reset(views::CreateDesktopScreen()); 30 screen_.reset(views::CreateDesktopScreen());
22 display::Screen::SetScreenInstance(screen_.get()); 31 display::Screen::SetScreenInstance(screen_.get());
32 #endif
23 env_ = aura::Env::CreateInstance(); 33 env_ = aura::Env::CreateInstance();
24 env_->set_context_factory(context_factory); 34 env_->set_context_factory(context_factory);
25 #endif 35 #endif
26 } 36 }
27 37
28 ~ViewEventTestPlatformPartDefault() override { 38 ~ViewEventTestPlatformPartDefault() override {
29 #if defined(USE_AURA) 39 #if defined(USE_AURA)
30 env_.reset(); 40 env_.reset();
31 display::Screen::SetScreenInstance(nullptr); 41 display::Screen::SetScreenInstance(nullptr);
32 #endif 42 #endif
33 } 43 }
34 44
35 // Overridden from ViewEventTestPlatformPart: 45 // Overridden from ViewEventTestPlatformPart:
36 gfx::NativeWindow GetContext() override { return NULL; } 46 gfx::NativeWindow GetContext() override { return NULL; }
37 47
38 private: 48 private:
39 std::unique_ptr<display::Screen> screen_; 49 std::unique_ptr<display::Screen> screen_;
40 std::unique_ptr<aura::Env> env_; 50 std::unique_ptr<aura::Env> env_;
41 51
42 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault); 52 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartDefault);
43 }; 53 };
44 54
45 } // namespace 55 } // namespace
46 56
47 // static 57 // static
48 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( 58 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
49 ui::ContextFactory* context_factory) { 59 ui::ContextFactory* context_factory) {
50 return new ViewEventTestPlatformPartDefault(context_factory); 60 return new ViewEventTestPlatformPartDefault(context_factory);
51 } 61 }
OLDNEW
« no previous file with comments | « chrome/test/base/in_process_browser_test.cc ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698