Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: tools/telemetry/telemetry/core/user_agent_unittest.py

Issue 640453002: Increase coverage of telemetry's user_agent_unittest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding myself to AUTHORS Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from telemetry.core import user_agent 5 from telemetry.core import user_agent
6 from telemetry.unittest import tab_test_case 6 from telemetry.unittest import tab_test_case
7 7
8 8
9 class UserAgentTest(tab_test_case.TabTestCase): 9 class MobileUserAgentTest(tab_test_case.TabTestCase):
10 @classmethod
11 def CustomizeBrowserOptions(cls, options):
12 options.browser_user_agent_type = 'mobile'
13
14 def testUserAgent(self):
15 ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
16 self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['mobile'])
17
18 class TabletUserAgentTest(tab_test_case.TabTestCase):
10 @classmethod 19 @classmethod
11 def CustomizeBrowserOptions(cls, options): 20 def CustomizeBrowserOptions(cls, options):
12 options.browser_user_agent_type = 'tablet' 21 options.browser_user_agent_type = 'tablet'
13 22
14 def testUserAgent(self): 23 def testUserAgent(self):
15 ua = self._tab.EvaluateJavaScript('window.navigator.userAgent') 24 ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
16 self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['tablet']) 25 self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['tablet'])
26
27 class DesktopUserAgentTest(tab_test_case.TabTestCase):
28 @classmethod
29 def CustomizeBrowserOptions(cls, options):
30 options.browser_user_agent_type = 'desktop'
31
32 def testUserAgent(self):
33 ua = self._tab.EvaluateJavaScript('window.navigator.userAgent')
34 self.assertEquals(ua, user_agent.UA_TYPE_MAPPING['desktop'])
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698