OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium 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 #ifndef CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ | 5 #ifndef CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ |
6 #define CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ | 6 #define CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
11 #include <windows.h> | 11 #include <windows.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "base/thread.h" | 17 #include "base/thread.h" |
18 #include "chrome/test/automation/automation_handle_tracker.h" | 18 #include "chrome/test/automation/automation_handle_tracker.h" |
19 | 19 |
20 class BrowserProxy; | 20 class BrowserProxy; |
21 class WindowProxy; | 21 class WindowProxy; |
22 | 22 |
23 namespace gfx { | 23 namespace gfx { |
| 24 class Point; |
24 class Rect; | 25 class Rect; |
25 } | 26 } |
26 | 27 |
27 // This class presents the interface to actions that can be performed on a given | 28 // This class presents the interface to actions that can be performed on a given |
28 // window. Note that this object can be invalidated at any time if the | 29 // window. Note that this object can be invalidated at any time if the |
29 // corresponding window in the app is closed. In that case, any subsequent | 30 // corresponding window in the app is closed. In that case, any subsequent |
30 // calls will return false immediately. | 31 // calls will return false immediately. |
31 class WindowProxy : public AutomationResourceProxy { | 32 class WindowProxy : public AutomationResourceProxy { |
32 public: | 33 public: |
33 WindowProxy(AutomationMessageSender* sender, | 34 WindowProxy(AutomationMessageSender* sender, |
34 AutomationHandleTracker* tracker, | 35 AutomationHandleTracker* tracker, |
35 int handle) | 36 int handle) |
36 : AutomationResourceProxy(tracker, sender, handle) {} | 37 : AutomationResourceProxy(tracker, sender, handle) {} |
37 | 38 |
38 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
39 // TODO(port): Use portable replacements for windowsisms. | 40 // TODO(port): Use portable replacements for windowsisms. |
40 | 41 |
41 // Gets the outermost HWND that corresponds to the given window. | 42 // Gets the outermost HWND that corresponds to the given window. |
42 // Returns true if the call was successful. | 43 // Returns true if the call was successful. |
43 bool GetHWND(HWND* handle) const; | 44 bool GetHWND(HWND* handle) const; |
| 45 #endif // defined(OS_WIN) |
44 | 46 |
45 // Simulates a click at the OS level. |click| is in the window's coordinates | 47 // Simulates a click at the OS level. |click| is in the window's coordinates |
46 // and |flags| specifies which buttons are pressed (as defined in | 48 // and |flags| specifies which buttons are pressed (as defined in |
47 // chrome/views/event.h). Note that this is equivalent to the user moving | 49 // chrome/views/event.h). Note that this is equivalent to the user moving |
48 // the mouse and pressing the button. So if there is a window on top of this | 50 // the mouse and pressing the button. So if there is a window on top of this |
49 // window, the top window is clicked. | 51 // window, the top window is clicked. |
50 bool SimulateOSClick(const POINT& click, int flags); | 52 bool SimulateOSClick(const gfx::Point& click, int flags); |
51 #endif // defined(OS_WIN) | |
52 | 53 |
53 // Get the title of the top level window. | 54 // Get the title of the top level window. |
54 bool GetWindowTitle(string16* text); | 55 bool GetWindowTitle(string16* text); |
55 | 56 |
56 // Simulates a key press at the OS level. |key| is the key pressed and | 57 // Simulates a key press at the OS level. |key| is the key pressed and |
57 // |flags| specifies which modifiers keys are also pressed (as defined in | 58 // |flags| specifies which modifiers keys are also pressed (as defined in |
58 // chrome/views/event.h). Note that this actually sends the event to the | 59 // chrome/views/event.h). Note that this actually sends the event to the |
59 // window that has focus. | 60 // window that has focus. |
60 bool SimulateOSKeyPress(wchar_t key, int flags); | 61 bool SimulateOSKeyPress(wchar_t key, int flags); |
61 | 62 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // before the specified timeout. | 100 // before the specified timeout. |
100 scoped_refptr<BrowserProxy> GetBrowserWithTimeout(uint32 timeout_ms, | 101 scoped_refptr<BrowserProxy> GetBrowserWithTimeout(uint32 timeout_ms, |
101 bool* is_timeout); | 102 bool* is_timeout); |
102 protected: | 103 protected: |
103 virtual ~WindowProxy() {} | 104 virtual ~WindowProxy() {} |
104 private: | 105 private: |
105 DISALLOW_COPY_AND_ASSIGN(WindowProxy); | 106 DISALLOW_COPY_AND_ASSIGN(WindowProxy); |
106 }; | 107 }; |
107 | 108 |
108 #endif // CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ | 109 #endif // CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ |
OLD | NEW |