| 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/shared/immersive_fullscreen_controller.h" | 5 #include "ash/shared/immersive_fullscreen_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_types.h" | 7 #include "ash/common/shelf/shelf_types.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 lock2.reset(controller()->GetRevealedLock( | 332 lock2.reset(controller()->GetRevealedLock( |
| 333 ImmersiveFullscreenController::ANIMATE_REVEAL_NO)); | 333 ImmersiveFullscreenController::ANIMATE_REVEAL_NO)); |
| 334 lock1.reset(); | 334 lock1.reset(); |
| 335 EXPECT_TRUE(controller()->IsRevealed()); | 335 EXPECT_TRUE(controller()->IsRevealed()); |
| 336 | 336 |
| 337 lock2.reset(); | 337 lock2.reset(); |
| 338 EXPECT_FALSE(controller()->IsRevealed()); | 338 EXPECT_FALSE(controller()->IsRevealed()); |
| 339 } | 339 } |
| 340 | 340 |
| 341 // Test mouse event processing for top-of-screen reveal triggering. | 341 // Test mouse event processing for top-of-screen reveal triggering. |
| 342 // TODO: ASan failure happens on ChromeOS (https://crbug.com/641828). | 342 TEST_F(ImmersiveFullscreenControllerTest, OnMouseEvent) { |
| 343 #if defined(OS_CHROMEOS) | |
| 344 #define MAYBE_OnMouseEvent DISABLED_OnMouseEvent | |
| 345 #else | |
| 346 #define MAYBE_OnMouseEvent OnMouseEvent | |
| 347 #endif | |
| 348 TEST_F(ImmersiveFullscreenControllerTest, MAYBE_OnMouseEvent) { | |
| 349 // Set up initial state. | 343 // Set up initial state. |
| 350 SetEnabled(true); | 344 SetEnabled(true); |
| 351 ASSERT_TRUE(controller()->IsEnabled()); | 345 ASSERT_TRUE(controller()->IsEnabled()); |
| 352 ASSERT_FALSE(controller()->IsRevealed()); | 346 ASSERT_FALSE(controller()->IsRevealed()); |
| 353 | 347 |
| 354 ui::test::EventGenerator& event_generator(GetEventGenerator()); | 348 ui::test::EventGenerator& event_generator(GetEventGenerator()); |
| 355 | 349 |
| 356 gfx::Rect top_container_bounds_in_screen = | 350 gfx::Rect top_container_bounds_in_screen = |
| 357 top_container()->GetBoundsInScreen(); | 351 top_container()->GetBoundsInScreen(); |
| 358 // A position along the top edge of TopContainerView in screen coordinates. | 352 // A position along the top edge of TopContainerView in screen coordinates. |
| 359 gfx::Point top_edge_pos(top_container_bounds_in_screen.x() + 100, | 353 gfx::Point top_edge_pos(top_container_bounds_in_screen.x() + 100, |
| 360 top_container_bounds_in_screen.y()); | 354 top_container_bounds_in_screen.y()); |
| 361 | 355 |
| 362 // Mouse wheel event does nothing. | 356 // Mouse wheel event does nothing. |
| 363 ui::MouseEvent wheel(ui::ET_MOUSEWHEEL, top_edge_pos, top_edge_pos, | 357 ui::MouseWheelEvent wheel(gfx::Vector2d(), top_edge_pos, top_edge_pos, |
| 364 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 358 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 365 event_generator.Dispatch(&wheel); | 359 event_generator.Dispatch(&wheel); |
| 366 EXPECT_FALSE(top_edge_hover_timer_running()); | 360 EXPECT_FALSE(top_edge_hover_timer_running()); |
| 367 | 361 |
| 368 // Move to top edge of screen starts hover timer running. We cannot use | 362 // Move to top edge of screen starts hover timer running. We cannot use |
| 369 // MoveMouse() because MoveMouse() stops the timer if it started running. | 363 // MoveMouse() because MoveMouse() stops the timer if it started running. |
| 370 event_generator.MoveMouseTo(top_edge_pos); | 364 event_generator.MoveMouseTo(top_edge_pos); |
| 371 EXPECT_TRUE(top_edge_hover_timer_running()); | 365 EXPECT_TRUE(top_edge_hover_timer_running()); |
| 372 EXPECT_EQ(top_edge_pos.x(), mouse_x_when_hit_top()); | 366 EXPECT_EQ(top_edge_pos.x(), mouse_x_when_hit_top()); |
| 373 | 367 |
| 374 // Moving |ImmersiveFullscreenControllerTest::kMouseRevealBoundsHeight| down | 368 // Moving |ImmersiveFullscreenControllerTest::kMouseRevealBoundsHeight| down |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 SetEnabled(true); | 1048 SetEnabled(true); |
| 1055 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1049 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1056 | 1050 |
| 1057 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1051 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
| 1058 SetEnabled(false); | 1052 SetEnabled(false); |
| 1059 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 1053 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 1060 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1054 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1061 } | 1055 } |
| 1062 | 1056 |
| 1063 } // namespase ash | 1057 } // namespase ash |
| OLD | NEW |