summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordaniimms <daniimms@amazon.com>2014-10-20 15:08:46 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-20 22:09:55 +0000
commit63f233bcd3a8a6d7f3cfb5183b62160c96ded98e (patch)
tree15eb24ea88c9bf3a26d3650ba6cfd4801b2dbf46
parent7dc97b1cb620f2aba3be293af5019832d9bc00b7 (diff)
downloadchromium_src-63f233bcd3a8a6d7f3cfb5183b62160c96ded98e.zip
chromium_src-63f233bcd3a8a6d7f3cfb5183b62160c96ded98e.tar.gz
chromium_src-63f233bcd3a8a6d7f3cfb5183b62160c96ded98e.tar.bz2
Increase coverage of telemetry's user_agent_unittest
Added a mobile and desktop testing in case the browser being tested has a user agent that defaults to the tablet user agent. BUG=421229 Review URL: https://codereview.chromium.org/640453002 Cr-Commit-Position: refs/heads/master@{#300349}
-rw-r--r--AUTHORS1
-rw-r--r--tools/telemetry/telemetry/core/user_agent_unittest.py20
2 files changed, 20 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index a6a5491..a61c7a6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -96,6 +96,7 @@ Craig Schlenter <craig.schlenter@gmail.com>
Daegyu Lee <na7jun8gi@gmail.com>
Dai Chunyang <chunyang.dai@intel.com>
Daniel Bomar <dbdaniel42@gmail.com>
+Daniel Imms <daniimms@amazon.com>
Daniel Johnson <danielj41@gmail.com>
Daniel Nishi <dhnishi@gmail.com>
Daniel Shaulov <dshaulov@ptc.com>
diff --git a/tools/telemetry/telemetry/core/user_agent_unittest.py b/tools/telemetry/telemetry/core/user_agent_unittest.py
index 1b50fb2..242ef76 100644
--- a/tools/telemetry/telemetry/core/user_agent_unittest.py
+++ b/tools/telemetry/telemetry/core/user_agent_unittest.py
@@ -6,7 +6,16 @@ from telemetry.core import user_agent
from telemetry.unittest import tab_test_case
-class UserAgentTest(tab_test_case.TabTestCase):
+class MobileUserAgentTest(tab_test_case.TabTestCase):
+ @classmethod
+ def CustomizeBrowserOptions(cls, options):
+ options.browser_user_agent_type = 'mobile'
+
+ def testUserAgent(self):
+ ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
+ self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['mobile'])
+
+class TabletUserAgentTest(tab_test_case.TabTestCase):
@classmethod
def CustomizeBrowserOptions(cls, options):
options.browser_user_agent_type = 'tablet'
@@ -14,3 +23,12 @@ class UserAgentTest(tab_test_case.TabTestCase):
def testUserAgent(self):
ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['tablet'])
+
+class DesktopUserAgentTest(tab_test_case.TabTestCase):
+ @classmethod
+ def CustomizeBrowserOptions(cls, options):
+ options.browser_user_agent_type = 'desktop'
+
+ def testUserAgent(self):
+ ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
+ self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['desktop'])