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/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/window_util.h" | 11 #include "ash/wm/window_util.h" |
11 #include "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
12 #include "ui/aura/client/activation_delegate.h" | 13 #include "ui/aura/client/activation_delegate.h" |
13 #include "ui/aura/cursor_manager.h" | |
14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
15 #include "ui/aura/event.h" | 15 #include "ui/aura/event.h" |
16 #include "ui/aura/focus_manager.h" | 16 #include "ui/aura/focus_manager.h" |
17 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
18 #include "ui/aura/shared/compound_event_filter.h" | 18 #include "ui/aura/shared/compound_event_filter.h" |
19 #include "ui/aura/shared/input_method_event_filter.h" | 19 #include "ui/aura/shared/input_method_event_filter.h" |
20 #include "ui/aura/test/aura_test_base.h" | 20 #include "ui/aura/test/aura_test_base.h" |
21 #include "ui/aura/test/event_generator.h" | 21 #include "ui/aura/test/event_generator.h" |
22 #include "ui/aura/test/test_event_filter.h" | 22 #include "ui/aura/test/test_event_filter.h" |
23 #include "ui/aura/test/test_window_delegate.h" | 23 #include "ui/aura/test/test_window_delegate.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 // We should show and hide the cursor in response to mouse and touch events as | 567 // We should show and hide the cursor in response to mouse and touch events as |
568 // requested. | 568 // requested. |
569 TEST_F(WindowManagerTest, UpdateCursorVisibility) { | 569 TEST_F(WindowManagerTest, UpdateCursorVisibility) { |
570 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 570 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); |
571 root_window->SetBounds(gfx::Rect(0, 0, 500, 500)); | 571 root_window->SetBounds(gfx::Rect(0, 0, 500, 500)); |
572 scoped_ptr<aura::Window> window(aura::test::CreateTestWindow( | 572 scoped_ptr<aura::Window> window(aura::test::CreateTestWindow( |
573 SK_ColorWHITE, -1, gfx::Rect(0, 0, 500, 500), NULL)); | 573 SK_ColorWHITE, -1, gfx::Rect(0, 0, 500, 500), NULL)); |
574 | 574 |
575 aura::shared::CompoundEventFilter* env_filter = | 575 aura::shared::CompoundEventFilter* env_filter = |
576 Shell::GetInstance()->env_filter(); | 576 Shell::GetInstance()->env_filter(); |
577 aura::CursorManager* cursor_manager = | 577 ash::CursorManager* cursor_manager = |
578 aura::Env::GetInstance()->cursor_manager(); | 578 ash::Shell::GetInstance()->cursor_manager(); |
579 | 579 |
580 aura::MouseEvent mouse_moved( | 580 aura::MouseEvent mouse_moved( |
581 ui::ET_MOUSE_MOVED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); | 581 ui::ET_MOUSE_MOVED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); |
582 aura::TouchEvent touch_pressed1( | 582 aura::TouchEvent touch_pressed1( |
583 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, getTime()); | 583 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, getTime()); |
584 aura::TouchEvent touch_pressed2( | 584 aura::TouchEvent touch_pressed2( |
585 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 1, getTime()); | 585 ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 1, getTime()); |
586 | 586 |
587 env_filter->set_update_cursor_visibility(true); | 587 env_filter->set_update_cursor_visibility(true); |
588 root_window->DispatchMouseEvent(&mouse_moved); | 588 root_window->DispatchMouseEvent(&mouse_moved); |
589 EXPECT_TRUE(cursor_manager->cursor_visible()); | 589 EXPECT_TRUE(cursor_manager->cursor_visible()); |
590 root_window->DispatchTouchEvent(&touch_pressed1); | 590 root_window->DispatchTouchEvent(&touch_pressed1); |
591 EXPECT_FALSE(cursor_manager->cursor_visible()); | 591 EXPECT_FALSE(cursor_manager->cursor_visible()); |
592 root_window->DispatchMouseEvent(&mouse_moved); | 592 root_window->DispatchMouseEvent(&mouse_moved); |
593 EXPECT_TRUE(cursor_manager->cursor_visible()); | 593 EXPECT_TRUE(cursor_manager->cursor_visible()); |
594 | 594 |
595 env_filter->set_update_cursor_visibility(false); | 595 env_filter->set_update_cursor_visibility(false); |
596 cursor_manager->ShowCursor(false); | 596 cursor_manager->ShowCursor(false); |
597 root_window->DispatchMouseEvent(&mouse_moved); | 597 root_window->DispatchMouseEvent(&mouse_moved); |
598 EXPECT_FALSE(cursor_manager->cursor_visible()); | 598 EXPECT_FALSE(cursor_manager->cursor_visible()); |
599 cursor_manager->ShowCursor(true); | 599 cursor_manager->ShowCursor(true); |
600 root_window->DispatchTouchEvent(&touch_pressed2); | 600 root_window->DispatchTouchEvent(&touch_pressed2); |
601 EXPECT_TRUE(cursor_manager->cursor_visible()); | 601 EXPECT_TRUE(cursor_manager->cursor_visible()); |
602 } | 602 } |
603 | 603 |
604 } // namespace ash | 604 } // namespace ash |
OLD | NEW |