OLD | NEW |
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, re, shutil, time | 5 import os, random, re, shutil, time |
6 from autotest_lib.client.bin import test, utils | 6 from autotest_lib.client.bin import utils |
7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
8 from autotest_lib.client.cros import login, ui_test | 8 from autotest_lib.client.cros import cros_ui_test, login |
9 | 9 |
10 class desktopui_WindowManagerHotkeys(ui_test.UITest): | 10 class desktopui_WindowManagerHotkeys(cros_ui_test.UITest): |
11 version = 1 | 11 version = 1 |
12 | 12 |
| 13 |
| 14 def initialize(self, creds = '$default'): |
| 15 cros_ui_test.UITest.initialize(self, creds) |
| 16 |
| 17 |
13 def run_once(self): | 18 def run_once(self): |
14 # Make sure that we don't have the initial browser window popping up in | 19 # Make sure that we don't have the initial browser window popping up in |
15 # the middle of the test. | 20 # the middle of the test. |
16 login.wait_for_initial_chrome_window() | 21 login.wait_for_initial_chrome_window() |
17 | 22 |
18 ax = self.get_autox() | 23 ax = self.get_autox() |
19 | 24 |
20 # Start a terminal and wait for it to get the focus. | 25 # Start a terminal and wait for it to get the focus. |
21 orig_active_win_xid = ax.get_active_window_property() | 26 orig_active_win_xid = ax.get_active_window_property() |
22 ax.send_hotkey('Ctrl-Alt-t') | 27 ax.send_hotkey('Ctrl-Alt-t') |
23 ax.await_condition( | 28 ax.await_condition( |
24 lambda: ax.get_active_window_property() != orig_active_win_xid, | 29 lambda: ax.get_active_window_property() != orig_active_win_xid, |
25 desc='Waiting for terminal to become active window') | 30 desc='Waiting for terminal to become active window') |
26 | 31 |
27 # Press the Print Screen key and check that a screenshot is written. | 32 # Press the Print Screen key and check that a screenshot is written. |
28 screenshot_dir = '/home/chronos/user/Downloads/Screenshots' | 33 screenshot_dir = '/home/chronos/user/Downloads/Screenshots' |
29 shutil.rmtree(screenshot_dir, ignore_errors=True) | 34 shutil.rmtree(screenshot_dir, ignore_errors=True) |
30 ax.send_hotkey('Print') | 35 ax.send_hotkey('Print') |
31 utils.poll_for_condition( | 36 utils.poll_for_condition( |
32 lambda: os.access(screenshot_dir, os.F_OK) and \ | 37 lambda: os.access(screenshot_dir, os.F_OK) and \ |
33 os.listdir(screenshot_dir), | 38 os.listdir(screenshot_dir), |
34 error.TestFail( | 39 error.TestFail( |
35 'Waiting for screenshot in %s' % screenshot_dir)) | 40 'Waiting for screenshot in %s' % screenshot_dir)) |
36 shutil.rmtree(screenshot_dir, ignore_errors=True) | 41 shutil.rmtree(screenshot_dir, ignore_errors=True) |
OLD | NEW |