Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #16902 from zacc/bug_979843
Browse files Browse the repository at this point in the history
Bug 979843 - Try run removing redundant switch_to_frame code in gaiatest...
  • Loading branch information
bebef1987 committed Mar 5, 2014
2 parents 3b84e00 + 7824ca8 commit f43d1f3
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions tests/python/gaia-ui-tests/gaiatest/gaia_test.py
Expand Up @@ -77,7 +77,7 @@ def set_permission(self, app_name, permission_name, value):
return self.marionette.execute_async_script("return GaiaApps.setPermission('%s', '%s', '%s')" %
(app_name, permission_name, value))

def launch(self, name, switch_to_frame=True, url=None, launch_timeout=None):
def launch(self, name, switch_to_frame=True, launch_timeout=None):
self.marionette.switch_to_frame()
result = self.marionette.execute_async_script("GaiaApps.launchWithName('%s')" % name, script_timeout=launch_timeout)
assert result, "Failed to launch app with name '%s'" % name
Expand All @@ -88,7 +88,7 @@ def launch(self, name, switch_to_frame=True, url=None, launch_timeout=None):
if app.frame_id is None:
raise Exception("App failed to launch; there is no app frame")
if switch_to_frame:
self.switch_to_frame(app.frame_id, url)
self.marionette.switch_to_frame(app.frame_id)
return app

@property
Expand Down Expand Up @@ -152,22 +152,6 @@ def running_apps(self):
result.append(GaiaApp(origin=app['origin'], name=app['name']))
return result

def switch_to_frame(self, app_frame, url=None, timeout=None):
timeout = timeout or (self.marionette.timeout and self.marionette.timeout / 1000) or 30
self.marionette.switch_to_frame(app_frame)
start = time.time()
if not url:
def check(now):
return "about:blank" not in now
else:
def check(now):
return url in now
while (time.time() - start < timeout):
if check(self.marionette.get_url()):
return
time.sleep(2)
raise TimeoutException('Could not switch to app frame %s in time' % app_frame)


class GaiaData(object):

Expand Down

0 comments on commit f43d1f3

Please sign in to comment.