| OLD | NEW |
| 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/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 500 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 501 | 501 |
| 502 TrayPopupItemContainer* view = | 502 TrayPopupItemContainer* view = |
| 503 static_cast<TrayPopupItemContainer*>(tray->GetSystemBubble()-> | 503 static_cast<TrayPopupItemContainer*>(tray->GetSystemBubble()-> |
| 504 bubble_view()->child_at(0)); | 504 bubble_view()->child_at(0)); |
| 505 EXPECT_FALSE(view->active()); | 505 EXPECT_FALSE(view->active()); |
| 506 | 506 |
| 507 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 507 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 508 generator.set_current_location(view->GetBoundsInScreen().CenterPoint()); | 508 generator.set_current_location(view->GetBoundsInScreen().CenterPoint()); |
| 509 generator.PressTouch(); | 509 generator.PressTouch(); |
| 510 RunAllPendingInMessageLoop(); | |
| 511 EXPECT_TRUE(view->active()); | 510 EXPECT_TRUE(view->active()); |
| 512 | 511 |
| 513 generator.ReleaseTouch(); | 512 generator.ReleaseTouch(); |
| 514 RunAllPendingInMessageLoop(); | |
| 515 EXPECT_FALSE(view->active()); | 513 EXPECT_FALSE(view->active()); |
| 516 } | 514 } |
| 517 | 515 |
| 518 // Tests that touch events on an item in the system bubble cause it to stop | 516 // Tests that touch events on an item in the system bubble cause it to stop |
| 519 // being active. | 517 // being active. |
| 520 TEST_F(SystemTrayTest, TrayPopupItemContainerTouchFeedbackCancellation) { | 518 TEST_F(SystemTrayTest, TrayPopupItemContainerTouchFeedbackCancellation) { |
| 521 SystemTray* tray = GetSystemTray(); | 519 SystemTray* tray = GetSystemTray(); |
| 522 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 520 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 523 | 521 |
| 524 TrayPopupItemContainer* view = | 522 TrayPopupItemContainer* view = |
| 525 static_cast<TrayPopupItemContainer*>(tray->GetSystemBubble()-> | 523 static_cast<TrayPopupItemContainer*>(tray->GetSystemBubble()-> |
| 526 bubble_view()->child_at(0)); | 524 bubble_view()->child_at(0)); |
| 527 EXPECT_FALSE(view->active()); | 525 EXPECT_FALSE(view->active()); |
| 528 | 526 |
| 529 gfx::Rect view_bounds = view->GetBoundsInScreen(); | 527 gfx::Rect view_bounds = view->GetBoundsInScreen(); |
| 530 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 528 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 531 generator.set_current_location(view_bounds.CenterPoint()); | 529 generator.set_current_location(view_bounds.CenterPoint()); |
| 532 generator.PressTouch(); | 530 generator.PressTouch(); |
| 533 RunAllPendingInMessageLoop(); | |
| 534 EXPECT_TRUE(view->active()); | 531 EXPECT_TRUE(view->active()); |
| 535 | 532 |
| 536 gfx::Point move_point(view_bounds.x(), view_bounds.CenterPoint().y()); | 533 gfx::Point move_point(view_bounds.x(), view_bounds.CenterPoint().y()); |
| 537 generator.MoveTouch(move_point); | 534 generator.MoveTouch(move_point); |
| 538 RunAllPendingInMessageLoop(); | |
| 539 EXPECT_FALSE(view->active()); | 535 EXPECT_FALSE(view->active()); |
| 540 | 536 |
| 541 generator.set_current_location(move_point); | 537 generator.set_current_location(move_point); |
| 542 generator.ReleaseTouch(); | 538 generator.ReleaseTouch(); |
| 543 RunAllPendingInMessageLoop(); | |
| 544 EXPECT_FALSE(view->active()); | 539 EXPECT_FALSE(view->active()); |
| 545 } | 540 } |
| 546 #endif // OS_CHROMEOS | 541 #endif // OS_CHROMEOS |
| 547 | 542 |
| 548 } // namespace test | 543 } // namespace test |
| 549 } // namespace ash | 544 } // namespace ash |
| OLD | NEW |