| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "ash/touch/touch_observer_hud.h" | 5 #include "ash/touch/touch_observer_hud.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/display_manager_test_api.h" | 13 #include "ash/test/display_manager_test_api.h" |
| 14 #include "ash/touch/touch_hud_debug.h" | 14 #include "ash/touch/touch_hud_debug.h" |
| 15 #include "ash/touch/touch_hud_projection.h" | 15 #include "ash/touch/touch_hud_projection.h" |
| 16 #include "ash/touch_hud/touch_hud_renderer.h" | |
| 17 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 18 #include "base/format_macros.h" | 17 #include "base/format_macros.h" |
| 19 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 20 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 21 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 22 | 21 |
| 23 namespace ash { | 22 namespace ash { |
| 24 | 23 |
| 25 class TouchHudTestBase : public test::AshTestBase { | 24 class TouchHudTestBase : public test::AshTestBase { |
| 26 public: | 25 public: |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 276 |
| 278 void DisableTouchHudProjection() { | 277 void DisableTouchHudProjection() { |
| 279 Shell::GetInstance()->SetTouchHudProjectionEnabled(false); | 278 Shell::GetInstance()->SetTouchHudProjectionEnabled(false); |
| 280 } | 279 } |
| 281 | 280 |
| 282 TouchHudProjection* GetInternalTouchHudProjection() { | 281 TouchHudProjection* GetInternalTouchHudProjection() { |
| 283 return GetInternalRootController()->touch_hud_projection(); | 282 return GetInternalRootController()->touch_hud_projection(); |
| 284 } | 283 } |
| 285 | 284 |
| 286 int GetInternalTouchPointsCount() { | 285 int GetInternalTouchPointsCount() { |
| 287 return GetInternalTouchHudProjection()->touch_hud_renderer_->points_.size(); | 286 return GetInternalTouchHudProjection()->points_.size(); |
| 288 } | 287 } |
| 289 | 288 |
| 290 void SendTouchEventToInternalHud(ui::EventType type, | 289 void SendTouchEventToInternalHud(ui::EventType type, |
| 291 const gfx::Point& location, | 290 const gfx::Point& location, |
| 292 int touch_id) { | 291 int touch_id) { |
| 293 ui::TouchEvent event(type, location, touch_id, event_time); | 292 ui::TouchEvent event(type, location, touch_id, event_time); |
| 294 GetInternalTouchHudProjection()->OnTouchEvent(&event); | 293 GetInternalTouchHudProjection()->OnTouchEvent(&event); |
| 295 | 294 |
| 296 // Advance time for next event. | 295 // Advance time for next event. |
| 297 event_time += base::TimeDelta::FromMilliseconds(100); | 296 event_time += base::TimeDelta::FromMilliseconds(100); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 612 |
| 614 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); | 613 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); |
| 615 EXPECT_EQ(1, GetInternalTouchPointsCount()); | 614 EXPECT_EQ(1, GetInternalTouchPointsCount()); |
| 616 | 615 |
| 617 // Disabling projection touch HUD shoud remove it without crashing. | 616 // Disabling projection touch HUD shoud remove it without crashing. |
| 618 DisableTouchHudProjection(); | 617 DisableTouchHudProjection(); |
| 619 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); | 618 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); |
| 620 } | 619 } |
| 621 | 620 |
| 622 } // namespace ash | 621 } // namespace ash |
| OLD | NEW |