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

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

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 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_observer_hud.cc ('k') | ash/utility/screenshot_controller_unittest.cc » ('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/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 event_time += base::TimeDelta::FromMilliseconds(100); 292 event_time += base::TimeDelta::FromMilliseconds(100);
293 } 293 }
294 294
295 private: 295 private:
296 base::TimeTicks event_time; 296 base::TimeTicks event_time;
297 297
298 DISALLOW_COPY_AND_ASSIGN(TouchHudProjectionTest); 298 DISALLOW_COPY_AND_ASSIGN(TouchHudProjectionTest);
299 }; 299 };
300 300
301 // Checks if debug touch HUD is correctly initialized for a single display. 301 // Checks if debug touch HUD is correctly initialized for a single display.
302 #if defined(OS_WIN) && !defined(USE_ASH) 302 TEST_F(TouchHudDebugTest, SingleDisplay) {
303 // TODO(msw): Broken on Windows. http://crbug.com/584038
304 #define MAYBE_SingleDisplay DISABLED_SingleDisplay
305 #else
306 #define MAYBE_SingleDisplay SingleDisplay
307 #endif
308 TEST_F(TouchHudDebugTest, MAYBE_SingleDisplay) {
309 // Setup a single display setting. 303 // Setup a single display setting.
310 SetupSingleDisplay(); 304 SetupSingleDisplay();
311 305
312 // Check if touch HUD is set correctly and associated with appropriate 306 // Check if touch HUD is set correctly and associated with appropriate
313 // display. 307 // display.
314 CheckInternalDisplay(); 308 CheckInternalDisplay();
315 } 309 }
316 310
317 // Checks if debug touch HUDs are correctly initialized for two displays. 311 // Checks if debug touch HUDs are correctly initialized for two displays.
318 TEST_F(TouchHudDebugTest, DualDisplays) { 312 TEST_F(TouchHudDebugTest, DualDisplays) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 AddInternalDisplay(); 483 AddInternalDisplay();
490 484
491 // Check if the display's touch HUD is set correctly. 485 // Check if the display's touch HUD is set correctly.
492 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id()); 486 EXPECT_EQ(internal_display_id(), GetPrimaryDisplay().id());
493 CheckInternalDisplay(); 487 CheckInternalDisplay();
494 } 488 }
495 489
496 // Checks projection touch HUD with a sequence of touch-pressed, touch-moved, 490 // Checks projection touch HUD with a sequence of touch-pressed, touch-moved,
497 // and touch-released events. 491 // and touch-released events.
498 // Test if the WM sets correct work area under different density. 492 // Test if the WM sets correct work area under different density.
499 #if defined(OS_WIN) && !defined(USE_ASH) 493 TEST_F(TouchHudProjectionTest, TouchMoveRelease) {
500 // TODO(msw): Broken on Windows. http://crbug.com/584038
501 #define MAYBE_TouchMoveRelease DISABLED_TouchMoveRelease
502 #else
503 #define MAYBE_TouchMoveRelease TouchMoveRelease
504 #endif
505 TEST_F(TouchHudProjectionTest, MAYBE_TouchMoveRelease) {
506 SetupSingleDisplay(); 494 SetupSingleDisplay();
507 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 495 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
508 496
509 EnableTouchHudProjection(); 497 EnableTouchHudProjection();
510 EXPECT_NE(static_cast<TouchHudProjection*>(NULL), 498 EXPECT_NE(static_cast<TouchHudProjection*>(NULL),
511 GetInternalTouchHudProjection()); 499 GetInternalTouchHudProjection());
512 EXPECT_EQ(0, GetInternalTouchPointsCount()); 500 EXPECT_EQ(0, GetInternalTouchPointsCount());
513 501
514 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); 502 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1);
515 EXPECT_EQ(1, GetInternalTouchPointsCount()); 503 EXPECT_EQ(1, GetInternalTouchPointsCount());
516 504
517 SendTouchEventToInternalHud(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 1); 505 SendTouchEventToInternalHud(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 1);
518 EXPECT_EQ(1, GetInternalTouchPointsCount()); 506 EXPECT_EQ(1, GetInternalTouchPointsCount());
519 507
520 SendTouchEventToInternalHud(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 1); 508 SendTouchEventToInternalHud(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 1);
521 EXPECT_EQ(0, GetInternalTouchPointsCount()); 509 EXPECT_EQ(0, GetInternalTouchPointsCount());
522 510
523 // Disabling projection touch HUD shoud remove it without crashing. 511 // Disabling projection touch HUD shoud remove it without crashing.
524 DisableTouchHudProjection(); 512 DisableTouchHudProjection();
525 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 513 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
526 } 514 }
527 515
528 // Checks projection touch HUD with a sequence of touch-pressed, touch-moved, 516 // Checks projection touch HUD with a sequence of touch-pressed, touch-moved,
529 // and touch-cancelled events. 517 // and touch-cancelled events.
530 #if defined(OS_WIN) && !defined(USE_ASH) 518 TEST_F(TouchHudProjectionTest, TouchMoveCancel) {
531 // TODO(msw): Broken on Windows. http://crbug.com/584038
532 #define MAYBE_TouchMoveCancel DISABLED_TouchMoveCancel
533 #else
534 #define MAYBE_TouchMoveCancel TouchMoTouchMoveCancelveRelease
535 #endif
536 TEST_F(TouchHudProjectionTest, MAYBE_TouchMoveCancel) {
537 SetupSingleDisplay(); 519 SetupSingleDisplay();
538 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 520 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
539 521
540 EnableTouchHudProjection(); 522 EnableTouchHudProjection();
541 EXPECT_NE(static_cast<TouchHudProjection*>(NULL), 523 EXPECT_NE(static_cast<TouchHudProjection*>(NULL),
542 GetInternalTouchHudProjection()); 524 GetInternalTouchHudProjection());
543 EXPECT_EQ(0, GetInternalTouchPointsCount()); 525 EXPECT_EQ(0, GetInternalTouchPointsCount());
544 526
545 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); 527 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1);
546 EXPECT_EQ(1, GetInternalTouchPointsCount()); 528 EXPECT_EQ(1, GetInternalTouchPointsCount());
547 529
548 SendTouchEventToInternalHud(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 1); 530 SendTouchEventToInternalHud(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 1);
549 EXPECT_EQ(1, GetInternalTouchPointsCount()); 531 EXPECT_EQ(1, GetInternalTouchPointsCount());
550 532
551 SendTouchEventToInternalHud(ui::ET_TOUCH_CANCELLED, gfx::Point(10, 20), 1); 533 SendTouchEventToInternalHud(ui::ET_TOUCH_CANCELLED, gfx::Point(10, 20), 1);
552 EXPECT_EQ(0, GetInternalTouchPointsCount()); 534 EXPECT_EQ(0, GetInternalTouchPointsCount());
553 535
554 // Disabling projection touch HUD shoud remove it without crashing. 536 // Disabling projection touch HUD shoud remove it without crashing.
555 DisableTouchHudProjection(); 537 DisableTouchHudProjection();
556 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 538 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
557 } 539 }
558 540
559 // Checks projection touch HUD with two simultaneous touches. 541 // Checks projection touch HUD with two simultaneous touches.
560 #if defined(OS_WIN) && !defined(USE_ASH) 542 TEST_F(TouchHudProjectionTest, DoubleTouch) {
561 // TODO(msw): Broken on Windows. http://crbug.com/584038
562 #define MAYBE_DoubleTouch DISABLED_DoubleTouch
563 #else
564 #define MAYBE_DoubleTouch DoubleTouch
565 #endif
566 TEST_F(TouchHudProjectionTest, MAYBE_DoubleTouch) {
567 SetupSingleDisplay(); 543 SetupSingleDisplay();
568 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 544 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
569 545
570 EnableTouchHudProjection(); 546 EnableTouchHudProjection();
571 EXPECT_NE(static_cast<TouchHudProjection*>(NULL), 547 EXPECT_NE(static_cast<TouchHudProjection*>(NULL),
572 GetInternalTouchHudProjection()); 548 GetInternalTouchHudProjection());
573 EXPECT_EQ(0, GetInternalTouchPointsCount()); 549 EXPECT_EQ(0, GetInternalTouchPointsCount());
574 550
575 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); 551 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1);
576 EXPECT_EQ(1, GetInternalTouchPointsCount()); 552 EXPECT_EQ(1, GetInternalTouchPointsCount());
(...skipping 13 matching lines...) Expand all
590 SendTouchEventToInternalHud(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 2); 566 SendTouchEventToInternalHud(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 2);
591 EXPECT_EQ(0, GetInternalTouchPointsCount()); 567 EXPECT_EQ(0, GetInternalTouchPointsCount());
592 568
593 // Disabling projection touch HUD shoud remove it without crashing. 569 // Disabling projection touch HUD shoud remove it without crashing.
594 DisableTouchHudProjection(); 570 DisableTouchHudProjection();
595 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 571 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
596 } 572 }
597 573
598 // Checks if turning off touch HUD projection while touching the screen is 574 // Checks if turning off touch HUD projection while touching the screen is
599 // handled correctly. 575 // handled correctly.
600 #if defined(OS_WIN) && !defined(USE_ASH) 576 TEST_F(TouchHudProjectionTest, DisableWhileTouching) {
601 // TODO(msw): Broken on Windows. http://crbug.com/584038
602 #define MAYBE_DisableWhileTouching DISABLED_DisableWhileTouching
603 #else
604 #define MAYBE_DisableWhileTouching DisableWhileTouching
605 #endif
606 TEST_F(TouchHudProjectionTest, MAYBE_DisableWhileTouching) {
607 SetupSingleDisplay(); 577 SetupSingleDisplay();
608 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 578 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
609 579
610 EnableTouchHudProjection(); 580 EnableTouchHudProjection();
611 EXPECT_NE(static_cast<TouchHudProjection*>(NULL), 581 EXPECT_NE(static_cast<TouchHudProjection*>(NULL),
612 GetInternalTouchHudProjection()); 582 GetInternalTouchHudProjection());
613 EXPECT_EQ(0, GetInternalTouchPointsCount()); 583 EXPECT_EQ(0, GetInternalTouchPointsCount());
614 584
615 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1); 585 SendTouchEventToInternalHud(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1);
616 EXPECT_EQ(1, GetInternalTouchPointsCount()); 586 EXPECT_EQ(1, GetInternalTouchPointsCount());
617 587
618 // Disabling projection touch HUD shoud remove it without crashing. 588 // Disabling projection touch HUD shoud remove it without crashing.
619 DisableTouchHudProjection(); 589 DisableTouchHudProjection();
620 EXPECT_EQ(NULL, GetInternalTouchHudProjection()); 590 EXPECT_EQ(NULL, GetInternalTouchHudProjection());
621 } 591 }
622 592
623 } // namespace ash 593 } // namespace ash
OLDNEW
« no previous file with comments | « ash/touch/touch_observer_hud.cc ('k') | ash/utility/screenshot_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698