| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/immersive_fullscreen_controller.h" | 5 #include "ash/wm/immersive_fullscreen_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/display/mouse_cursor_event_filter.h" | 8 #include "ash/display/mouse_cursor_event_filter.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 ui::test::EventGenerator& event_generator(GetEventGenerator()); | 350 ui::test::EventGenerator& event_generator(GetEventGenerator()); |
| 351 | 351 |
| 352 gfx::Rect top_container_bounds_in_screen = | 352 gfx::Rect top_container_bounds_in_screen = |
| 353 top_container()->GetBoundsInScreen(); | 353 top_container()->GetBoundsInScreen(); |
| 354 // A position along the top edge of TopContainerView in screen coordinates. | 354 // A position along the top edge of TopContainerView in screen coordinates. |
| 355 gfx::Point top_edge_pos(top_container_bounds_in_screen.x() + 100, | 355 gfx::Point top_edge_pos(top_container_bounds_in_screen.x() + 100, |
| 356 top_container_bounds_in_screen.y()); | 356 top_container_bounds_in_screen.y()); |
| 357 | 357 |
| 358 // Mouse wheel event does nothing. | 358 // Mouse wheel event does nothing. |
| 359 ui::MouseEvent wheel(ui::ET_MOUSEWHEEL, top_edge_pos, top_edge_pos, | 359 ui::MouseEvent wheel(ui::ET_MOUSEWHEEL, gfx::PointF(top_edge_pos), |
| 360 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 360 gfx::PointF(top_edge_pos), ui::EventTimeForNow(), |
| 361 ui::EF_NONE, ui::EF_NONE); |
| 361 event_generator.Dispatch(&wheel); | 362 event_generator.Dispatch(&wheel); |
| 362 EXPECT_FALSE(top_edge_hover_timer_running()); | 363 EXPECT_FALSE(top_edge_hover_timer_running()); |
| 363 | 364 |
| 364 // Move to top edge of screen starts hover timer running. We cannot use | 365 // Move to top edge of screen starts hover timer running. We cannot use |
| 365 // MoveMouse() because MoveMouse() stops the timer if it started running. | 366 // MoveMouse() because MoveMouse() stops the timer if it started running. |
| 366 event_generator.MoveMouseTo(top_edge_pos); | 367 event_generator.MoveMouseTo(top_edge_pos); |
| 367 EXPECT_TRUE(top_edge_hover_timer_running()); | 368 EXPECT_TRUE(top_edge_hover_timer_running()); |
| 368 EXPECT_EQ(top_edge_pos.x(), mouse_x_when_hit_top()); | 369 EXPECT_EQ(top_edge_pos.x(), mouse_x_when_hit_top()); |
| 369 | 370 |
| 370 // Moving |ImmersiveFullscreenControllerTest::kMouseRevealBoundsHeight| down | 371 // Moving |ImmersiveFullscreenControllerTest::kMouseRevealBoundsHeight| down |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 scoped_ptr<aura::Window> behind(CreateTestWindowInShellWithDelegate( | 749 scoped_ptr<aura::Window> behind(CreateTestWindowInShellWithDelegate( |
| 749 &child_delegate, 1234, window_bounds)); | 750 &child_delegate, 1234, window_bounds)); |
| 750 behind->Show(); | 751 behind->Show(); |
| 751 behind->SetBounds(window_bounds); | 752 behind->SetBounds(window_bounds); |
| 752 widget()->StackAbove(behind.get()); | 753 widget()->StackAbove(behind.get()); |
| 753 | 754 |
| 754 // Make sure the windows are aligned on top. | 755 // Make sure the windows are aligned on top. |
| 755 EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y()); | 756 EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y()); |
| 756 int top = behind->GetBoundsInScreen().y(); | 757 int top = behind->GetBoundsInScreen().y(); |
| 757 | 758 |
| 758 ui::TouchEvent touch(ui::ET_TOUCH_MOVED, gfx::Point(10, top), 0, | 759 ui::TouchEvent touch(ui::ET_TOUCH_MOVED, gfx::PointF(10.f, top), 0, |
| 759 ui::EventTimeForNow()); | 760 ui::EventTimeForNow()); |
| 760 ui::EventTarget* root = window()->GetRootWindow(); | 761 ui::EventTarget* root = window()->GetRootWindow(); |
| 761 ui::EventTargeter* targeter = root->GetEventTargeter(); | 762 ui::EventTargeter* targeter = root->GetEventTargeter(); |
| 762 EXPECT_EQ(window(), targeter->FindTargetForEvent(root, &touch)); | 763 EXPECT_EQ(window(), targeter->FindTargetForEvent(root, &touch)); |
| 763 | 764 |
| 764 SetEnabled(true); | 765 SetEnabled(true); |
| 765 EXPECT_FALSE(controller()->IsRevealed()); | 766 EXPECT_FALSE(controller()->IsRevealed()); |
| 766 // Make sure the windows are still aligned on top. | 767 // Make sure the windows are still aligned on top. |
| 767 EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y()); | 768 EXPECT_EQ(behind->GetBoundsInScreen().y(), window()->GetBoundsInScreen().y()); |
| 768 top = behind->GetBoundsInScreen().y(); | 769 top = behind->GetBoundsInScreen().y(); |
| 769 ui::TouchEvent touch2(ui::ET_TOUCH_MOVED, gfx::Point(10, top), 0, | 770 ui::TouchEvent touch2(ui::ET_TOUCH_MOVED, gfx::PointF(10.f, top), 0, |
| 770 ui::EventTimeForNow()); | 771 ui::EventTimeForNow()); |
| 771 // The event should still be targeted to window(). | 772 // The event should still be targeted to window(). |
| 772 EXPECT_EQ(window(), targeter->FindTargetForEvent(root, &touch2)); | 773 EXPECT_EQ(window(), targeter->FindTargetForEvent(root, &touch2)); |
| 773 } | 774 } |
| 774 | 775 |
| 775 // Check that the window state gets properly marked for immersive fullscreen. | 776 // Check that the window state gets properly marked for immersive fullscreen. |
| 776 TEST_F(ImmersiveFullscreenControllerTest, WindowStateImmersiveFullscreen) { | 777 TEST_F(ImmersiveFullscreenControllerTest, WindowStateImmersiveFullscreen) { |
| 777 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window()); | 778 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window()); |
| 778 | 779 |
| 779 EXPECT_FALSE(window_state->in_immersive_fullscreen()); | 780 EXPECT_FALSE(window_state->in_immersive_fullscreen()); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1061 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| 1061 | 1062 |
| 1062 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1063 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
| 1063 SetEnabled(false); | 1064 SetEnabled(false); |
| 1064 window()->SetProperty(aura::client::kShowStateKey, | 1065 window()->SetProperty(aura::client::kShowStateKey, |
| 1065 ui::SHOW_STATE_NORMAL); | 1066 ui::SHOW_STATE_NORMAL); |
| 1066 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1067 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| 1067 } | 1068 } |
| 1068 | 1069 |
| 1069 } // namespase ash | 1070 } // namespase ash |
| OLD | NEW |