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

Side by Side Diff: tools/perf/contrib/cros_benchmarks/cros_utils.py

Issue 2890333002: Tab Switching Benchmark for ChromeOS (Closed)
Patch Set: Tab Switching Benchmark for ChromeOS Created 3 years, 7 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
(Empty)
1 # Copyright 2017 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 import os
6 import subprocess
7
8 def FindKeyboardDevice(dut_ip):
9 # find the device support events EV=120013
bccheng 2017/05/19 09:09:14 find if the device supports event "EV=120013"
deanliao_goog 2017/05/19 09:49:46 Comment should be English sentence, which means it
vovoy 2017/05/22 03:54:07 Done.
10 cmd = ['ssh', 'root@' + dut_ip, 'cat', '/proc/bus/input/devices']
11 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
12 out = p.communicate()[0]
13 for line in out.splitlines():
14 handler_prefix = 'H: Handlers='
15 if line.startswith(handler_prefix):
16 handlers = line[len(handler_prefix):].split()
17 kbd_event = 'B: EV=120013'
18 if line.startswith(kbd_event):
19 for handler in handlers:
20 if handler.startswith('event'):
21 return '/dev/input/' + handler
22 raise Exception('keyboard device not found')
23
24 def SetupKeyDispatch(dut_ip):
25 cur_dir=os.path.dirname(os.path.abspath(__file__))
bccheng 2017/05/19 09:09:14 space around =
vovoy 2017/05/22 03:54:07 Done.
26 send_key_filename = cur_dir + '/data/send_key_tab_switch'
27 log_key_filename = cur_dir + '/data/log_key_tab_switch'
28
29 kbd_dev = FindKeyboardDevice(dut_ip)
30 send_key_content = '#!/bin/bash\n'
31 send_key_content += ('evemu-play --insert-slot0 ' + kbd_dev +
32 ' < /home/root/log_key_tab_switch')
33 with open(send_key_filename, 'w') as f:
34 f.write(send_key_content)
35 os.chmod(send_key_filename, 0774)
36
37 os.system('scp -q %s root@%s:/usr/local/tmp/' % (log_key_filename, dut_ip))
38 os.system('scp -q %s root@%s:/usr/local/tmp/' % (send_key_filename, dut_ip))
39
40 def SwitchTab(platform_backend):
41 platform_backend.RunCommand('/usr/local/tmp/send_key_tab_switch')
42
43 def NoScreenOff(platform_backend):
44 platform_backend.RunCommand('set_power_policy --ac_screen_off_delay=3600')
45 platform_backend.RunCommand('set_power_policy --ac_screen_dim_delay=3500')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698