| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 400 |
| 401 // Test that the Escape key is handled as an exit fullscreen command while the | 401 // Test that the Escape key is handled as an exit fullscreen command while the |
| 402 // Flash widget has the focus. | 402 // Flash widget has the focus. |
| 403 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); | 403 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); |
| 404 PressEscape(); | 404 PressEscape(); |
| 405 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); | 405 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); |
| 406 } | 406 } |
| 407 | 407 |
| 408 // Tests that a fullscreen flash plugin can lock the mouse, and that it'll be | 408 // Tests that a fullscreen flash plugin can lock the mouse, and that it'll be |
| 409 // unlocked when the plugin exits fullscreen. | 409 // unlocked when the plugin exits fullscreen. |
| 410 // Flaky on Linux. See https://crbug.com/706148. |
| 411 #if defined(OS_LINUX) || defined(OS_CHROMEOS) |
| 412 #define MAYBE_Fullscreen_LockMouse DISABLED_Fullscreen_LockMouse |
| 413 #else |
| 414 #define MAYBE_Fullscreen_LockMouse Fullscreen_LockMouse |
| 415 #endif |
| 410 IN_PROC_BROWSER_TEST_F(FlashFullscreenInteractiveBrowserTest, | 416 IN_PROC_BROWSER_TEST_F(FlashFullscreenInteractiveBrowserTest, |
| 411 Fullscreen_LockMouse) { | 417 MAYBE_Fullscreen_LockMouse) { |
| 412 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 418 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 413 StartFakingTabCapture(); | 419 StartFakingTabCapture(); |
| 414 ASSERT_TRUE(LaunchFlashFullscreen()); | 420 ASSERT_TRUE(LaunchFlashFullscreen()); |
| 415 content::WebContents* web_contents = GetActiveWebContents(); | 421 content::WebContents* web_contents = GetActiveWebContents(); |
| 416 EXPECT_TRUE(ObserveFlashHasFocus(web_contents, true)); | 422 EXPECT_TRUE(ObserveFlashHasFocus(web_contents, true)); |
| 417 | 423 |
| 418 // Try to lock the mouse. | 424 // Try to lock the mouse. |
| 419 content::RenderWidgetHostView* fullscreen_view = | 425 content::RenderWidgetHostView* fullscreen_view = |
| 420 web_contents->GetFullscreenRenderWidgetHostView(); | 426 web_contents->GetFullscreenRenderWidgetHostView(); |
| 421 content::RenderWidgetHost* fullscreen_widget = | 427 content::RenderWidgetHost* fullscreen_widget = |
| 422 fullscreen_view->GetRenderWidgetHost(); | 428 fullscreen_view->GetRenderWidgetHost(); |
| 423 content::RenderProcessHost* process = fullscreen_widget->GetProcess(); | 429 content::RenderProcessHost* process = fullscreen_widget->GetProcess(); |
| 424 content::PwnMessageHelper::LockMouse( | 430 content::PwnMessageHelper::LockMouse( |
| 425 process, fullscreen_widget->GetRoutingID(), true, false, true); | 431 process, fullscreen_widget->GetRoutingID(), true, false, true); |
| 426 | 432 |
| 427 // Make sure that the fullscreen widget got the mouse lock. | 433 // Make sure that the fullscreen widget got the mouse lock. |
| 428 EXPECT_TRUE(fullscreen_view->IsMouseLocked()); | 434 EXPECT_TRUE(fullscreen_view->IsMouseLocked()); |
| 429 EXPECT_EQ(fullscreen_widget, content::GetMouseLockWidget(web_contents)); | 435 EXPECT_EQ(fullscreen_widget, content::GetMouseLockWidget(web_contents)); |
| 430 | 436 |
| 431 PressEscape(); | 437 PressEscape(); |
| 432 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); | 438 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); |
| 433 | 439 |
| 434 // Mouse should be unlocked. | 440 // Mouse should be unlocked. |
| 435 EXPECT_EQ(nullptr, content::GetMouseLockWidget(web_contents)); | 441 EXPECT_EQ(nullptr, content::GetMouseLockWidget(web_contents)); |
| 436 } | 442 } |
| OLD | NEW |