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

Side by Side Diff: ash/touch/touch_observer_hud_unittest.cc

Issue 2092343002: Touch HUD app for mustash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change window manager connection unittest to original Created 4 years, 5 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 | « ash/touch/touch_hud_projection.cc ('k') | chrome/app/mash/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 (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 "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/controls/touch/touch_hud_drawer.h"
20 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
21 22
22 namespace ash { 23 namespace ash {
23 24
24 class TouchHudTestBase : public test::AshTestBase { 25 class TouchHudTestBase : public test::AshTestBase {
25 public: 26 public:
26 TouchHudTestBase() {} 27 TouchHudTestBase() {}
27 ~TouchHudTestBase() override {} 28 ~TouchHudTestBase() override {}
28 29
29 void SetUp() override { 30 void SetUp() override {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 277
277 void DisableTouchHudProjection() { 278 void DisableTouchHudProjection() {
278 Shell::GetInstance()->SetTouchHudProjectionEnabled(false); 279 Shell::GetInstance()->SetTouchHudProjectionEnabled(false);
279 } 280 }
280 281
281 TouchHudProjection* GetInternalTouchHudProjection() { 282 TouchHudProjection* GetInternalTouchHudProjection() {
282 return GetInternalRootController()->touch_hud_projection(); 283 return GetInternalRootController()->touch_hud_projection();
283 } 284 }
284 285
285 int GetInternalTouchPointsCount() { 286 int GetInternalTouchPointsCount() {
286 return GetInternalTouchHudProjection()->points_.size(); 287 return GetInternalTouchHudProjection()->touch_hud_drawer_->points_.size();
287 } 288 }
288 289
289 void SendTouchEventToInternalHud(ui::EventType type, 290 void SendTouchEventToInternalHud(ui::EventType type,
290 const gfx::Point& location, 291 const gfx::Point& location,
291 int touch_id) { 292 int touch_id) {
292 ui::TouchEvent event(type, location, touch_id, event_time); 293 ui::TouchEvent event(type, location, touch_id, event_time);
293 GetInternalTouchHudProjection()->OnTouchEvent(&event); 294 GetInternalTouchHudProjection()->OnTouchEvent(&event);
294 295
295 // Advance time for next event. 296 // Advance time for next event.
296 event_time += base::TimeDelta::FromMilliseconds(100); 297 event_time += base::TimeDelta::FromMilliseconds(100);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 613
613 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); 614 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1);
614 EXPECT_EQ(1, GetInternalTouchPointsCount()); 615 EXPECT_EQ(1, GetInternalTouchPointsCount());
615 616
616 // Disabling projection touch HUD shoud remove it without crashing. 617 // Disabling projection touch HUD shoud remove it without crashing.
617 DisableTouchHudProjection(); 618 DisableTouchHudProjection();
618 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 619 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
619 } 620 }
620 621
621 } // namespace ash 622 } // namespace ash
OLDNEW
« no previous file with comments | « ash/touch/touch_hud_projection.cc ('k') | chrome/app/mash/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698