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

Side by Side Diff: ash/system/web_notification/web_notification_tray_unittest.cc

Issue 968873005: Touch Feedback tests on Valgrind (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/system/tray/tray_details_view_unittest.cc ('k') | ash/test/ash_test_base.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 int bottom = GetPopupWorkAreaBottom(); 462 int bottom = GetPopupWorkAreaBottom();
463 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray()); 463 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray());
464 464
465 // System tray is created on the primary display. The popups in the secondary 465 // System tray is created on the primary display. The popups in the secondary
466 // tray aren't affected. 466 // tray aren't affected.
467 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); 467 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
468 EXPECT_GT(bottom, GetPopupWorkAreaBottom()); 468 EXPECT_GT(bottom, GetPopupWorkAreaBottom());
469 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray())); 469 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray()));
470 } 470 }
471 471
472 // TODO(jonross): This test is failing on ASAN bots, fix the failure and
473 // re-enable. (crbug.com/411881)
474 // TODO(jonross): Replace manually creating TouchEvent with 472 // TODO(jonross): Replace manually creating TouchEvent with
475 // EventGenerator.PressTouch/ReleaseTouch. Currently they set a width on the 473 // EventGenerator.PressTouch/ReleaseTouch. Currently they set a width on the
476 // touch event causing the gesture recognizer to target a different view. 474 // touch event causing the gesture recognizer to target a different view.
477 #if defined(OS_CHROMEOS) 475 #if defined(OS_CHROMEOS)
478 // Tests that there is visual feedback for touch presses. 476 // Tests that there is visual feedback for touch presses.
479 TEST_F(WebNotificationTrayTest, DISABLED_TouchFeedback) { 477 TEST_F(WebNotificationTrayTest, TouchFeedback) {
480 AddNotification("test_id"); 478 AddNotification("test_id");
481 RunAllPendingInMessageLoop(); 479 RunAllPendingInMessageLoop();
482 WebNotificationTray* tray = GetTray(); 480 WebNotificationTray* tray = GetTray();
483 EXPECT_TRUE(tray->visible()); 481 EXPECT_TRUE(tray->visible());
484 482
485 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 483 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
486 const int touch_id = 0; 484 const int touch_id = 0;
487 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint(); 485 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint();
488 486
489 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id, 487 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id,
490 generator.Now()); 488 generator.Now());
491 generator.Dispatch(&press); 489 generator.Dispatch(&press);
492 RunAllPendingInMessageLoop();
493 EXPECT_TRUE(tray->draw_background_as_active()); 490 EXPECT_TRUE(tray->draw_background_as_active());
494 491
495 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center_point, touch_id, 492 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center_point, touch_id,
496 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); 493 press.time_stamp() + base::TimeDelta::FromMilliseconds(50));
497 generator.Dispatch(&release); 494 generator.Dispatch(&release);
498 RunAllPendingInMessageLoop();
499 EXPECT_TRUE(tray->draw_background_as_active()); 495 EXPECT_TRUE(tray->draw_background_as_active());
500 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible()); 496 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible());
501 497
502 generator.GestureTapAt(center_point); 498 generator.GestureTapAt(center_point);
503 RunAllPendingInMessageLoop();
504 EXPECT_FALSE(tray->draw_background_as_active()); 499 EXPECT_FALSE(tray->draw_background_as_active());
505 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); 500 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
506 } 501 }
507 502
508 // TODO(jonross): This test is failing on ASAN bots, fix the failure and
509 // re-enable. (crbug.com/411881)
510 // Tests that while touch presses trigger visual feedback, that subsequent non 503 // Tests that while touch presses trigger visual feedback, that subsequent non
511 // tap gestures cancel the feedback without triggering the message center. 504 // tap gestures cancel the feedback without triggering the message center.
512 TEST_F(WebNotificationTrayTest, DISABLED_TouchFeedbackCancellation) { 505 TEST_F(WebNotificationTrayTest, TouchFeedbackCancellation) {
513 AddNotification("test_id"); 506 AddNotification("test_id");
514 RunAllPendingInMessageLoop(); 507 RunAllPendingInMessageLoop();
515 WebNotificationTray* tray = GetTray(); 508 WebNotificationTray* tray = GetTray();
516 EXPECT_TRUE(tray->visible()); 509 EXPECT_TRUE(tray->visible());
517 510
518 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 511 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
519 const int touch_id = 0; 512 const int touch_id = 0;
520 gfx::Rect bounds = tray->GetBoundsInScreen(); 513 gfx::Rect bounds = tray->GetBoundsInScreen();
521 gfx::Point center_point = bounds.CenterPoint(); 514 gfx::Point center_point = bounds.CenterPoint();
522 515
523 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id, 516 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id,
524 generator.Now()); 517 generator.Now());
525 generator.Dispatch(&press); 518 generator.Dispatch(&press);
526 RunAllPendingInMessageLoop();
527 EXPECT_TRUE(tray->draw_background_as_active()); 519 EXPECT_TRUE(tray->draw_background_as_active());
528 520
529 gfx::Point out_of_bounds(bounds.x() - 1, center_point.y()); 521 gfx::Point out_of_bounds(bounds.x() - 1, center_point.y());
530 ui::TouchEvent move(ui::ET_TOUCH_MOVED, out_of_bounds, touch_id, 522 ui::TouchEvent move(ui::ET_TOUCH_MOVED, out_of_bounds, touch_id,
531 press.time_stamp()+base::TimeDelta::FromMilliseconds(50)); 523 press.time_stamp()+base::TimeDelta::FromMilliseconds(50));
532 generator.Dispatch(&move); 524 generator.Dispatch(&move);
533 RunAllPendingInMessageLoop();
534 EXPECT_FALSE(tray->draw_background_as_active()); 525 EXPECT_FALSE(tray->draw_background_as_active());
535 526
536 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, 527 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id,
537 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); 528 move.time_stamp()+base::TimeDelta::FromMilliseconds(50));
538 generator.Dispatch(&release); 529 generator.Dispatch(&release);
539 RunAllPendingInMessageLoop();
540 EXPECT_FALSE(tray->draw_background_as_active()); 530 EXPECT_FALSE(tray->draw_background_as_active());
541 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); 531 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
542 } 532 }
543 533
544 #endif // OS_CHROMEOS 534 #endif // OS_CHROMEOS
545 535
546 } // namespace ash 536 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_details_view_unittest.cc ('k') | ash/test/ash_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698