Index: chrome/test/functional/fullscreen_mouselock.py |
diff --git a/chrome/test/functional/fullscreen_mouselock.py b/chrome/test/functional/fullscreen_mouselock.py |
index beb6a4933dce9337ce62197959338429593f85dd..d3279a78de76a1a2e1055d2d966761cba11651eb 100755 |
--- a/chrome/test/functional/fullscreen_mouselock.py |
+++ b/chrome/test/functional/fullscreen_mouselock.py |
@@ -143,6 +143,14 @@ class FullscreenMouselockTest(pyauto.PyUITest): |
self.assertTrue(self.WaitUntil(lambda: not self.IsFullscreenForTab())) |
self.assertTrue(self.WaitUntil(lambda: not self.IsMouseLocked())) |
+ def _InitiateTabFullscreen(self): |
+ """Helper function that initiates tab fullscreen.""" |
+ self.NavigateToURL(self.GetHttpURLForDataPath( |
+ 'fullscreen_mouselock', 'fullscreen_mouselock.html')) |
+ # Initiate tab fullscreen. |
+ self._driver.find_element_by_id('enterFullscreen').click() |
+ self.assertTrue(self.WaitUntil(lambda: self.IsFullscreenForTab())) |
+ |
def _AcceptFullscreenOrMouseLockRequest(self): |
"""Helper function to accept fullscreen or mouse lock request.""" |
self.AcceptCurrentFullscreenOrMouseLockRequest() |
@@ -173,6 +181,18 @@ class FullscreenMouselockTest(pyauto.PyUITest): |
self.AcceptCurrentFullscreenOrMouseLockRequest() |
self.assertTrue(self.IsMouseLocked()) |
+ def _EnableAndReturnLockMouseResult(self): |
+ """Helper function to enable and return mouse lock result.""" |
+ self.NavigateToURL(self.GetHttpURLForDataPath( |
+ 'fullscreen_mouselock', 'fullscreen_mouselock.html')) |
+ lock_result = self._driver.find_element_by_id('lockMouse2').click() |
scheib
2012/06/18 16:26:24
Why is lock_result assigned here?
dyu1
2012/06/18 22:04:41
Done.
|
+ self.assertTrue( |
+ self.WaitUntil(lambda: self.IsMouseLockPermissionRequested())) |
Nirnimesh
2012/06/18 18:31:59
lambda: self.IsMouseLockPermissionRequested()
is
dyu1
2012/06/18 22:04:41
Done.
|
+ self.AcceptCurrentFullscreenOrMouseLockRequest() |
+ # Waits until lock_result gets 'success' or 'failure'. |
+ lock_result = self._driver.execute_script('return lock_result') |
+ return lock_result |
Nirnimesh
2012/06/18 18:31:59
merge with previous line
dyu1
2012/06/18 22:04:41
Done.
|
+ |
def testPrefsForFullscreenAllowed(self): |
"""Verify prefs when fullscreen is allowed.""" |
self._LaunchFSAndExpectPrompt() |
@@ -375,6 +395,80 @@ class FullscreenMouselockTest(pyauto.PyUITest): |
lambda: not self.IsFullscreenBubbleDisplayingButtons()), |
msg='Mouse lock bubble did not clear when tab lost focus.') |
+ def testTabFSExitWhenNavBackToPrevPage(self): |
+ """Verify tab fullscreen exit when navigating back to previous page. |
+ |
+ This test navigates to a new page while in tab fullscreen mode by using |
+ IDC_BACK to navigate to the previous google.html page. |
+ """ |
+ self.NavigateToURL(self.GetHttpURLForDataPath('google', 'google.html')) |
+ self._InitiateTabFullscreen() |
+ self.RunCommand(pyauto.IDC_BACK) |
+ self.assertTrue( |
+ not self.IsFullscreenForTab(), |
+ msg='Tab fullscreen did not exit when navigating to a new page.') |
+ |
+ def testTabFSExitWhenNavToNewPage(self): |
+ """Verify tab fullscreen exit when navigating to a new website. |
+ |
+ This test navigates to a new website while in tab fullscreen. |
+ """ |
+ self._InitiateTabFullscreen() |
+ self.NavigateToURL(self.GetHttpURLForDataPath('google', 'google.html')) |
+ self.assertTrue( |
+ not self.IsFullscreenForTab(), |
+ msg='Tab fullscreen did not exit when navigating to a new website.') |
+ |
+ def testTabFSDoesNotExitForAnchorLinks(self): |
+ """Verify tab fullscreen does not exit for anchor links. |
+ |
+ Tab fullscreen should not exit when following a link to the same page such |
+ as example.html#anchor. |
+ """ |
+ self._InitiateTabFullscreen() |
+ self._driver.find_element_by_id('anchor').click() |
+ self.assertTrue( |
+ self.WaitUntil(self.IsFullscreenForTab), |
+ msg='Tab fullscreen should not exit when clicking on an anchor link.') |
+ |
+ def testMLExitWhenNavBackToPrevPage(self): |
+ """Verify mouse lock exit when navigating back to previous page. |
+ |
+ This test navigates to a new page while mouse lock is activated by using |
+ IDC_BACK to navigate to the previous google.html page. |
+ """ |
+ self.NavigateToURL(self.GetHttpURLForDataPath('google', 'google.html')) |
+ lock_result = self._EnableAndReturnLockMouseResult() |
+ self.assertEqual( |
+ lock_result, 'success', msg='Mouse is not locked.') |
+ self.RunCommand(pyauto.IDC_BACK) |
+ self.assertTrue( |
+ not self.IsMouseLocked(), |
+ msg='Mouse lock did not exit when navigating to the prev page.') |
+ |
+ def testMLExitWhenNavToNewPage(self): |
+ """Verify mouse lock exit when navigating to a new website.""" |
+ lock_result = self._EnableAndReturnLockMouseResult() |
+ self.assertEqual( |
+ lock_result, 'success', msg='Mouse is not locked.') |
+ self.NavigateToURL(self.GetHttpURLForDataPath('google', 'google.html')) |
+ self.assertTrue( |
+ not self.IsMouseLocked(), |
+ msg='Mouse lock did not exit when navigating to a new website.') |
+ |
+ def testMLDoesNotExitForAnchorLinks(self): |
+ """Verify mouse lock does not exit for anchor links. |
+ |
+ Mouse lock should not exist when following a link to the same page such as |
+ example.html#anchor. |
+ """ |
+ lock_result = self._EnableAndReturnLockMouseResult() |
+ self.assertEqual( |
+ lock_result, 'success', msg='Mouse is not locked.') |
+ self._driver.execute_script('document.getElementById("anchor").click()') |
+ self.assertTrue(self.WaitUntil(self.IsMouseLocked), |
+ msg='Mouse lock broke when clicking on an anchor link.') |
+ |
def ExitTabFSToBrowserFS(self): |
"""Verify exiting tab fullscreen leaves browser in browser fullscreen. |