| 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" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // This class presents the interface to actions that can be performed on | 27 // This class presents the interface to actions that can be performed on |
| 28 // a given browser window. Note that this object can be invalidated at any | 28 // a given browser window. Note that this object can be invalidated at any |
| 29 // time if the corresponding browser window in the app is closed. In that case, | 29 // time if the corresponding browser window in the app is closed. In that case, |
| 30 // any subsequent calls will return false immediately. | 30 // any subsequent calls will return false immediately. |
| 31 class BrowserProxy : public AutomationResourceProxy { | 31 class BrowserProxy : public AutomationResourceProxy { |
| 32 public: | 32 public: |
| 33 BrowserProxy(AutomationMessageSender* sender, | 33 BrowserProxy(AutomationMessageSender* sender, |
| 34 AutomationHandleTracker* tracker, | 34 AutomationHandleTracker* tracker, |
| 35 int handle) | 35 int handle) |
| 36 : AutomationResourceProxy(tracker, sender, handle) {} | 36 : AutomationResourceProxy(tracker, sender, handle) {} |
| 37 virtual ~BrowserProxy() {} | |
| 38 | 37 |
| 39 // Activates the tab corresponding to (zero-based) tab_index. Returns true if | 38 // Activates the tab corresponding to (zero-based) tab_index. Returns true if |
| 40 // successful. | 39 // successful. |
| 41 bool ActivateTab(int tab_index); | 40 bool ActivateTab(int tab_index); |
| 42 | 41 |
| 43 // Like ActivateTab, but returns false if response is not received before | 42 // Like ActivateTab, but returns false if response is not received before |
| 44 // the specified timeout. | 43 // the specified timeout. |
| 45 bool ActivateTabWithTimeout(int tab_index, uint32 timeout_ms, | 44 bool ActivateTabWithTimeout(int tab_index, uint32 timeout_ms, |
| 46 bool* is_timeout); | 45 bool* is_timeout); |
| 47 | 46 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Like GetTabCount, but returns false if tab count is not received within the | 81 // Like GetTabCount, but returns false if tab count is not received within the |
| 83 // before timeout. | 82 // before timeout. |
| 84 bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, | 83 bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, |
| 85 bool* is_timeout) const; | 84 bool* is_timeout) const; |
| 86 | 85 |
| 87 // Returns the TabProxy for the tab at the given index, transferring | 86 // Returns the TabProxy for the tab at the given index, transferring |
| 88 // ownership of the pointer to the caller. On failure, returns NULL. | 87 // ownership of the pointer to the caller. On failure, returns NULL. |
| 89 // | 88 // |
| 90 // Use GetTabCount to see how many windows you can ask for. Tab numbers | 89 // Use GetTabCount to see how many windows you can ask for. Tab numbers |
| 91 // are 0-based. | 90 // are 0-based. |
| 92 TabProxy* GetTab(int tab_index) const; | 91 scoped_refptr<TabProxy> GetTab(int tab_index) const; |
| 93 | 92 |
| 94 // Returns the TabProxy for the currently active tab, transferring | 93 // Returns the TabProxy for the currently active tab, transferring |
| 95 // ownership of the pointer to the caller. On failure, returns NULL. | 94 // ownership of the pointer to the caller. On failure, returns NULL. |
| 96 TabProxy* GetActiveTab() const; | 95 scoped_refptr<TabProxy> GetActiveTab() const; |
| 97 | 96 |
| 98 // Like GetActiveTab, but returns NULL if no response is received before | 97 // Like GetActiveTab, but returns NULL if no response is received before |
| 99 // the specified timout. | 98 // the specified timout. |
| 100 TabProxy* GetActiveTabWithTimeout(uint32 timeout_ms, bool* is_timeout) const; | 99 scoped_refptr<TabProxy> GetActiveTabWithTimeout(uint32 timeout_ms, |
| 100 bool* is_timeout) const; |
| 101 | 101 |
| 102 // Returns the WindowProxy for this browser's window. It can be used to | 102 // Returns the WindowProxy for this browser's window. It can be used to |
| 103 // retreive view bounds, simulate clicks and key press events. The caller | 103 // retreive view bounds, simulate clicks and key press events. The caller |
| 104 // owns the returned WindowProxy. | 104 // owns the returned WindowProxy. |
| 105 // On failure, returns NULL. | 105 // On failure, returns NULL. |
| 106 WindowProxy* GetWindow() const; | 106 scoped_refptr<WindowProxy> GetWindow() const; |
| 107 | 107 |
| 108 // Returns an AutocompleteEdit for this browser's window. It can be used to | 108 // Returns an AutocompleteEdit for this browser's window. It can be used to |
| 109 // manipulate the omnibox. The caller owns the returned pointer. | 109 // manipulate the omnibox. The caller owns the returned pointer. |
| 110 // On failure, returns NULL. | 110 // On failure, returns NULL. |
| 111 AutocompleteEditProxy* GetAutocompleteEdit(); | 111 scoped_refptr<AutocompleteEditProxy> GetAutocompleteEdit(); |
| 112 | 112 |
| 113 // Apply the accelerator with given id (IDC_BACK, IDC_NEWTAB ...) | 113 // Apply the accelerator with given id (IDC_BACK, IDC_NEWTAB ...) |
| 114 // The list can be found at chrome/app/chrome_dll_resource.h | 114 // The list can be found at chrome/app/chrome_dll_resource.h |
| 115 // Returns true if the call was successful. | 115 // Returns true if the call was successful. |
| 116 // | 116 // |
| 117 // 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 |
| 118 // 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 |
| 119 // 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 |
| 120 // 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 |
| 121 // 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 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 // Sets the string value of the specified preference. | 192 // Sets the string value of the specified preference. |
| 193 bool SetStringPreference(const std::wstring& name, const std::wstring& value); | 193 bool SetStringPreference(const std::wstring& name, const std::wstring& value); |
| 194 | 194 |
| 195 // Gets the boolean value of the specified preference. | 195 // Gets the boolean value of the specified preference. |
| 196 bool GetBooleanPreference(const std::wstring& name, bool* value); | 196 bool GetBooleanPreference(const std::wstring& name, bool* value); |
| 197 | 197 |
| 198 // Sets the boolean value of the specified preference. | 198 // Sets the boolean value of the specified preference. |
| 199 bool SetBooleanPreference(const std::wstring& name, bool value); | 199 bool SetBooleanPreference(const std::wstring& name, bool value); |
| 200 | 200 |
| 201 protected: |
| 202 virtual ~BrowserProxy() {} |
| 201 private: | 203 private: |
| 202 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); | 204 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); |
| 203 }; | 205 }; |
| 204 | 206 |
| 205 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 207 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
| OLD | NEW |