Index: chrome/test/functional/fullscreen_mouselock.py |
=================================================================== |
--- chrome/test/functional/fullscreen_mouselock.py (revision 139817) |
+++ chrome/test/functional/fullscreen_mouselock.py (working copy) |
@@ -164,14 +164,12 @@ |
def _EnableMouseLockMode(self, button_action='lockMouse1'): |
"""Helper function to enable mouse lock mode. |
- For now, to lock the mouse, the browser needs to be in fullscreen mode. |
- |
Args: |
button_action: The button id to click to initiate an action. Default is to |
click lockMouse1. |
""" |
self._driver.find_element_by_id(button_action).click() |
- self.assertTrue(self.IsMouseLockPermissionRequested()) |
+ self.assertTrue(self.WaitUntil(self.IsMouseLockPermissionRequested)) |
self.AcceptCurrentFullscreenOrMouseLockRequest() |
self.assertTrue(self.IsMouseLocked()) |
@@ -288,7 +286,6 @@ |
# Bubble should display prompting to allow mouselock. |
self.assertTrue(self.WaitUntil(self.IsMouseLockPermissionRequested)) |
self.AcceptCurrentFullscreenOrMouseLockRequest() |
- |
# Waits until lock_result gets 'success' or 'failure'. |
lock_result = self._driver.execute_script('return lock_result') |
self.assertEqual(lock_result, 'success', |
@@ -358,9 +355,20 @@ |
self.assertTrue(self.WaitUntil(lambda: not self.IsMouseLocked()), |
msg='Mouse lock did not break when browser lost focus.') |
+ def testMouseLockLostOnReload(self): |
+ """Verify mouse lock is lost on page reload.""" |
+ self.NavigateToURL(self.GetHttpURLForDataPath( |
+ 'fullscreen_mouselock', 'fullscreen_mouselock.html')) |
+ self._EnableMouseLockMode() |
+ self.ReloadActiveTab() |
+ self.assertTrue(self.WaitUntil(lambda: not self.IsMouseLocked()), |
+ msg='Mouse lock did not break when page is reloaded.') |
+ |
def ExitTabFSToBrowserFS(self): |
"""Verify exiting tab fullscreen leaves browser in browser fullscreen. |
+ This test is semi-automated. |
+ |
The browser initiates browser fullscreen, then initiates tab fullscreen. The |
test verifies that existing tab fullscreen by simulating ESC key press or |
clicking the js function to exitFullscreen() will exit the tab fullscreen |
@@ -372,7 +380,7 @@ |
self.assertTrue(self.WaitUntil(lambda: self.IsFullscreenForTab())) |
# Require manual intervention to send ESC key due to crbug.com/123930. |
# TODO(dyu): Update to a full test once associated bug is fixed. |
- print "Press ESC key to exit tab fullscreen." |
+ logging.info('Press ESC key to exit tab fullscreen.') |
time.sleep(5) |
self.assertTrue(self.WaitUntil(lambda: not self.IsFullscreenForTab())) |
self.assertTrue(self.WaitUntil(lambda: self.IsFullscreenForBrowser()), |
@@ -389,6 +397,8 @@ |
def F11KeyExitsTabAndBrowserFS(self): |
"""Verify existing tab fullscreen exits all fullscreen modes. |
+ This test is semi-automated. |
+ |
The browser initiates browser fullscreen, then initiates tab fullscreen. The |
test verifies that existing tab fullscreen by simulating F11 key press or |
CMD + SHIFT + F keys on the Mac will exit the tab fullscreen and the |
@@ -400,7 +410,7 @@ |
self.assertTrue(self.WaitUntil(lambda: self.IsFullscreenForTab())) |
# Require manual intervention to send F11 key due to crbug.com/123930. |
# TODO(dyu): Update to a full test once associated bug is fixed. |
- print "Press F11 key to exit tab fullscreen." |
+ logging.info('Press F11 key to exit tab fullscreen.') |
time.sleep(5) |
self.assertTrue(self.WaitUntil(lambda: not self.IsFullscreenForTab())) |
self.assertTrue(self.WaitUntil(lambda: not self.IsFullscreenForBrowser()), |
@@ -409,6 +419,8 @@ |
def SearchForTextOutsideOfContainer(self): |
"""Verify text outside of container is not visible when fullscreen. |
+ This test is semi-automated. |
+ |
Verify this test manually until there is a way to find text on screen |
without using FindInPage(). |
@@ -432,6 +444,31 @@ |
# TODO(dyu): find a way to verify on screen text instead of using |
# FindInPage() which searches for text in the HTML. |
+ def SameMouseLockMovement(self): |
+ """Verify the correct feel of mouse movement data when mouse is locked. |
+ This test is semi-automated. |
+ |
+ This test loads the same web page in two different tabs while in mouse lock |
+ mode. Each tab loads the web page from a different URL (e.g. by loading it |
+ from a localhost server and a file url). The test verifies |
+ that the mouse lock movements work the same in both |
+ tabs. |
+ """ |
+ url1 = self.GetHttpURLForDataPath( |
+ 'fullscreen_mouselock', 'fullscreen_mouselock.html') |
+ url2 = self.GetFileURLForDataPath( |
+ 'fullscreen_mouselock', 'fullscreen_mouselock.html') |
+ tab2 = 'f1-4' |
+ self.NavigateToURL(url1) |
+ self.RunCommand(pyauto.IDC_NEW_TAB) # Open new tab. |
+ self.NavigateToURL(url2, 0, 1) |
+ self._driver.switch_to_window(tab2) |
+ self._EnableMouseLockMode() # Lock mouse in tab 2. |
+ raw_input('Manually move the mouse cursor on the page in tab 2. Shift+Tab \ |
+ into tab 1, click on lockMouse1() button, and move the mouse \ |
+ cursor on the page in tab 1. Verify mouse movement is smooth.') |
+ |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |