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 5import unittest 6 7from systrace import decorators 8from systrace import util 9 10 11DEVICE_SERIAL = 'AG8404EC0444AGC' 12LIST_TMP_ARGS = ['ls', '/data/local/tmp'] 13ATRACE_ARGS = ['atrace', '-z', '-t', '10', '-b', '4096'] 14ADB_SHELL = ['adb', '-s', DEVICE_SERIAL, 'shell'] 15 16 17class UtilTest(unittest.TestCase): 18 19 @decorators.HostOnlyTest 20 def test_construct_adb_shell_command(self): 21 command = util.construct_adb_shell_command(LIST_TMP_ARGS, None) 22 self.assertEqual(' '.join(command), 'adb shell ls /data/local/tmp') 23 24 command = util.construct_adb_shell_command(LIST_TMP_ARGS, DEVICE_SERIAL) 25 self.assertEqual(' '.join(command), 26 'adb -s AG8404EC0444AGC shell ls /data/local/tmp') 27 28 command = util.construct_adb_shell_command(ATRACE_ARGS, DEVICE_SERIAL) 29 self.assertEqual(' '.join(command), 30 'adb -s AG8404EC0444AGC shell atrace -z -t 10 -b 4096') 31