OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // 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 |
30 // 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 |
31 // calls will return false immediately. | 31 // calls will return false immediately. |
32 class WindowProxy : public AutomationResourceProxy { | 32 class WindowProxy : public AutomationResourceProxy { |
33 public: | 33 public: |
34 WindowProxy(AutomationMessageSender* sender, | 34 WindowProxy(AutomationMessageSender* sender, |
35 AutomationHandleTracker* tracker, | 35 AutomationHandleTracker* tracker, |
36 int handle) | 36 int handle) |
37 : AutomationResourceProxy(tracker, sender, handle) {} | 37 : AutomationResourceProxy(tracker, sender, handle) {} |
38 | 38 |
39 // Simulates a click at the OS level. |click| is in the window's coordinates | |
40 // and |flags| specifies which buttons are pressed (as defined in | |
41 // chrome/views/event.h). Note that this is equivalent to the user moving | |
42 // the mouse and pressing the button. So if there is a window on top of this | |
43 // window, the top window is clicked. | |
44 bool SimulateOSClick(const gfx::Point& click, int flags); | |
45 | |
46 // Moves the mouse pointer this location at the OS level. |location| is | 39 // Moves the mouse pointer this location at the OS level. |location| is |
47 // in the window's coordinates. | 40 // in the window's coordinates. |
48 bool SimulateOSMouseMove(const gfx::Point& location); | 41 bool SimulateOSMouseMove(const gfx::Point& location); |
49 | 42 |
50 // Get the title of the top level window. | |
51 bool GetWindowTitle(string16* text); | |
52 | |
53 // Simulates a key press at the OS level. |key| is the virtual key code of the | 43 // Simulates a key press at the OS level. |key| is the virtual key code of the |
54 // key pressed and |flags| specifies which modifiers keys are also pressed (as | 44 // key pressed and |flags| specifies which modifiers keys are also pressed (as |
55 // defined in chrome/views/event.h). Note that this actually sends the event | 45 // defined in chrome/views/event.h). Note that this actually sends the event |
56 // to the window that has focus. | 46 // to the window that has focus. |
57 bool SimulateOSKeyPress(ui::KeyboardCode key, int flags); | 47 bool SimulateOSKeyPress(ui::KeyboardCode key, int flags); |
58 | 48 |
59 // Shows/hides the window and as a result makes it active/inactive. | |
60 // Returns true if the call was successful. | |
61 bool SetVisible(bool visible); | |
62 | |
63 // Sets |active| to true if this view is currently the active window. | |
64 // Returns true if the call was successful. | |
65 bool IsActive(bool* active); | |
66 | |
67 // Make this window the active window. | |
68 // Returns true if the call was successful. | |
69 bool Activate(); | |
70 | |
71 // Sets |maximized| to true if this window is maximized. | |
72 bool IsMaximized(bool* maximized); | |
73 | |
74 // Gets the bounds (in window coordinates) that correspond to the view with | 49 // Gets the bounds (in window coordinates) that correspond to the view with |
75 // the given ID in this window. Returns true if bounds could be obtained. | 50 // the given ID in this window. Returns true if bounds could be obtained. |
76 // If |screen_coordinates| is true, the bounds are returned in the coordinates | 51 // If |screen_coordinates| is true, the bounds are returned in the coordinates |
77 // of the screen, if false in the coordinates of the browser. | 52 // of the screen, if false in the coordinates of the browser. |
78 bool GetViewBounds(int view_id, gfx::Rect* bounds, bool screen_coordinates); | 53 bool GetViewBounds(int view_id, gfx::Rect* bounds, bool screen_coordinates); |
79 | 54 |
80 // Gets the position and size of the window. Returns true if setting the | |
81 // bounds was successful. | |
82 bool GetBounds(gfx::Rect* bounds); | |
83 | |
84 // Sets the position and size of the window. Returns true if setting the | 55 // Sets the position and size of the window. Returns true if setting the |
85 // bounds was successful. | 56 // bounds was successful. |
86 bool SetBounds(const gfx::Rect& bounds); | 57 bool SetBounds(const gfx::Rect& bounds); |
87 | 58 |
88 // Returns the browser this window corresponds to, or NULL if this window | |
89 // is not a browser. The caller owns the returned BrowserProxy. | |
90 scoped_refptr<BrowserProxy> GetBrowser(); | |
91 | |
92 // Same as GetWindow except return NULL if response isn't received | |
93 // before the specified timeout. | |
94 scoped_refptr<BrowserProxy> GetBrowserWithTimeout(uint32 timeout_ms, | |
95 bool* is_timeout); | |
96 protected: | 59 protected: |
97 virtual ~WindowProxy() {} | 60 virtual ~WindowProxy() {} |
98 private: | 61 private: |
99 DISALLOW_COPY_AND_ASSIGN(WindowProxy); | 62 DISALLOW_COPY_AND_ASSIGN(WindowProxy); |
100 }; | 63 }; |
101 | 64 |
102 #endif // CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ | 65 #endif // CHROME_TEST_AUTOMATION_WINDOW_PROXY_H__ |
OLD | NEW |