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

Unified Diff: chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc

Issue 10567002: Mouse lock and fullscreen exit upon reload. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fullscreen added to test Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc
diff --git a/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc
index e21efb75cd5d0971f88e8a780eaa4befe195f94c..ef1ff8c86f8f405150fea1a710be3f658af01261 100644
--- a/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc
+++ b/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc
@@ -249,6 +249,8 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
ASSERT_FALSE(IsFullscreenPermissionRequested());
}
+// Tests mouse lock can be exited and re-entered by an application silently
+// with no UI distraction for users.
IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
MouseLockSilentAfterTargetUnlock) {
ASSERT_TRUE(test_server()->Start());
@@ -271,7 +273,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
ASSERT_TRUE(IsMouseLocked());
ASSERT_TRUE(IsFullscreenBubbleDisplayed());
- // Unlock the mouse from target, make sure it's unloacked
+ // Unlock the mouse from target, make sure it's unlocked.
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_U, false, false, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
@@ -279,7 +281,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
ASSERT_FALSE(IsMouseLocked());
ASSERT_FALSE(IsFullscreenBubbleDisplayed());
- // Lock mouse again, make sure it works with no bubble
+ // Lock mouse again, make sure it works with no bubble.
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_1, false, false, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
@@ -287,14 +289,14 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
ASSERT_TRUE(IsMouseLocked());
ASSERT_FALSE(IsFullscreenBubbleDisplayed());
- // Unlock the mouse again by target
+ // Unlock the mouse again by target.
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_U, false, false, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
content::NotificationService::AllSources()));
ASSERT_FALSE(IsMouseLocked());
- // Lock from target, not user gesture, make sure it works
+ // Lock from target, not user gesture, make sure it works.
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_D, false, false, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
@@ -302,14 +304,14 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
ASSERT_TRUE(IsMouseLocked());
ASSERT_FALSE(IsFullscreenBubbleDisplayed());
- // Unlock by escape
+ // Unlock by escape.
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_ESCAPE, false, false, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
content::NotificationService::AllSources()));
ASSERT_FALSE(IsMouseLocked());
- // Lock the mouse with a user gesture, make sure we see bubble again
+ // Lock the mouse with a user gesture, make sure we see bubble again.
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_1, false, false, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
@@ -318,3 +320,70 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
ASSERT_TRUE(IsMouseLocked());
}
+// Tests Mouse Lock and Fullscreen are exited upon reload.
+IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
+ ReloadExitsMouseLockAndFullscreen) {
+ ASSERT_TRUE(test_server()->Start());
+ ui_test_utils::NavigateToURL(browser(),
+ test_server()->GetURL(kFullscreenMouseLockHTML));
+
+ ASSERT_FALSE(IsMouseLockPermissionRequested());
+
+ // Request mouse lock.
+ ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
+ browser(), ui::VKEY_1, false, false, false, false,
+ chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
+ content::NotificationService::AllSources()));
+ ASSERT_TRUE(IsMouseLockPermissionRequested());
+
+ // Reload. Mouse lock request should be cleared.
+ {
+ MouseLockNotificationObserver mouselock_observer;
+ Reload();
+ mouselock_observer.Wait();
+ ASSERT_FALSE(IsMouseLockPermissionRequested());
+ }
+
+ // Request mouse lock.
+ ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
+ browser(), ui::VKEY_1, false, false, false, false,
+ chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
+ content::NotificationService::AllSources()));
+ ASSERT_TRUE(IsMouseLockPermissionRequested());
+
+ // Accept mouse lock.
+ AcceptCurrentFullscreenOrMouseLockRequest();
+ ASSERT_TRUE(IsMouseLocked());
+ ASSERT_TRUE(IsFullscreenBubbleDisplayed());
+
+ // Reload. Mouse should be unlocked.
+ {
+ MouseLockNotificationObserver mouselock_observer;
+ Reload();
+ mouselock_observer.Wait();
+ ASSERT_FALSE(IsMouseLocked());
+ }
+
+ // Request to lock the mouse and enter fullscreen.
+ {
+ FullscreenNotificationObserver fullscreen_observer;
+ ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
+ browser(), ui::VKEY_B, false, true, false, false,
+ chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
+ content::NotificationService::AllSources()));
+ fullscreen_observer.Wait();
+ }
+
+ // We are fullscreen.
+ ASSERT_TRUE(IsFullscreenForTabOrPending());
+
+ // Reload. Mouse should be unlocked and fullscreen exited.
+ {
+ FullscreenNotificationObserver fullscreen_observer;
+ Reload();
+ fullscreen_observer.Wait();
+ ASSERT_FALSE(IsMouseLocked());
+ ASSERT_FALSE(IsFullscreenForTabOrPending());
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698