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

Side by Side Diff: telemetry/telemetry/internal/platform/android_device_unittest.py

Issue 2988563002: Fixed errors related to bad-continuation (Closed)
Patch Set: Removed pylintrc changes Created 3 years, 5 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import unittest 5 import unittest
6 6
7 from telemetry import decorators 7 from telemetry import decorators
8 from telemetry.internal.browser import browser_options 8 from telemetry.internal.browser import browser_options
9 from telemetry.internal.platform import android_device 9 from telemetry.internal.platform import android_device
10 from telemetry.internal.platform import remote_platform_options 10 from telemetry.internal.platform import remote_platform_options
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 self.assertEquals( 47 self.assertEquals(
48 set(['01', '02']), 48 set(['01', '02']),
49 set(device.device_id for device in 49 set(device.device_id for device in
50 android_device.AndroidDevice.GetAllConnectedDevices(None))) 50 android_device.AndroidDevice.GetAllConnectedDevices(None)))
51 51
52 @decorators.Enabled('android') 52 @decorators.Enabled('android')
53 def testNoAdbReturnsNone(self): 53 def testNoAdbReturnsNone(self):
54 finder_options = browser_options.BrowserFinderOptions() 54 finder_options = browser_options.BrowserFinderOptions()
55 with ( 55 with (
56 mock.patch('os.path.isabs', return_value=True)), ( 56 mock.patch('os.path.isabs', return_value=True)), (
57 mock.patch('os.path.exists', return_value=False)): 57 mock.patch('os.path.exists', return_value=False)):
58 self.assertEquals([], self._android_device_stub.logging.warnings) 58 self.assertEquals([], self._android_device_stub.logging.warnings)
59 self.assertIsNone(android_device.GetDevice(finder_options)) 59 self.assertIsNone(android_device.GetDevice(finder_options))
60 60
61 # https://github.com/catapult-project/catapult/issues/3099 (Android) 61 # https://github.com/catapult-project/catapult/issues/3099 (Android)
62 @decorators.Disabled('all') 62 @decorators.Disabled('all')
63 def testAdbNoDevicesReturnsNone(self): 63 def testAdbNoDevicesReturnsNone(self):
64 finder_options = browser_options.BrowserFinderOptions() 64 finder_options = browser_options.BrowserFinderOptions()
65 with mock.patch('os.path.isabs', return_value=False): 65 with mock.patch('os.path.isabs', return_value=False):
66 self._healthy_device_mock.return_value = [] 66 self._healthy_device_mock.return_value = []
67 self.assertEquals([], self._android_device_stub.logging.warnings) 67 self.assertEquals([], self._android_device_stub.logging.warnings)
68 self.assertIsNone(android_device.GetDevice(finder_options)) 68 self.assertIsNone(android_device.GetDevice(finder_options))
69 69
70 # https://github.com/catapult-project/catapult/issues/3099 (Android) 70 # https://github.com/catapult-project/catapult/issues/3099 (Android)
71 @decorators.Disabled('all') 71 @decorators.Disabled('all')
72 def testAdbTwoDevicesReturnsNone(self): 72 def testAdbTwoDevicesReturnsNone(self):
73 finder_options = browser_options.BrowserFinderOptions() 73 finder_options = browser_options.BrowserFinderOptions()
74 with mock.patch('os.path.isabs', return_value=False): 74 with mock.patch('os.path.isabs', return_value=False):
75 self._healthy_device_mock.return_value = [ 75 self._healthy_device_mock.return_value = [
76 self._GetMockDeviceUtils('015d14fec128220c'), 76 self._GetMockDeviceUtils('015d14fec128220c'),
77 self._GetMockDeviceUtils('015d14fec128220d')] 77 self._GetMockDeviceUtils('015d14fec128220d')]
78 device = android_device.GetDevice(finder_options) 78 device = android_device.GetDevice(finder_options)
79 self.assertEquals([ 79 self.assertEquals([
80 'Multiple devices attached. Please specify one of the following:\n' 80 'Multiple devices attached. Please specify one of the following:\n'
81 ' --device=015d14fec128220c\n' 81 ' --device=015d14fec128220c\n'
82 ' --device=015d14fec128220d'], 82 ' --device=015d14fec128220d'
83 self._android_device_stub.logging.warnings) 83 ], self._android_device_stub.logging.warnings)
84 self.assertIsNone(device) 84 self.assertIsNone(device)
85 85
86 @decorators.Enabled('android') 86 @decorators.Enabled('android')
87 def testAdbPickOneDeviceReturnsDeviceInstance(self): 87 def testAdbPickOneDeviceReturnsDeviceInstance(self):
88 finder_options = browser_options.BrowserFinderOptions() 88 finder_options = browser_options.BrowserFinderOptions()
89 platform_options = remote_platform_options.AndroidPlatformOptions( 89 platform_options = remote_platform_options.AndroidPlatformOptions(
90 device='555d14fecddddddd') # pick one 90 device='555d14fecddddddd') # pick one
91 finder_options.remote_platform_options = platform_options 91 finder_options.remote_platform_options = platform_options
92 with mock.patch('os.path.isabs', return_value=False): 92 with mock.patch('os.path.isabs', return_value=False):
93 self._healthy_device_mock.return_value = [ 93 self._healthy_device_mock.return_value = [
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 self._GetMockDeviceUtils('015d14fec128220c'), 143 self._GetMockDeviceUtils('015d14fec128220c'),
144 self._GetMockDeviceUtils('015d14fec128220d'), 144 self._GetMockDeviceUtils('015d14fec128220d'),
145 self._GetMockDeviceUtils('015d14fec128220e')] 145 self._GetMockDeviceUtils('015d14fec128220e')]
146 devices = android_device.FindAllAvailableDevices(finder_options) 146 devices = android_device.FindAllAvailableDevices(finder_options)
147 self.assertEquals([], self._android_device_stub.logging.warnings) 147 self.assertEquals([], self._android_device_stub.logging.warnings)
148 self.assertIsNotNone(devices) 148 self.assertIsNotNone(devices)
149 self.assertEquals(len(devices), 3) 149 self.assertEquals(len(devices), 3)
150 self.assertEquals(devices[0].guid, '015d14fec128220c') 150 self.assertEquals(devices[0].guid, '015d14fec128220c')
151 self.assertEquals(devices[1].guid, '015d14fec128220d') 151 self.assertEquals(devices[1].guid, '015d14fec128220d')
152 self.assertEquals(devices[2].guid, '015d14fec128220e') 152 self.assertEquals(devices[2].guid, '015d14fec128220e')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698