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

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

Issue 11035050: Enable CursorManager::LockCursor to lock cursor visibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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/test_activation_delegate.h" 8 #include "ash/test/test_activation_delegate.h"
9 #include "ash/wm/activation_controller.h" 9 #include "ash/wm/activation_controller.h"
10 #include "ash/wm/cursor_manager.h" 10 #include "ash/wm/cursor_manager.h"
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 591
592 ash::CursorManager* cursor_manager = 592 ash::CursorManager* cursor_manager =
593 ash::Shell::GetInstance()->cursor_manager(); 593 ash::Shell::GetInstance()->cursor_manager();
594 594
595 ui::MouseEvent mouse_moved( 595 ui::MouseEvent mouse_moved(
596 ui::ET_MOUSE_MOVED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); 596 ui::ET_MOUSE_MOVED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0);
597 ui::TouchEvent touch_pressed1( 597 ui::TouchEvent touch_pressed1(
598 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, getTime()); 598 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, getTime());
599 ui::TouchEvent touch_pressed2( 599 ui::TouchEvent touch_pressed2(
600 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 1, getTime()); 600 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 1, getTime());
601 ui::TouchEvent touch_released1(
602 ui::ET_TOUCH_RELEASED, gfx::Point(0, 0), 0, getTime());
603 ui::TouchEvent touch_released2(
604 ui::ET_TOUCH_RELEASED, gfx::Point(0, 0), 1, getTime());
601 605
602 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); 606 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved);
603 EXPECT_TRUE(cursor_manager->cursor_visible()); 607 EXPECT_TRUE(cursor_manager->cursor_visible());
604 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed1); 608 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed1);
605 EXPECT_FALSE(cursor_manager->cursor_visible()); 609 EXPECT_FALSE(cursor_manager->cursor_visible());
606 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); 610 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved);
607 EXPECT_TRUE(cursor_manager->cursor_visible()); 611 EXPECT_TRUE(cursor_manager->cursor_visible());
612 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released1);
613 EXPECT_TRUE(cursor_manager->cursor_visible());
608 614
609 // If someone else made cursor invisible keep it invisible even after it 615 // If someone else made cursor invisible keep it invisible even after it
610 // received mouse events. 616 // received mouse events.
611 cursor_manager->ShowCursor(false); 617 cursor_manager->ShowCursor(false);
612 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); 618 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved);
613 EXPECT_FALSE(cursor_manager->cursor_visible()); 619 EXPECT_FALSE(cursor_manager->cursor_visible());
614 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); 620 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2);
615 EXPECT_FALSE(cursor_manager->cursor_visible()); 621 EXPECT_FALSE(cursor_manager->cursor_visible());
616 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); 622 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved);
617 EXPECT_FALSE(cursor_manager->cursor_visible()); 623 EXPECT_FALSE(cursor_manager->cursor_visible());
624 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2);
625 EXPECT_FALSE(cursor_manager->cursor_visible());
618 626
619 // Back to normal. 627 // Back to normal.
620 cursor_manager->ShowCursor(true); 628 cursor_manager->ShowCursor(true);
621 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); 629 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved);
622 EXPECT_TRUE(cursor_manager->cursor_visible()); 630 EXPECT_TRUE(cursor_manager->cursor_visible());
623 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); 631 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2);
624 EXPECT_FALSE(cursor_manager->cursor_visible()); 632 EXPECT_FALSE(cursor_manager->cursor_visible());
625 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); 633 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved);
626 EXPECT_TRUE(cursor_manager->cursor_visible()); 634 EXPECT_TRUE(cursor_manager->cursor_visible());
635 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2);
636 EXPECT_TRUE(cursor_manager->cursor_visible());
627 } 637 }
628 638
629 } // namespace ash 639 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698