diff options
author | frankf@chromium.org <frankf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-12 01:08:41 +0000 |
---|---|---|
committer | frankf@chromium.org <frankf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-12 01:08:41 +0000 |
commit | 21a72e5e55467ce93d92dbdc5e3a5352763f394c (patch) | |
tree | 2a7c7894e8962456c4cef0e0411a8853be3c08eb /chrome/test | |
parent | 37a8c7115ccc04291be1283b0266fd0ec63ad0f0 (diff) | |
download | chromium_src-21a72e5e55467ce93d92dbdc5e3a5352763f394c.zip chromium_src-21a72e5e55467ce93d92dbdc5e3a5352763f394c.tar.gz chromium_src-21a72e5e55467ce93d92dbdc5e3a5352763f394c.tar.bz2 |
[chromedriver] Add a python test for checking that latest android app is installed.
BUG=None
R=craigdh@chromium.org
Review URL: https://codereview.chromium.org/67483002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/chromedriver/client/chromedriver.py | 5 | ||||
-rwxr-xr-x | chrome/test/chromedriver/test/run_py_tests.py | 27 |
2 files changed, 29 insertions, 3 deletions
diff --git a/chrome/test/chromedriver/client/chromedriver.py b/chrome/test/chromedriver/client/chromedriver.py index 9ccbe15..8f84d0b 100644 --- a/chrome/test/chromedriver/client/chromedriver.py +++ b/chrome/test/chromedriver/client/chromedriver.py @@ -106,8 +106,9 @@ class ChromeDriver(object): } } - self._session_id = self._ExecuteCommand( - Command.NEW_SESSION, params)['sessionId'] + response = self._ExecuteCommand(Command.NEW_SESSION, params) + self._session_id = response['sessionId'] + self.capabilities = self._UnwrapValue(response['value']) def _WrapValue(self, value): """Wrap value from client side for chromedriver side.""" diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index fc2756f..736e109 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py @@ -6,6 +6,7 @@ """End to end tests for ChromeDriver.""" import base64 +import json import optparse import subprocess import os @@ -15,6 +16,7 @@ import tempfile import threading import time import unittest +import urllib2 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(1, os.path.join(_THIS_DIR, os.pardir)) @@ -79,12 +81,13 @@ _DESKTOP_NEGATIVE_FILTER = [ 'ChromeDriverTest.testSingleTapElement', 'ChromeDriverTest.testTouchDownUpElement', 'ChromeDriverTest.testTouchMovedElement', + 'ChromeDriverTest.testLatestAndroidAppInstalled', ] def _GetDesktopNegativeFilter(version_name): filter = _NEGATIVE_FILTER + _DESKTOP_NEGATIVE_FILTER - os = util.GetPlatformName(); + os = util.GetPlatformName() if os in _OS_SPECIFIC_FILTER: filter += _OS_SPECIFIC_FILTER[os] if version_name in _VERSION_SPECIFIC_FILTER: @@ -656,6 +659,28 @@ class ChromeDriverTest(ChromeDriverBaseTest): def testDoesntHangOnDebugger(self): self._driver.ExecuteScript('debugger;') + def testLatestAndroidAppInstalled(self): + assert _ANDROID_PACKAGE_KEY + if ('stable' not in _ANDROID_PACKAGE_KEY and + 'beta' not in _ANDROID_PACKAGE_KEY): + return + + try: + omaha_list = json.loads( + urllib2.urlopen('http://omahaproxy.appspot.com/all.json').read()) + for l in omaha_list: + if l['os'] != 'android': + continue + for v in l['versions']: + if (('stable' in v['channel'] and 'stable' in _ANDROID_PACKAGE_KEY) or + ('beta' in v['channel'] and 'beta' in _ANDROID_PACKAGE_KEY)): + self.assertEquals(v['version'], + self._driver.capabilities['version']) + return + raise RuntimeError('Malformed omaha JSON') + except urllib2.URLError as e: + print 'Unable to fetch current version info from omahaproxy (%s)' % e + class ChromeSwitchesCapabilityTest(ChromeDriverBaseTest): """Tests that chromedriver properly processes chromeOptions.args capabilities. |