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

Unified Diff: chrome/test/functional/fullscreen_mouselock.py

Issue 10443098: Add additional tests for mouse lock. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/fullscreen_mouselock.py
===================================================================
--- chrome/test/functional/fullscreen_mouselock.py (revision 139649)
+++ chrome/test/functional/fullscreen_mouselock.py (working copy)
@@ -164,14 +164,13 @@
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(
+ lambda: self.IsMouseLockPermissionRequested()))
Nirnimesh 2012/05/31 00:19:26 lambda: self.IsMouseLockPermissionRequested() -> s
dyu1 2012/05/31 01:09:16 Done.
self.AcceptCurrentFullscreenOrMouseLockRequest()
self.assertTrue(self.IsMouseLocked())
@@ -288,7 +287,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',
@@ -432,6 +430,43 @@
# 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 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.
+ """
Nirnimesh 2012/05/31 00:19:26 Comments should be comments, not strings
dyu1 2012/05/31 01:09:16 Done.
+ Manually move the mouse cursor on the page in tab 2. Shift+Tab into
Nirnimesh 2012/05/31 00:19:26 The entire string can be moved inside the raw_inpu
dyu1 2012/05/31 01:09:16 Done.
+ tab 1, click on lockMouse1() button, and move the mouse cursor on
+ the page in tab 1. Verify mouse movement is smooth.
+ """
+ raw_input()
Nirnimesh 2012/05/31 00:19:26 Put some instructions in the raw_input() here raw
dyu1 2012/05/31 01:09:16 Done.
+
+ def MouseLockLostOnReload(self):
+ """Verify mouse lock is lost on page reload by pressing F5 key."""
+ self.NavigateToURL(self.GetHttpURLForDataPath(
+ 'fullscreen_mouselock', 'fullscreen_mouselock.html'))
+ self._EnableMouseLockMode()
+ # Require manual intervention to send F5 key.
+ print "Press F5 key to reload page and exit mouse lock."
scheib 2012/05/30 23:27:33 Is it possible to use NavigateToURL to reproduce t
Nirnimesh 2012/05/31 00:19:26 print -> logging.info or better still use raw_inp
dyu1 2012/05/31 01:09:16 I used NavigateToURL on line 461. Is that what you
dyu1 2012/05/31 01:09:16 I can't use raw_input() here since when the mouse
+ time.sleep(5)
+ self.assertTrue(self.WaitUntil(lambda: not self.IsMouseLocked()),
+ msg='Mouse lock did not break when page is reloaded.')
+
+
if __name__ == '__main__':
pyauto_functional.Main()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698