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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import logging 6 import logging
7 import os 7 import os
8 import re 8 import re
9 import shutil 9 import shutil
10 import time 10 import time
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 'fullscreen_mouselock', 'fullscreen_mouselock.html')) 136 'fullscreen_mouselock', 'fullscreen_mouselock.html'))
137 # Should not be in fullscreen mode during initial launch. 137 # Should not be in fullscreen mode during initial launch.
138 self.assertFalse(self.IsFullscreenForBrowser()) 138 self.assertFalse(self.IsFullscreenForBrowser())
139 self.assertFalse(self.IsFullscreenForTab()) 139 self.assertFalse(self.IsFullscreenForTab())
140 # Initiate browser fullscreen. 140 # Initiate browser fullscreen.
141 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN) 141 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN)
142 self.assertTrue(self.WaitUntil(self.IsFullscreenForBrowser)) 142 self.assertTrue(self.WaitUntil(self.IsFullscreenForBrowser))
143 self.assertTrue(self.WaitUntil(lambda: not self.IsFullscreenForTab())) 143 self.assertTrue(self.WaitUntil(lambda: not self.IsFullscreenForTab()))
144 self.assertTrue(self.WaitUntil(lambda: not self.IsMouseLocked())) 144 self.assertTrue(self.WaitUntil(lambda: not self.IsMouseLocked()))
145 145
146 def _InitiateTabFullscreen(self):
147 """Helper function that initiates tab fullscreen."""
148 self.NavigateToURL(self.GetHttpURLForDataPath(
149 'fullscreen_mouselock', 'fullscreen_mouselock.html'))
150 # Initiate tab fullscreen.
151 self._driver.find_element_by_id('enterFullscreen').click()
152 self.assertTrue(self.WaitUntil(lambda: self.IsFullscreenForTab()))
153
146 def _AcceptFullscreenOrMouseLockRequest(self): 154 def _AcceptFullscreenOrMouseLockRequest(self):
147 """Helper function to accept fullscreen or mouse lock request.""" 155 """Helper function to accept fullscreen or mouse lock request."""
148 self.AcceptCurrentFullscreenOrMouseLockRequest() 156 self.AcceptCurrentFullscreenOrMouseLockRequest()
149 self.assertTrue(self.WaitUntil( 157 self.assertTrue(self.WaitUntil(
150 lambda: not self.IsFullscreenBubbleDisplayingButtons())) 158 lambda: not self.IsFullscreenBubbleDisplayingButtons()))
151 159
152 def _EnableFullscreenAndMouseLockMode(self): 160 def _EnableFullscreenAndMouseLockMode(self):
153 """Helper function to enable fullscreen and mouse lock mode.""" 161 """Helper function to enable fullscreen and mouse lock mode."""
154 self._LaunchFSAndExpectPrompt(button_action='enterFullscreenAndLockMouse1') 162 self._LaunchFSAndExpectPrompt(button_action='enterFullscreenAndLockMouse1')
155 # Allow fullscreen. 163 # Allow fullscreen.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 """Verify mouse lock bubble goes away when tab loses focus.""" 376 """Verify mouse lock bubble goes away when tab loses focus."""
369 self.NavigateToURL(self.GetHttpURLForDataPath( 377 self.NavigateToURL(self.GetHttpURLForDataPath(
370 'fullscreen_mouselock', 'fullscreen_mouselock.html')) 378 'fullscreen_mouselock', 'fullscreen_mouselock.html'))
371 self._driver.find_element_by_id('lockMouse1').click() 379 self._driver.find_element_by_id('lockMouse1').click()
372 self.assertTrue(self.WaitUntil(self.IsMouseLockPermissionRequested)) 380 self.assertTrue(self.WaitUntil(self.IsMouseLockPermissionRequested))
373 self.AppendTab(pyauto.GURL('chrome://newtab')) 381 self.AppendTab(pyauto.GURL('chrome://newtab'))
374 self.assertTrue(self.WaitUntil( 382 self.assertTrue(self.WaitUntil(
375 lambda: not self.IsFullscreenBubbleDisplayingButtons()), 383 lambda: not self.IsFullscreenBubbleDisplayingButtons()),
376 msg='Mouse lock bubble did not clear when tab lost focus.') 384 msg='Mouse lock bubble did not clear when tab lost focus.')
377 385
386 def testTabFSExitUponNavigation(self):
scheib 2012/06/14 22:51:12 Perhaps clarify that this navigation is "navigatin
dyu1 2012/06/15 01:42:24 Done.
387 """Verify tab fullscreen exit when navigating to a new page."""
388 self.NavigateToURL(self.GetHttpURLForDataPath('google', 'google.html'))
389 self._InitiateTabFullscreen()
390 self._driver.find_element_by_id('goBack').click()
391 self.assertTrue(
392 self.WaitUntil(not self.IsFullscreenForTab),
393 msg='Tab fullscreen did not exist when navigating to a new page.')
scheib 2012/06/14 22:51:12 s/exist/exit/ -- in more than one place.
dyu1 2012/06/15 01:42:24 Done.
394
395 def testTabFSDontExitForAnchorLinks(self):
scheib 2012/06/14 22:51:12 s/Dont/DoesNot/
dyu1 2012/06/15 01:42:24 Done.
396 """Verify tab fullscreen does not exist for anchor links.
397
398 Tab fullscreen should not exist when following a link to the same page such
399 as example.html#anchor.
400 """
401 self._InitiateTabFullscreen()
402 self._driver.find_element_by_id('anchor').click()
403 self.assertTrue(
404 self.WaitUntil(self.IsFullscreenForTab),
405 msg='Tab fullscreen should not exit when clicking on an anchor link.')
406
378 def ExitTabFSToBrowserFS(self): 407 def ExitTabFSToBrowserFS(self):
379 """Verify exiting tab fullscreen leaves browser in browser fullscreen. 408 """Verify exiting tab fullscreen leaves browser in browser fullscreen.
380 409
381 This test is semi-automated. 410 This test is semi-automated.
382 411
383 The browser initiates browser fullscreen, then initiates tab fullscreen. The 412 The browser initiates browser fullscreen, then initiates tab fullscreen. The
384 test verifies that existing tab fullscreen by simulating ESC key press or 413 test verifies that existing tab fullscreen by simulating ESC key press or
385 clicking the js function to exitFullscreen() will exit the tab fullscreen 414 clicking the js function to exitFullscreen() will exit the tab fullscreen
386 leaving browser fullscreen intact. 415 leaving browser fullscreen intact.
387 """ 416 """
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 self.NavigateToURL(url2, 0, 1) 505 self.NavigateToURL(url2, 0, 1)
477 self._driver.switch_to_window(tab2) 506 self._driver.switch_to_window(tab2)
478 self._EnableMouseLockMode() # Lock mouse in tab 2. 507 self._EnableMouseLockMode() # Lock mouse in tab 2.
479 raw_input('Manually move the mouse cursor on the page in tab 2. Shift+Tab \ 508 raw_input('Manually move the mouse cursor on the page in tab 2. Shift+Tab \
480 into tab 1, click on lockMouse1() button, and move the mouse \ 509 into tab 1, click on lockMouse1() button, and move the mouse \
481 cursor on the page in tab 1. Verify mouse movement is smooth.') 510 cursor on the page in tab 1. Verify mouse movement is smooth.')
482 511
483 512
484 if __name__ == '__main__': 513 if __name__ == '__main__':
485 pyauto_functional.Main() 514 pyauto_functional.Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698