1 # Copyright 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from telemetry.core import user_agent
6 from telemetry.unittest import tab_test_case
9 class MobileUserAgentTest(tab_test_case.TabTestCase):
11 def CustomizeBrowserOptions(cls, options):
12 options.browser_user_agent_type = 'mobile'
14 def testUserAgent(self):
15 ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
16 self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['mobile'])
18 class TabletUserAgentTest(tab_test_case.TabTestCase):
20 def CustomizeBrowserOptions(cls, options):
21 options.browser_user_agent_type = 'tablet'
23 def testUserAgent(self):
24 ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
25 self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['tablet'])
27 class DesktopUserAgentTest(tab_test_case.TabTestCase):
29 def CustomizeBrowserOptions(cls, options):
30 options.browser_user_agent_type = 'desktop'
32 def testUserAgent(self):
33 ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
34 self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['desktop'])