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

Side by Side Diff: build/android/pylib/device/adb_wrapper_test.py

Issue 783543003: Update from https://crrev.com/306901 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Tests for the AdbWrapper class.""" 5 """Tests for the AdbWrapper class."""
6 6
7 import os 7 import os
8 import tempfile 8 import tempfile
9 import time 9 import time
10 import unittest 10 import unittest
(...skipping 26 matching lines...) Expand all
37 return path 37 return path
38 38
39 def testShell(self): 39 def testShell(self):
40 output = self._adb.Shell('echo test', expect_status=0) 40 output = self._adb.Shell('echo test', expect_status=0)
41 self.assertEqual(output.strip(), 'test') 41 self.assertEqual(output.strip(), 'test')
42 output = self._adb.Shell('echo test') 42 output = self._adb.Shell('echo test')
43 self.assertEqual(output.strip(), 'test') 43 self.assertEqual(output.strip(), 'test')
44 with self.assertRaises(device_errors.AdbCommandFailedError): 44 with self.assertRaises(device_errors.AdbCommandFailedError):
45 self._adb.Shell('echo test', expect_status=1) 45 self._adb.Shell('echo test', expect_status=1)
46 46
47 def testPushPull(self): 47 def testPushLsPull(self):
48 path = self._MakeTempFile('foo') 48 path = self._MakeTempFile('foo')
49 device_path = '/data/local/tmp/testfile.txt' 49 device_path = '/data/local/tmp/testfile.txt'
50 local_tmpdir = os.path.dirname(path) 50 local_tmpdir = os.path.dirname(path)
51 self._adb.Push(path, device_path) 51 self._adb.Push(path, device_path)
52 files = dict(self._adb.Ls('/data/local/tmp'))
53 self.assertTrue('testfile.txt' in files)
54 self.assertEquals(3, files['testfile.txt'].st_size)
52 self.assertEqual(self._adb.Shell('cat %s' % device_path), 'foo') 55 self.assertEqual(self._adb.Shell('cat %s' % device_path), 'foo')
53 self._adb.Pull(device_path, local_tmpdir) 56 self._adb.Pull(device_path, local_tmpdir)
54 with open(os.path.join(local_tmpdir, 'testfile.txt'), 'r') as f: 57 with open(os.path.join(local_tmpdir, 'testfile.txt'), 'r') as f:
55 self.assertEqual(f.read(), 'foo') 58 self.assertEqual(f.read(), 'foo')
56 59
57 def testInstall(self): 60 def testInstall(self):
58 path = self._MakeTempFile('foo') 61 path = self._MakeTempFile('foo')
59 with self.assertRaises(device_errors.AdbCommandFailedError): 62 with self.assertRaises(device_errors.AdbCommandFailedError):
60 self._adb.Install(path) 63 self._adb.Install(path)
61 64
(...skipping 22 matching lines...) Expand all
84 try: 87 try:
85 self._adb.Shell('start') 88 self._adb.Shell('start')
86 break 89 break
87 except device_errors.AdbCommandFailedError: 90 except device_errors.AdbCommandFailedError:
88 time.sleep(1) 91 time.sleep(1)
89 self._adb.Remount() 92 self._adb.Remount()
90 93
91 94
92 if __name__ == '__main__': 95 if __name__ == '__main__':
93 unittest.main() 96 unittest.main()
OLDNEW
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698