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

Unified Diff: devil/devil/android/sdk/adb_wrapper_devicetest.py

Issue 1748173002: New API for persistent ADB shell (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix nits Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « devil/devil/android/sdk/adb_wrapper.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/sdk/adb_wrapper_devicetest.py
diff --git a/devil/devil/android/sdk/adb_wrapper_devicetest.py b/devil/devil/android/sdk/adb_wrapper_devicetest.py
old mode 100644
new mode 100755
index 59755c00cbbef99eb7393da943d9dce4f7393881..3b037f3a6d06a5ddbbd6855d4fcc6dfadc8a125c
--- a/devil/devil/android/sdk/adb_wrapper_devicetest.py
+++ b/devil/devil/android/sdk/adb_wrapper_devicetest.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -44,6 +46,21 @@ class TestAdbWrapper(unittest.TestCase):
with self.assertRaises(device_errors.AdbCommandFailedError):
self._adb.Shell('echo test', expect_status=1)
+ def testPersistentShell(self):
+ # We need to access the device serial number here in order
+ # to create the persistent shell.
+ serial = self._adb.device_serial # pylint: disable=protected-access
+ with self._adb.PersistentShell(serial) as pshell:
+ (res1, code1) = pshell.RunCommand('echo TEST')
+ (res2, code2) = pshell.RunCommand('echo TEST2')
+ self.assertEqual(len(res1), 1)
+ self.assertEqual(len(res2), 2)
+ self.assertEqual(res1[0], 'TEST')
+ self.assertEqual(res2[0], '')
+ self.assertEqual(res2[1], 'TEST2')
+ self.assertEqual(code1, 0)
+ self.assertEqual(code2, 0)
+
def testPushLsPull(self):
path = self._MakeTempFile('foo')
device_path = '/data/local/tmp/testfile.txt'
« no previous file with comments | « devil/devil/android/sdk/adb_wrapper.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698