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

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

Issue 3226005: Refactory UI to grab shortcut keys, and tests to not look for triggers. (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 3 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 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 7
8 # DESCRIPTION : 8 # DESCRIPTION :
9 # 9 #
10 # Intended for use during manufacturing to validate Developer mode 10 # Intended for use during manufacturing to validate Developer mode
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 else: 303 else:
304 self._cur_gpio = False 304 self._cur_gpio = False
305 return self.cur_gpio() 305 return self.cur_gpio()
306 306
307 def gpio_default(self, name): 307 def gpio_default(self, name):
308 return self.table[name][0] 308 return self.table[name][0]
309 309
310 def gpio_state(self, name): 310 def gpio_state(self, name):
311 return self.table[name][1] 311 return self.table[name][1]
312 312
313
313 class factory_DeveloperRecovery(test.test): 314 class factory_DeveloperRecovery(test.test):
314 version = 1 315 version = 1
315 preserve_srcdir = True 316 preserve_srcdir = True
316 317
317 def initialize(self, gpio_root = '/home/gpio'): 318 def initialize(self, gpio_root = '/home/gpio'):
318 # setup gpio's for reading. Must re-create after each POR 319 # setup gpio's for reading. Must re-create after each POR
319 if os.path.exists(gpio_root): 320 if os.path.exists(gpio_root):
320 utils.system("rm -rf %s" % gpio_root) 321 utils.system("rm -rf %s" % gpio_root)
321 utils.system("mkdir %s" % (gpio_root)) 322 utils.system("mkdir %s" % (gpio_root))
322 utils.system("/usr/sbin/gpio_setup") 323 utils.system("/usr/sbin/gpio_setup")
323 self._gpio_root=gpio_root 324 self._gpio_root=gpio_root
324 325
325 def key_release_callback(self, widget, event): 326 def run_once(self, layout=None):
326 self._ft_state.exit_on_trigger(event)
327 return True
328
329 def register_callbacks(self, window):
330 window.connect('key-release-event', self.key_release_callback)
331 window.add_events(gtk.gdk.KEY_RELEASE_MASK)
332
333 def run_once(self,
334 test_widget_size=None,
335 trigger_set=None,
336 layout=None):
337 327
338 factory.log('%s run_once' % self.__class__) 328 factory.log('%s run_once' % self.__class__)
339 329
340 self._ft_state = ful.State(trigger_set)
341
342 os.chdir(self.srcdir) 330 os.chdir(self.srcdir)
343 dr_image = cairo.ImageSurface.create_from_png('%s.png' % layout) 331 dr_image = cairo.ImageSurface.create_from_png('%s.png' % layout)
344 image_size = (dr_image.get_width(), dr_image.get_height()) 332 image_size = (dr_image.get_width(), dr_image.get_height())
345 333
346 test = DevRecTest(dr_image, self._gpio_root) 334 test = DevRecTest(dr_image, self._gpio_root)
347 335
348 drawing_area = gtk.DrawingArea() 336 drawing_area = gtk.DrawingArea()
349 drawing_area.set_size_request(*image_size) 337 drawing_area.set_size_request(*image_size)
350 drawing_area.connect('expose_event', test.expose_event) 338 drawing_area.connect('expose_event', test.expose_event)
351 drawing_area.add_events(gtk.gdk.EXPOSURE_MASK) 339 drawing_area.add_events(gtk.gdk.EXPOSURE_MASK)
352 gobject.timeout_add(200, test.timer_event, drawing_area) 340 gobject.timeout_add(200, test.timer_event, drawing_area)
353 341
354 test.start_countdown(test.timeout) 342 test.start_countdown(test.timeout)
355 343
356 self._ft_state.run_test_widget( 344 ful.run_test_widget(self.job, drawing_area)
357 test_widget=drawing_area,
358 test_widget_size=test_widget_size,
359 window_registration_callback=self.register_callbacks)
360 345
361 factory.log('%s run_once finished' % self.__class__) 346 factory.log('%s run_once finished' % self.__class__)
OLDNEW
« no previous file with comments | « client/site_tests/factory_Camera/factory_Camera.py ('k') | client/site_tests/factory_Display/factory_Display.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698