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 "ash/host/ash_window_tree_host_x11.h" | 5 #include "ash/host/ash_window_tree_host_x11.h" |
6 | 6 |
7 #undef None | 7 #undef None |
8 #undef Bool | 8 #undef Bool |
9 | 9 |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 explicit RootWindowEventHandler(aura::WindowTreeHost* host) | 25 explicit RootWindowEventHandler(aura::WindowTreeHost* host) |
26 : target_(host->window()), | 26 : target_(host->window()), |
27 last_touch_type_(ui::ET_UNKNOWN), | 27 last_touch_type_(ui::ET_UNKNOWN), |
28 last_touch_id_(-1), | 28 last_touch_id_(-1), |
29 last_touch_location_(0, 0) { | 29 last_touch_location_(0, 0) { |
30 target_->AddPreTargetHandler(this); | 30 target_->AddPreTargetHandler(this); |
31 } | 31 } |
32 virtual ~RootWindowEventHandler() { target_->RemovePreTargetHandler(this); } | 32 virtual ~RootWindowEventHandler() { target_->RemovePreTargetHandler(this); } |
33 | 33 |
34 // ui::EventHandler: | 34 // ui::EventHandler: |
35 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { | 35 virtual void OnTouchEvent(ui::TouchEvent* event) override { |
36 last_touch_id_ = event->touch_id(); | 36 last_touch_id_ = event->touch_id(); |
37 last_touch_type_ = event->type(); | 37 last_touch_type_ = event->type(); |
38 last_touch_location_ = event->location(); | 38 last_touch_location_ = event->location(); |
39 } | 39 } |
40 | 40 |
41 ui::EventType last_touch_type() { return last_touch_type_; } | 41 ui::EventType last_touch_type() { return last_touch_type_; } |
42 | 42 |
43 int last_touch_id() { return last_touch_id_; } | 43 int last_touch_id() { return last_touch_id_; } |
44 | 44 |
45 gfx::Point last_touch_location() { return last_touch_location_; } | 45 gfx::Point last_touch_location() { return last_touch_location_; } |
46 | 46 |
47 private: | 47 private: |
48 ui::EventTarget* target_; | 48 ui::EventTarget* target_; |
49 ui::EventType last_touch_type_; | 49 ui::EventType last_touch_type_; |
50 int last_touch_id_; | 50 int last_touch_id_; |
51 gfx::Point last_touch_location_; | 51 gfx::Point last_touch_location_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(RootWindowEventHandler); | 53 DISALLOW_COPY_AND_ASSIGN(RootWindowEventHandler); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 namespace ash { | 58 namespace ash { |
59 | 59 |
60 class AshWindowTreeHostX11Test : public aura::test::AuraTestBase { | 60 class AshWindowTreeHostX11Test : public aura::test::AuraTestBase { |
61 public: | 61 public: |
62 virtual void SetUp() OVERRIDE { | 62 virtual void SetUp() override { |
63 aura::test::AuraTestBase::SetUp(); | 63 aura::test::AuraTestBase::SetUp(); |
64 | 64 |
65 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
66 // Fake a ChromeOS running env. | 66 // Fake a ChromeOS running env. |
67 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 67 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
68 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 68 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
69 #endif | 69 #endif |
70 } | 70 } |
71 | 71 |
72 virtual void TearDown() OVERRIDE { | 72 virtual void TearDown() override { |
73 aura::test::AuraTestBase::TearDown(); | 73 aura::test::AuraTestBase::TearDown(); |
74 | 74 |
75 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
76 // Revert the CrOS testing env otherwise the following non-CrOS aura | 76 // Revert the CrOS testing env otherwise the following non-CrOS aura |
77 // tests will fail. | 77 // tests will fail. |
78 // Fake a ChromeOS running env. | 78 // Fake a ChromeOS running env. |
79 const char* kLsbRelease = ""; | 79 const char* kLsbRelease = ""; |
80 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 80 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
81 #endif | 81 #endif |
82 } | 82 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); | 243 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); |
244 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); | 244 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); |
245 EXPECT_EQ(1, handler2->last_touch_id()); | 245 EXPECT_EQ(1, handler2->last_touch_id()); |
246 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); | 246 EXPECT_EQ(gfx::Point(1600, 2650), handler2->last_touch_location()); |
247 | 247 |
248 handler1.reset(); | 248 handler1.reset(); |
249 handler2.reset(); | 249 handler2.reset(); |
250 } | 250 } |
251 | 251 |
252 } // namespace aura | 252 } // namespace aura |
OLD | NEW |