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, time | 5 import os, time |
6 from autotest_lib.client.bin import site_ui_test, test | 6 from autotest_lib.client.bin import site_ui_test, test |
7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
8 | 8 |
9 class desktopui_WindowManagerFocusNewWindows(site_ui_test.UITest): | 9 class desktopui_WindowManagerFocusNewWindows(site_ui_test.UITest): |
10 version = 1 | 10 version = 1 |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 self.autox.await_condition( | 38 self.autox.await_condition( |
39 lambda: self.autox.get_top_window_id_at_point(200, 200) == id, | 39 lambda: self.autox.get_top_window_id_at_point(200, 200) == id, |
40 desc='Waiting for window 0x%x to be on top' % id) | 40 desc='Waiting for window 0x%x to be on top' % id) |
41 | 41 |
42 except self.autox.ConditionTimeoutError as exception: | 42 except self.autox.ConditionTimeoutError as exception: |
43 raise error.TestFail( | 43 raise error.TestFail( |
44 'Timed out on condition: %s' % exception.__str__()) | 44 'Timed out on condition: %s' % exception.__str__()) |
45 | 45 |
46 def run_once(self): | 46 def run_once(self): |
47 import autox | 47 self.autox = self.get_autox() |
48 | |
49 # TODO: Set these in a single, standard place for all tests. | |
50 os.environ['DISPLAY'] = ':0' | |
51 os.environ['XAUTHORITY'] = '/home/chronos/.Xauthority' | |
52 self.autox = autox.AutoX() | |
53 | 48 |
54 # Create a window and check that we switch to it. | 49 # Create a window and check that we switch to it. |
55 win = self.autox.create_and_map_window( | 50 win = self.autox.create_and_map_window( |
56 width=200, height=200, title='test') | 51 width=200, height=200, title='test') |
57 info = self.autox.get_window_info(win.id) | 52 info = self.autox.get_window_info(win.id) |
58 self.__check_active_window(win.id, info) | 53 self.__check_active_window(win.id, info) |
59 | 54 |
60 # Create a second window. | 55 # Create a second window. |
61 win2 = self.autox.create_and_map_window( | 56 win2 = self.autox.create_and_map_window( |
62 width=200, height=200, title='test 2') | 57 width=200, height=200, title='test 2') |
63 info2 = self.autox.get_window_info(win2.id) | 58 info2 = self.autox.get_window_info(win2.id) |
64 self.__check_active_window(win2.id, info2) | 59 self.__check_active_window(win2.id, info2) |
65 | 60 |
66 # Cycle backwards to the first window. | 61 # Cycle backwards to the first window. |
67 self.autox.send_hotkey('Alt-Shift-Tab') | 62 self.autox.send_hotkey('Alt-Shift-Tab') |
68 self.__check_active_window(win.id, info) | 63 self.__check_active_window(win.id, info) |
69 | 64 |
70 # Cycle forwards to the second window. | 65 # Cycle forwards to the second window. |
71 self.autox.send_hotkey('Alt-Tab') | 66 self.autox.send_hotkey('Alt-Tab') |
72 self.__check_active_window(win2.id, info2) | 67 self.__check_active_window(win2.id, info2) |
73 | 68 |
74 # Now destroy the second window and check that the WM goes back | 69 # Now destroy the second window and check that the WM goes back |
75 # to the first window. | 70 # to the first window. |
76 win2.destroy() | 71 win2.destroy() |
77 self.__check_active_window(win.id, info) | 72 self.__check_active_window(win.id, info) |
OLD | NEW |