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

Side by Side Diff: client/site_tests/audiovideo_PlaybackRecordSemiAuto/audiovideo_PlaybackRecordSemiAuto.py

Issue 5740004: Move site_chrome_test, site_logging, site_log_reader, site_crash_test into cros dir. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS 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 import copy, logging, os, pprint, re, threading, time, urllib 5 import copy, logging, os, pprint, re, threading, time, urllib
6 6
7 from autotest_lib.client.bin import utils 7 from autotest_lib.client.bin import utils
8 from autotest_lib.client.common_lib import error 8 from autotest_lib.client.common_lib import error
9 from autotest_lib.client.cros import httpd, ui, ui_test 9 from autotest_lib.client.cros import cros_ui_test, httpd, ui
10 10
11 # HTML templates. 11 # HTML templates.
12 _STATIC_CSS =''' 12 _STATIC_CSS ='''
13 form { 13 form {
14 margin: 0; 14 margin: 0;
15 } 15 }
16 td { 16 td {
17 border-width: 1px; 17 border-width: 1px;
18 border-style: solid; 18 border-style: solid;
19 } 19 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 now = start 271 now = start
272 while now < end: 272 while now < end:
273 elapsed = now - start 273 elapsed = now - start
274 new_volume = int(self.start_volume + delta * elapsed / self.period) 274 new_volume = int(self.start_volume + delta * elapsed / self.period)
275 self.audio.do_set_volume(self.type, self.index, new_volume) 275 self.audio.do_set_volume(self.type, self.index, new_volume)
276 time.sleep(self._WAKE_INTERVAL_SEC) 276 time.sleep(self._WAKE_INTERVAL_SEC)
277 now = time.time() 277 now = time.time()
278 self.audio.do_set_volume(self.type, self.index, self.end_volume) 278 self.audio.do_set_volume(self.type, self.index, self.end_volume)
279 279
280 280
281 class audiovideo_PlaybackRecordSemiAuto(ui_test.UITest): 281 class audiovideo_PlaybackRecordSemiAuto(cros_ui_test.UITest):
282 version = 1 282 version = 1
283 preserve_srcdir = True 283 preserve_srcdir = True
284 crash_handling_enabled = False 284 crash_handling_enabled = False
285 285
286 def default_tone_config(self): 286 def default_tone_config(self):
287 return { 'type': 'tone', 287 return { 'type': 'tone',
288 'frequency': 1000, 288 'frequency': 1000,
289 'tone_length_sec': 0.5, 289 'tone_length_sec': 0.5,
290 'channels': 2, 290 'channels': 2,
291 'active_channel': None 291 'active_channel': None
(...skipping 29 matching lines...) Expand all
321 logging.info(self._pp.pformat(self._record_devices)) 321 logging.info(self._pp.pformat(self._record_devices))
322 322
323 # Test state. 323 # Test state.
324 self._running_test = None 324 self._running_test = None
325 self._results = {} 325 self._results = {}
326 326
327 # Run test server. 327 # Run test server.
328 self._server_root = 'http://localhost:8000/' 328 self._server_root = 'http://localhost:8000/'
329 self._testServer = httpd.HTTPListener(port=8000, docroot=self.bindir) 329 self._testServer = httpd.HTTPListener(port=8000, docroot=self.bindir)
330 self._testServer.run() 330 self._testServer.run()
331 ui_test.UITest.initialize(self, creds) 331 cros_ui_test.UITest.initialize(self, creds)
332 332
333 333
334 def cleanup(self): 334 def cleanup(self):
335 for device in self._playback_devices['info']: 335 for device in self._playback_devices['info']:
336 if device['is_hardware']: 336 if device['is_hardware']:
337 self.restore_playback_port(device) 337 self.restore_playback_port(device)
338 self._testServer.stop() 338 self._testServer.stop()
339 ui_test.UITest.cleanup(self) 339 cros_ui_test.UITest.cleanup(self)
340 340
341 341
342 def run_once(self, timeout=10000): 342 def run_once(self, timeout=10000):
343 self._testServer.add_url_handler( 343 self._testServer.add_url_handler(
344 '/%s' % _CONTROL_ENDPOINT, 344 '/%s' % _CONTROL_ENDPOINT,
345 lambda server, form, o=self: o.handle_control(server, form)) 345 lambda server, form, o=self: o.handle_control(server, form))
346 self._testServer.add_url_handler( 346 self._testServer.add_url_handler(
347 '/%s' % _LIST_ENDPOINT, 347 '/%s' % _LIST_ENDPOINT,
348 lambda server, form, o=self: o.handle_list(server, form)) 348 lambda server, form, o=self: o.handle_list(server, form))
349 self._testServer.add_url_handler( 349 self._testServer.add_url_handler(
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 cmd = ('%(exec)s ' 1277 cmd = ('%(exec)s '
1278 '-t %(type)s -h %(frequency)f -l %(tone_length_sec)f ' 1278 '-t %(type)s -h %(frequency)f -l %(tone_length_sec)f '
1279 '-c %(channels)d' % args) 1279 '-c %(channels)d' % args)
1280 if args['active_channel'] is not None: 1280 if args['active_channel'] is not None:
1281 cmd += ' -a %s' % args['active_channel'] 1281 cmd += ' -a %s' % args['active_channel']
1282 if args['type'] == 'tone': 1282 if args['type'] == 'tone':
1283 logging.info('[tone %dHz]' % args['frequency']) 1283 logging.info('[tone %dHz]' % args['frequency'])
1284 elif args['type'] == 'scale': 1284 elif args['type'] == 'scale':
1285 logging.info('[A# harmonic minor scale]') 1285 logging.info('[A# harmonic minor scale]')
1286 utils.system(cmd) 1286 utils.system(cmd)
OLDNEW
« no previous file with comments | « client/cros/login.py ('k') | client/site_tests/desktopui_ChromeFirstRender/desktopui_ChromeFirstRender.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698