| 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/ash_switches.h" | 7 #include "ash/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 "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/format_macros.h" | 17 #include "base/format_macros.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 | 23 |
| 24 class TouchHudTestBase : public test::AshTestBase { | 24 class TouchHudTestBase : public test::AshTestBase { |
| 25 public: | 25 public: |
| 26 TouchHudTestBase() {} | 26 TouchHudTestBase() {} |
| 27 virtual ~TouchHudTestBase() {} | 27 virtual ~TouchHudTestBase() {} |
| 28 | 28 |
| 29 virtual void SetUp() OVERRIDE { | 29 virtual void SetUp() override { |
| 30 test::AshTestBase::SetUp(); | 30 test::AshTestBase::SetUp(); |
| 31 | 31 |
| 32 // Initialize display infos. They should be initialized after Ash | 32 // Initialize display infos. They should be initialized after Ash |
| 33 // environment is set up, i.e., after test::AshTestBase::SetUp(). | 33 // environment is set up, i.e., after test::AshTestBase::SetUp(). |
| 34 internal_display_id_ = test::DisplayManagerTestApi(GetDisplayManager()). | 34 internal_display_id_ = test::DisplayManagerTestApi(GetDisplayManager()). |
| 35 SetFirstDisplayAsInternalDisplay(); | 35 SetFirstDisplayAsInternalDisplay(); |
| 36 external_display_id_ = 10; | 36 external_display_id_ = 10; |
| 37 mirrored_display_id_ = 11; | 37 mirrored_display_id_ = 11; |
| 38 | 38 |
| 39 internal_display_info_ = | 39 internal_display_info_ = |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 std::vector<DisplayInfo> display_info_list_; | 207 std::vector<DisplayInfo> display_info_list_; |
| 208 | 208 |
| 209 DISALLOW_COPY_AND_ASSIGN(TouchHudTestBase); | 209 DISALLOW_COPY_AND_ASSIGN(TouchHudTestBase); |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 class TouchHudDebugTest : public TouchHudTestBase { | 212 class TouchHudDebugTest : public TouchHudTestBase { |
| 213 public: | 213 public: |
| 214 TouchHudDebugTest() {} | 214 TouchHudDebugTest() {} |
| 215 virtual ~TouchHudDebugTest() {} | 215 virtual ~TouchHudDebugTest() {} |
| 216 | 216 |
| 217 virtual void SetUp() OVERRIDE { | 217 virtual void SetUp() override { |
| 218 // Add ash-touch-hud flag to enable debug touch HUD. This flag should be set | 218 // Add ash-touch-hud flag to enable debug touch HUD. This flag should be set |
| 219 // before Ash environment is set up, i.e., before TouchHudTestBase::SetUp(). | 219 // before Ash environment is set up, i.e., before TouchHudTestBase::SetUp(). |
| 220 CommandLine::ForCurrentProcess()->AppendSwitch( | 220 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 221 ash::switches::kAshTouchHud); | 221 ash::switches::kAshTouchHud); |
| 222 | 222 |
| 223 TouchHudTestBase::SetUp(); | 223 TouchHudTestBase::SetUp(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void CheckInternalDisplay() { | 226 void CheckInternalDisplay() { |
| 227 EXPECT_NE(static_cast<TouchObserverHUD*>(NULL), GetInternalTouchHudDebug()); | 227 EXPECT_NE(static_cast<TouchObserverHUD*>(NULL), GetInternalTouchHudDebug()); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 585 |
| 586 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); | 586 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); |
| 587 EXPECT_EQ(1, GetInternalTouchPointsCount()); | 587 EXPECT_EQ(1, GetInternalTouchPointsCount()); |
| 588 | 588 |
| 589 // Disabling projection touch HUD shoud remove it without crashing. | 589 // Disabling projection touch HUD shoud remove it without crashing. |
| 590 DisableTouchHudProjection(); | 590 DisableTouchHudProjection(); |
| 591 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); | 591 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); |
| 592 } | 592 } |
| 593 | 593 |
| 594 } // namespace ash | 594 } // namespace ash |
| OLD | NEW |