| OLD | NEW |
| 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 | 5 |
| 6 #include "base/sys_info.h" | 6 #include "base/sys_info.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/aura/root_window.h" | 8 #include "ui/aura/root_window.h" |
| 9 #include "ui/aura/root_window_host_x11.h" | 9 #include "ui/aura/root_window_host_x11.h" |
| 10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
| 11 #include "ui/aura/window_tree_host_delegate.h" | 11 #include "ui/aura/window_tree_host_delegate.h" |
| 12 #include "ui/events/event_processor.h" | 12 #include "ui/events/event_processor.h" |
| 13 #include "ui/events/event_target.h" | 13 #include "ui/events/event_target.h" |
| 14 #include "ui/events/event_target_iterator.h" | 14 #include "ui/events/event_target_iterator.h" |
| 15 #include "ui/events/test/events_test_utils_x11.h" | 15 #include "ui/events/test/events_test_utils_x11.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 class TestWindowTreeHostDelegate : public aura::WindowTreeHostDelegate, | 18 class TestWindowTreeHostDelegate : public aura::WindowTreeHostDelegate, |
| 19 public ui::EventProcessor, | 19 public ui::EventProcessor, |
| 20 public ui::EventTarget { | 20 public ui::EventTarget { |
| 21 public: | 21 public: |
| 22 TestWindowTreeHostDelegate() : last_touch_type_(ui::ET_UNKNOWN), | 22 TestWindowTreeHostDelegate() : last_touch_type_(ui::ET_UNKNOWN), |
| 23 last_touch_id_(-1), | 23 last_touch_id_(-1), |
| 24 last_touch_location_(0, 0) { | 24 last_touch_location_(0, 0) { |
| 25 } | 25 } |
| 26 virtual ~TestWindowTreeHostDelegate() {} | 26 virtual ~TestWindowTreeHostDelegate() {} |
| 27 | 27 |
| 28 // aura::WindowTreeHostDelegate: | 28 // aura::WindowTreeHostDelegate: |
| 29 virtual bool OnHostKeyEvent(ui::KeyEvent* event) OVERRIDE { | |
| 30 return true; | |
| 31 } | |
| 32 virtual bool OnHostMouseEvent(ui::MouseEvent* event) OVERRIDE { | |
| 33 return true; | |
| 34 } | |
| 35 virtual bool OnHostScrollEvent(ui::ScrollEvent* event) OVERRIDE { | |
| 36 return true; | |
| 37 } | |
| 38 virtual bool OnHostTouchEvent(ui::TouchEvent* event) OVERRIDE { | |
| 39 last_touch_id_ = event->touch_id(); | |
| 40 last_touch_type_ = event->type(); | |
| 41 last_touch_location_ = event->location(); | |
| 42 return true; | |
| 43 } | |
| 44 | |
| 45 virtual void OnHostCancelMode() OVERRIDE {} | 29 virtual void OnHostCancelMode() OVERRIDE {} |
| 46 virtual void OnHostActivated() OVERRIDE {} | 30 virtual void OnHostActivated() OVERRIDE {} |
| 47 virtual void OnHostLostWindowCapture() OVERRIDE {} | 31 virtual void OnHostLostWindowCapture() OVERRIDE {} |
| 48 virtual void OnHostLostMouseGrab() OVERRIDE {} | 32 virtual void OnHostLostMouseGrab() OVERRIDE {} |
| 49 virtual void OnHostMoved(const gfx::Point& origin) OVERRIDE {} | 33 virtual void OnHostMoved(const gfx::Point& origin) OVERRIDE {} |
| 50 virtual void OnHostResized(const gfx::Size& size) OVERRIDE {} | 34 virtual void OnHostResized(const gfx::Size& size) OVERRIDE {} |
| 51 virtual aura::RootWindow* AsRootWindow() OVERRIDE { return NULL; } | 35 virtual aura::RootWindow* AsRootWindow() OVERRIDE { return NULL; } |
| 52 virtual const aura::RootWindow* AsRootWindow() const OVERRIDE { return NULL; } | 36 virtual const aura::RootWindow* AsRootWindow() const OVERRIDE { return NULL; } |
| 53 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE { | 37 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE { |
| 54 return this; | 38 return this; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 263 |
| 280 // Revert the CrOS testing env otherwise the following non-CrOS aura | 264 // Revert the CrOS testing env otherwise the following non-CrOS aura |
| 281 // tests will fail. | 265 // tests will fail. |
| 282 // Fake a ChromeOS running env. | 266 // Fake a ChromeOS running env. |
| 283 kLsbRelease = ""; | 267 kLsbRelease = ""; |
| 284 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 268 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 285 } | 269 } |
| 286 #endif // defined(OS_CHROMEOS) | 270 #endif // defined(OS_CHROMEOS) |
| 287 | 271 |
| 288 } // namespace aura | 272 } // namespace aura |
| OLD | NEW |