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

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

Issue 10535173: Add three fullscreen tests and three mouse lock tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/test/functional/fullscreen_mouselock.py
diff --git a/chrome/test/functional/fullscreen_mouselock.py b/chrome/test/functional/fullscreen_mouselock.py
index beb6a4933dce9337ce62197959338429593f85dd..02c294545054b28a5f119f448147820c70b4463d 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()
@@ -375,6 +383,63 @@ class FullscreenMouselockTest(pyauto.PyUITest):
lambda: not self.IsFullscreenBubbleDisplayingButtons()),
msg='Mouse lock bubble did not clear when tab lost focus.')
+ def testTabFSExitUponNavigation(self):
+ """Verify tab fullscreen exit when navigating to a new page.
+
+ This test navigates to a new page while in tab fullscreen mode by clicking
+ on the js Navigate Back button to navigate backwards to the previous
+ google.html page.
+ """
+ self.NavigateToURL(self.GetHttpURLForDataPath('google', 'google.html'))
+ self._InitiateTabFullscreen()
+ self._driver.find_element_by_id('goBack').click()
Nirnimesh 2012/06/15 05:40:15 use pyauto calls instead of going back from js.
dyu1 2012/06/16 23:24:21 Done.
+ self.assertTrue(
+ self.WaitUntil(lambda: not self.IsFullscreenForTab),
Nirnimesh 2012/06/15 05:40:15 Is IsFullscreenForTab missing ()?
Nirnimesh 2012/06/15 05:40:15 Is WaitUntil really required?
dyu1 2012/06/16 23:24:21 Done.
dyu1 2012/06/16 23:24:21 Done.
+ 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(
+ self.WaitUntil(lambda: not self.IsFullscreenForTab),
Nirnimesh 2012/06/15 05:40:15 is the waitUntil really required?
dyu1 2012/06/16 23:24:21 Done.
+ 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(
scheib 2012/06/15 16:49:00 Some delay is needed here. Can we detect and wait
dyu1 2012/06/16 23:24:21 Researching how to go about doing this. On 2012/0
dyu1 2012/06/27 22:48:44 I ran into two issues with the anchor link. Someti
+ self.WaitUntil(self.IsFullscreenForTab),
+ msg='Tab fullscreen should not exit when clicking on an anchor link.')
+
+ 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.
+ """
+ self.NavigateToURL(self.GetHttpURLForDataPath(
+ 'fullscreen_mouselock', 'fullscreen_mouselock.html'))
+ lock_result = self._driver.find_element_by_id('lockMouse2').click()
+ self.assertTrue(
+ self.WaitUntil(lambda: 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', 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.

Powered by Google App Engine
This is Rietveld 408576698