| 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_BROWSER_PROXY_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
| 6 #define CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 6 #define CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" |
| 9 |
| 10 #if defined(OS_WIN) |
| 8 #include <windows.h> | 11 #include <windows.h> |
| 12 #endif |
| 13 |
| 9 #include <string> | 14 #include <string> |
| 15 |
| 10 #include "chrome/test/automation/automation_handle_tracker.h" | 16 #include "chrome/test/automation/automation_handle_tracker.h" |
| 11 | 17 |
| 12 class GURL; | 18 class GURL; |
| 13 class TabProxy; | 19 class TabProxy; |
| 14 class WindowProxy; | 20 class WindowProxy; |
| 15 class AutocompleteEditProxy; | 21 class AutocompleteEditProxy; |
| 16 | 22 |
| 17 namespace gfx { | 23 namespace gfx { |
| 18 class Rect; | 24 class Rect; |
| 19 } | 25 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Returns true if the call was successful. | 115 // Returns true if the call was successful. |
| 110 // | 116 // |
| 111 // The alternate way to test the accelerators is to use the Windows messaging | 117 // The alternate way to test the accelerators is to use the Windows messaging |
| 112 // system to send the actual keyboard events (ui_controls.h) A precondition | 118 // system to send the actual keyboard events (ui_controls.h) A precondition |
| 113 // to using this system is that the target window should have the keyboard | 119 // to using this system is that the target window should have the keyboard |
| 114 // focus. This leads to a flaky test behavior in circumstances when the | 120 // focus. This leads to a flaky test behavior in circumstances when the |
| 115 // desktop screen is locked or the test is being executed over a remote | 121 // desktop screen is locked or the test is being executed over a remote |
| 116 // desktop. | 122 // desktop. |
| 117 bool ApplyAccelerator(int id); | 123 bool ApplyAccelerator(int id); |
| 118 | 124 |
| 125 #if defined(OS_WIN) |
| 126 // TODO(port): Use portable replacement for POINT. |
| 127 |
| 119 // Performs a drag operation between the start and end points (both defined | 128 // Performs a drag operation between the start and end points (both defined |
| 120 // in window coordinates). |flags| specifies which buttons are pressed for | 129 // in window coordinates). |flags| specifies which buttons are pressed for |
| 121 // the drag, as defined in chrome/views/event.h. | 130 // the drag, as defined in chrome/views/event.h. |
| 122 virtual bool SimulateDrag(const POINT& start, const POINT& end, int flags, | 131 virtual bool SimulateDrag(const POINT& start, const POINT& end, int flags, |
| 123 bool press_escape_en_route); | 132 bool press_escape_en_route); |
| 124 | 133 |
| 125 // Like SimulateDrag, but returns false if response is not received before | 134 // Like SimulateDrag, but returns false if response is not received before |
| 126 // the specified timeout. | 135 // the specified timeout. |
| 127 virtual bool SimulateDragWithTimeout(const POINT& start, const POINT& end, | 136 virtual bool SimulateDragWithTimeout(const POINT& start, const POINT& end, |
| 128 int flags, uint32 timeout_ms, | 137 int flags, uint32 timeout_ms, |
| 129 bool* is_timeout, | 138 bool* is_timeout, |
| 130 bool press_escape_en_route); | 139 bool press_escape_en_route); |
| 140 #endif // defined(OS_WIN) |
| 131 | 141 |
| 132 // Block the thread until the tab count changes. | 142 // Block the thread until the tab count changes. |
| 133 // |count| is the original tab count. | 143 // |count| is the original tab count. |
| 134 // |new_count| is updated with the number of new tabs. | 144 // |new_count| is updated with the number of new tabs. |
| 135 // |wait_timeout| is the timeout, in milliseconds, for waiting. | 145 // |wait_timeout| is the timeout, in milliseconds, for waiting. |
| 136 // Returns false if the tab count does not change. | 146 // Returns false if the tab count does not change. |
| 137 bool WaitForTabCountToChange(int count, int* new_count, int wait_timeout); | 147 bool WaitForTabCountToChange(int count, int* new_count, int wait_timeout); |
| 138 | 148 |
| 139 // Block the thread until the tab count is |count|. | 149 // Block the thread until the tab count is |count|. |
| 140 bool WaitForTabCountToBecome(int count, int wait_timeout); | 150 bool WaitForTabCountToBecome(int count, int wait_timeout); |
| 141 | 151 |
| 142 // Block the thread until the specified tab is the active tab. | 152 // Block the thread until the specified tab is the active tab. |
| 143 // |wait_timeout| is the timeout, in milliseconds, for waiting. | 153 // |wait_timeout| is the timeout, in milliseconds, for waiting. |
| 144 // Returns false if the tab does not become active. | 154 // Returns false if the tab does not become active. |
| 145 bool WaitForTabToBecomeActive(int tab, int wait_timeout); | 155 bool WaitForTabToBecomeActive(int tab, int wait_timeout); |
| 146 | 156 |
| 147 // Opens the FindInPage box. Note: If you just want to search within a tab | 157 // Opens the FindInPage box. Note: If you just want to search within a tab |
| 148 // you don't need to call this function, just use FindInPage(...) directly. | 158 // you don't need to call this function, just use FindInPage(...) directly. |
| 149 bool OpenFindInPage(); | 159 bool OpenFindInPage(); |
| 150 | 160 |
| 151 // Get the x, y coordinates for the Find window. If animating, |x| and |y| | 161 // Get the x, y coordinates for the Find window. If animating, |x| and |y| |
| 152 // will be -1, -1. Returns false on failure. | 162 // will be -1, -1. Returns false on failure. |
| 153 bool GetFindWindowLocation(int* x, int* y); | 163 bool GetFindWindowLocation(int* x, int* y); |
| 154 | 164 |
| 155 // Returns whether the Find window is fully visible If animating, |is_visible| | 165 // Returns whether the Find window is fully visible If animating, |is_visible| |
| 156 // will be false. Returns false on failure. | 166 // will be false. Returns false on failure. |
| 157 bool IsFindWindowFullyVisible(bool* is_visible); | 167 bool IsFindWindowFullyVisible(bool* is_visible); |
| 158 | 168 |
| 169 #if defined(OS_WIN) |
| 170 // TODO(port): Use portable equivalent of HWND. |
| 171 |
| 159 // Gets the outermost HWND that corresponds to the given browser. | 172 // Gets the outermost HWND that corresponds to the given browser. |
| 160 // Returns true if the call was successful. | 173 // Returns true if the call was successful. |
| 161 // Note that ideally this should go and the version of WindowProxy should be | 174 // Note that ideally this should go and the version of WindowProxy should be |
| 162 // used instead. We have to keep it for start_up_tests that test against a | 175 // used instead. We have to keep it for start_up_tests that test against a |
| 163 // reference build. | 176 // reference build. |
| 164 bool GetHWND(HWND* handle) const; | 177 bool GetHWND(HWND* handle) const; |
| 178 #endif // defined(OS_WIN) |
| 165 | 179 |
| 166 // Run the specified command in the browser (see browser_commands.cc for the | 180 // Run the specified command in the browser (see browser_commands.cc for the |
| 167 // list of supported commands). Returns true if the command was successfully | 181 // list of supported commands). Returns true if the command was successfully |
| 168 // executed, false otherwise. | 182 // executed, false otherwise. |
| 169 bool RunCommand(int browser_command) const; | 183 bool RunCommand(int browser_command) const; |
| 170 | 184 |
| 171 // Returns whether the Bookmark bar is visible and whether we are animating | 185 // Returns whether the Bookmark bar is visible and whether we are animating |
| 172 // it into position. Returns false on failure. | 186 // it into position. Returns false on failure. |
| 173 bool GetBookmarkBarVisibility(bool* is_visible, bool* is_animating); | 187 bool GetBookmarkBarVisibility(bool* is_visible, bool* is_animating); |
| 174 | 188 |
| 175 // Sets the int value of the specified preference. | 189 // Sets the int value of the specified preference. |
| 176 bool SetIntPreference(const std::wstring& name, int value); | 190 bool SetIntPreference(const std::wstring& name, int value); |
| 177 | 191 |
| 178 // Sets the string value of the specified preference. | 192 // Sets the string value of the specified preference. |
| 179 bool SetStringPreference(const std::wstring& name, const std::wstring& value); | 193 bool SetStringPreference(const std::wstring& name, const std::wstring& value); |
| 180 | 194 |
| 181 // Gets the boolean value of the specified preference. | 195 // Gets the boolean value of the specified preference. |
| 182 bool GetBooleanPreference(const std::wstring& name, bool* value); | 196 bool GetBooleanPreference(const std::wstring& name, bool* value); |
| 183 | 197 |
| 184 // Sets the boolean value of the specified preference. | 198 // Sets the boolean value of the specified preference. |
| 185 bool SetBooleanPreference(const std::wstring& name, bool value); | 199 bool SetBooleanPreference(const std::wstring& name, bool value); |
| 186 | 200 |
| 187 private: | 201 private: |
| 188 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); | 202 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); |
| 189 }; | 203 }; |
| 190 | 204 |
| 191 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 205 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
| 192 | 206 |
| OLD | NEW |