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

Side by Side Diff: mojo/devtools/common/devtoolslib/android_shell_unittest.py

Issue 1381863004: Fix mojo_ tools on the first run after adb kill-server. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address Ben's comments. Created 5 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 | « mojo/devtools/common/devtoolslib/android_shell.py ('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
(Empty)
1 # Copyright 2015 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.
4
5 """Tests for the Android shell abstraction."""
6
7 import imp
8 import os.path
9 import sys
10 import unittest
11
12 try:
13 imp.find_module("devtoolslib")
14 except ImportError:
15 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
16
17 from devtoolslib.android_shell import parse_adb_devices_output
18
19 class AndroidShellTest(unittest.TestCase):
20 """Tests the Android shell abstraction."""
21
22 def test_parse_adb_devices_output(self):
23 """Tests parsing of the `adb devices` output."""
24 one_device_output = """\
25 List of devices attached
26 42424242 device
27
28 """
29 results = parse_adb_devices_output(one_device_output)
30 self.assertEquals(1, len(results))
31 self.assertTrue('42424242' in results)
32 self.assertEquals('device', results['42424242'])
33
34 multi_devices_output = """\
35 List of devices attached
36 42424242 device
37 42424243 offline
38 42424244 device
39
40 """
41 results = parse_adb_devices_output(multi_devices_output)
42 self.assertEquals(3, len(results))
43 self.assertTrue('42424242' in results)
44 self.assertEquals('device', results['42424242'])
45 self.assertTrue('42424243' in results)
46 self.assertEquals('offline', results['42424243'])
47 self.assertTrue('42424244' in results)
48 self.assertEquals('device', results['42424244'])
49
50 # Output produced when adb server needs to be started.
51 adb_server_startup_output = """\
52 * daemon not running. starting it now on port 5037 *
53 * daemon started successfully *
54 List of devices attached
55 42424242 device
56
57 """
58 results = parse_adb_devices_output(adb_server_startup_output)
59 self.assertEquals(1, len(results))
60 self.assertTrue('42424242' in results)
61 self.assertEquals('device', results['42424242'])
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/android_shell.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698