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

Side by Side Diff: ash/wm/window_manager_unittest.cc

Issue 56053004: Dispatches touch events to captured window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/corewm/compound_event_filter.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/shell.h" 5 #include "ash/shell.h"
6 #include "ash/shell_window_ids.h" 6 #include "ash/shell_window_ids.h"
7 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "ash/test/shell_test_api.h" 8 #include "ash/test/shell_test_api.h"
9 #include "ash/test/test_activation_delegate.h" 9 #include "ash/test/test_activation_delegate.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 697
698 // f1 should get no events since it's out and f2 should get them. 698 // f1 should get no events since it's out and f2 should get them.
699 EXPECT_EQ(0, f1->num_key_events()); 699 EXPECT_EQ(0, f1->num_key_events());
700 EXPECT_EQ(0, f1->num_mouse_events()); 700 EXPECT_EQ(0, f1->num_mouse_events());
701 EXPECT_EQ(1, f2->num_key_events()); 701 EXPECT_EQ(1, f2->num_key_events());
702 EXPECT_EQ(1, f2->num_mouse_events()); 702 EXPECT_EQ(1, f2->num_mouse_events());
703 703
704 env_filter->RemoveHandler(f2.get()); 704 env_filter->RemoveHandler(f2.get());
705 } 705 }
706 706
707 // A keypress and/or touch only hides the cursor on ChromeOS (crbug.com/304296).
708 #if defined(OS_CHROMEOS)
707 // We should show and hide the cursor in response to mouse and touch events as 709 // We should show and hide the cursor in response to mouse and touch events as
708 // requested. 710 // requested.
709 TEST_F(WindowManagerTest, UpdateCursorVisibility) { 711 TEST_F(WindowManagerTest, UpdateCursorVisibility) {
710 aura::test::EventGenerator& generator = GetEventGenerator(); 712 aura::test::EventGenerator& generator = GetEventGenerator();
711 views::corewm::CursorManager* cursor_manager = 713 views::corewm::CursorManager* cursor_manager =
712 ash::Shell::GetInstance()->cursor_manager(); 714 ash::Shell::GetInstance()->cursor_manager();
713 715
714 generator.MoveMouseTo(gfx::Point(0, 0)); 716 generator.MoveMouseTo(gfx::Point(0, 0));
715 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 717 EXPECT_TRUE(cursor_manager->IsCursorVisible());
716 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 718 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 EXPECT_FALSE(cursor_manager->IsCursorVisible()); 753 EXPECT_FALSE(cursor_manager->IsCursorVisible());
752 EXPECT_FALSE(cursor_manager->IsMouseEventsEnabled()); 754 EXPECT_FALSE(cursor_manager->IsMouseEventsEnabled());
753 generator.MoveMouseTo(gfx::Point(0, 0)); 755 generator.MoveMouseTo(gfx::Point(0, 0));
754 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 756 EXPECT_TRUE(cursor_manager->IsCursorVisible());
755 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 757 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
756 generator.ReleaseTouch(); 758 generator.ReleaseTouch();
757 EXPECT_TRUE(cursor_manager->IsCursorVisible()); 759 EXPECT_TRUE(cursor_manager->IsCursorVisible());
758 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 760 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
759 } 761 }
760 762
761 #if defined(OS_CHROMEOS)
762 // A keypress only hides the cursor on ChromeOS (crbug.com/304296).
763 TEST_F(WindowManagerTest, UpdateCursorVisibilityOnKeyEvent) { 763 TEST_F(WindowManagerTest, UpdateCursorVisibilityOnKeyEvent) {
764 aura::test::EventGenerator& generator = GetEventGenerator(); 764 aura::test::EventGenerator& generator = GetEventGenerator();
765 views::corewm::CursorManager* cursor_manager = 765 views::corewm::CursorManager* cursor_manager =
766 ash::Shell::GetInstance()->cursor_manager(); 766 ash::Shell::GetInstance()->cursor_manager();
767 767
768 // Pressing a key hides the cursor but does not disable mouse events. 768 // Pressing a key hides the cursor but does not disable mouse events.
769 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 769 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
770 EXPECT_FALSE(cursor_manager->IsCursorVisible()); 770 EXPECT_FALSE(cursor_manager->IsCursorVisible());
771 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled()); 771 EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
772 // Moving mouse shows the cursor. 772 // Moving mouse shows the cursor.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 observer_a.reset(); 839 observer_a.reset();
840 observer_b.reset(); 840 observer_b.reset();
841 generator.MoveMouseTo(50, 50); 841 generator.MoveMouseTo(50, 50);
842 EXPECT_TRUE(observer_a.did_visibility_change()); 842 EXPECT_TRUE(observer_a.did_visibility_change());
843 EXPECT_FALSE(observer_b.did_visibility_change()); 843 EXPECT_FALSE(observer_b.did_visibility_change());
844 EXPECT_TRUE(observer_a.is_cursor_visible()); 844 EXPECT_TRUE(observer_a.is_cursor_visible());
845 } 845 }
846 #endif 846 #endif
847 847
848 } // namespace ash 848 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/views/corewm/compound_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698