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

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

Issue 1534001: switch to autox.py and robustify login/logout code (Closed)
Patch Set: merge with head Created 10 years, 8 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
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 os, random, time 5 import os, random, time
6 from autotest_lib.client.bin import site_ui_test, site_utils, test 6 from autotest_lib.client.bin import site_ui_test, site_utils, test
7 from autotest_lib.client.common_lib import error 7 from autotest_lib.client.common_lib import error
8 8
9 class desktopui_WindowManagerHotkeys(site_ui_test.UITest): 9 class desktopui_WindowManagerHotkeys(site_ui_test.UITest):
10 version = 1 10 version = 1
11 11
12 def run_once(self): 12 def run_once(self):
13 import autox 13 ax = self.get_autox()
14
15 # TODO: Set these in a single, standard place for all tests.
16 os.environ['DISPLAY'] = ':0'
17 os.environ['XAUTHORITY'] = '/home/chronos/.Xauthority'
18 ax = autox.AutoX()
19 14
20 # Start a terminal and wait for it to get the focus. 15 # Start a terminal and wait for it to get the focus.
21 # TODO: This is a bit of a hack. To watch for the terminal getting 16 # TODO: This is a bit of a hack. To watch for the terminal getting
22 # the focus, we create a new window, wait for it to get the focus, 17 # the focus, we create a new window, wait for it to get the focus,
23 # and then launch the terminal and wait for our window to lose the 18 # and then launch the terminal and wait for our window to lose the
24 # focus (AutoX isn't notified about focus events on the terminal 19 # focus (AutoX isn't notified about focus events on the terminal
25 # window itself). It's maybe cleaner to add a method to AutoX to 20 # window itself). It's maybe cleaner to add a method to AutoX to
26 # get the currently-focused window and then just poll that after 21 # get the currently-focused window and then just poll that after
27 # starting the terminal until it changes. 22 # starting the terminal until it changes.
28 win = ax.create_and_map_window() 23 win = ax.create_and_map_window()
(...skipping 19 matching lines...) Expand all
48 # Press the Print Screen key and check that a screenshot is written. 43 # Press the Print Screen key and check that a screenshot is written.
49 screenshot_filename = '/home/chronos/user/screenshot.png' 44 screenshot_filename = '/home/chronos/user/screenshot.png'
50 if os.access(screenshot_filename, os.F_OK): 45 if os.access(screenshot_filename, os.F_OK):
51 os.remove(screenshot_filename) 46 os.remove(screenshot_filename)
52 ax.send_hotkey('Print') 47 ax.send_hotkey('Print')
53 site_utils.poll_for_condition( 48 site_utils.poll_for_condition(
54 lambda: os.access(screenshot_filename, os.F_OK), 49 lambda: os.access(screenshot_filename, os.F_OK),
55 error.TestFail( 50 error.TestFail(
56 'Waiting for screenshot at %s' % screenshot_filename)) 51 'Waiting for screenshot at %s' % screenshot_filename))
57 os.remove(screenshot_filename) 52 os.remove(screenshot_filename)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698