зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1287723 - Fix test_screenshot.py to properly wait for new chrome window to be loaded. r=automatedtester
MozReview-Commit-ID: KiFGbNdddJe --HG-- extra : rebase_source : 87ccbb02cdb45531efc7fe948c57c10e9e03b547
This commit is contained in:
Родитель
0b8cfd1d36
Коммит
faa2229a5e
|
@ -6,7 +6,6 @@ import base64
|
|||
import hashlib
|
||||
import imghdr
|
||||
import struct
|
||||
import time
|
||||
import urllib
|
||||
|
||||
from unittest import skip
|
||||
|
@ -87,16 +86,21 @@ class Chrome(ScreenCaptureTestCase):
|
|||
# <window> element, which does not exist for secondary windows.
|
||||
def test_secondary_windows(self):
|
||||
ss = self.marionette.screenshot()
|
||||
self.marionette.execute_script("""
|
||||
window.open('chrome://marionette/content/doesnotexist.xul',
|
||||
self.marionette.execute_async_script("""
|
||||
win = window.open('chrome://marionette/content/doesnotexist.xul',
|
||||
'foo',
|
||||
'chrome');
|
||||
|
||||
// Bug 1288339 - We don't wait for readyState to be complete yet
|
||||
waitForWindow = function() {
|
||||
if (win.document.readyState != 'complete') {
|
||||
win.setTimeout(this, 100);
|
||||
}
|
||||
|
||||
marionetteScriptFinished(true);
|
||||
}()
|
||||
""")
|
||||
self.marionette.switch_to_window("foo")
|
||||
# there can be a race between opening and registering the window
|
||||
# and switching to it. Waiting a tiny amount of time is enough not to
|
||||
# break anything.
|
||||
time.sleep(0.002)
|
||||
ss = self.marionette.screenshot()
|
||||
size = self.get_image_dimensions(ss)
|
||||
self.assert_png(ss)
|
||||
|
|
Загрузка…
Ссылка в новой задаче