| 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..352ff1d7de397db78d82cc7d4c49e3caf1adc16c 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(self.IsFullscreenForTab))
|
| +
|
| def _AcceptFullscreenOrMouseLockRequest(self):
|
| """Helper function to accept fullscreen or mouse lock request."""
|
| self.AcceptCurrentFullscreenOrMouseLockRequest()
|
| @@ -173,6 +181,17 @@ 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'))
|
| + self._driver.find_element_by_id('lockMouse2').click()
|
| + self.assertTrue(
|
| + self.WaitUntil(self.IsMouseLockPermissionRequested))
|
| + self.AcceptCurrentFullscreenOrMouseLockRequest()
|
| + # Waits until lock_result gets 'success' or 'failure'.
|
| + return self._driver.execute_script('return lock_result')
|
| +
|
| def testPrefsForFullscreenAllowed(self):
|
| """Verify prefs when fullscreen is allowed."""
|
| self._LaunchFSAndExpectPrompt()
|
| @@ -375,6 +394,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
|
| + GoBack() to navigate to the previous google.html page.
|
| + """
|
| + self.NavigateToURL(self.GetHttpURLForDataPath('google', 'google.html'))
|
| + self._InitiateTabFullscreen()
|
| + self.GetBrowserWindow().GetTab().GoBack()
|
| + self.assertFalse(
|
| + 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.assertFalse(
|
| + 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
|
| + GoBack() 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.GetBrowserWindow().GetTab().GoBack()
|
| + self.assertFalse(
|
| + 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.assertFalse(
|
| + 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.
|
|
|
|
|