| 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_TAB_PROXY_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_TAB_PROXY_H_ |
| 6 #define CHROME_TEST_AUTOMATION_TAB_PROXY_H_ | 6 #define CHROME_TEST_AUTOMATION_TAB_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" // NOLINT | 9 #include "build/build_config.h" // NOLINT |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 TabProxy(AutomationMessageSender* sender, | 61 TabProxy(AutomationMessageSender* sender, |
| 62 AutomationHandleTracker* tracker, | 62 AutomationHandleTracker* tracker, |
| 63 int handle); | 63 int handle); |
| 64 | 64 |
| 65 // Gets the current url of the tab. | 65 // Gets the current url of the tab. |
| 66 bool GetCurrentURL(GURL* url) const WARN_UNUSED_RESULT; | 66 bool GetCurrentURL(GURL* url) const WARN_UNUSED_RESULT; |
| 67 | 67 |
| 68 // Gets the title of the tab. | 68 // Gets the title of the tab. |
| 69 bool GetTabTitle(std::wstring* title) const WARN_UNUSED_RESULT; | 69 bool GetTabTitle(string16* title) const WARN_UNUSED_RESULT; |
| 70 | 70 |
| 71 // Gets the tabstrip index of the tab. | 71 // Gets the tabstrip index of the tab. |
| 72 bool GetTabIndex(int* index) const WARN_UNUSED_RESULT; | 72 bool GetTabIndex(int* index) const WARN_UNUSED_RESULT; |
| 73 | 73 |
| 74 // Gets the number of constrained window for this tab. | 74 // Gets the number of constrained window for this tab. |
| 75 bool GetConstrainedWindowCount(int* count) const WARN_UNUSED_RESULT; | 75 bool GetConstrainedWindowCount(int* count) const WARN_UNUSED_RESULT; |
| 76 | 76 |
| 77 // Executes a javascript in a frame's context whose xpath is provided as the | 77 // Executes a javascript in a frame's context whose xpath is provided as the |
| 78 // first parameter and extract the values from the resulting json string. | 78 // first parameter and extract the values from the resulting json string. |
| 79 // Examples: | 79 // Examples: |
| 80 // jscript = "window.domAutomationController.send('string');" | 80 // jscript = "window.domAutomationController.send('string');" |
| 81 // will result in value = "string" | 81 // will result in value = "string" |
| 82 // jscript = "window.domAutomationController.send(24);" | 82 // jscript = "window.domAutomationController.send(24);" |
| 83 // will result in value = 24 | 83 // will result in value = 24 |
| 84 // NOTE: If this is called from a ui test, |dom_automation_enabled_| must be | 84 // NOTE: If this is called from a ui test, |dom_automation_enabled_| must be |
| 85 // set to true for these functions to work. | 85 // set to true for these functions to work. |
| 86 bool ExecuteAndExtractString(const std::wstring& frame_xpath, | 86 bool ExecuteAndExtractString(const string16& frame_xpath, |
| 87 const std::wstring& jscript, | 87 const string16& jscript, |
| 88 std::wstring* value) WARN_UNUSED_RESULT; | 88 string16* value) WARN_UNUSED_RESULT; |
| 89 bool ExecuteAndExtractBool(const std::wstring& frame_xpath, | 89 bool ExecuteAndExtractBool(const string16& frame_xpath, |
| 90 const std::wstring& jscript, | 90 const string16& jscript, |
| 91 bool* value) WARN_UNUSED_RESULT; | 91 bool* value) WARN_UNUSED_RESULT; |
| 92 bool ExecuteAndExtractInt(const std::wstring& frame_xpath, | 92 bool ExecuteAndExtractInt(const string16& frame_xpath, |
| 93 const std::wstring& jscript, | 93 const string16& jscript, |
| 94 int* value) WARN_UNUSED_RESULT; | 94 int* value) WARN_UNUSED_RESULT; |
| 95 bool ExecuteAndExtractValue(const std::wstring& frame_xpath, | 95 bool ExecuteAndExtractValue(const string16& frame_xpath, |
| 96 const std::wstring& jscript, | 96 const string16& jscript, |
| 97 Value** value) WARN_UNUSED_RESULT; | 97 Value** value) WARN_UNUSED_RESULT; |
| 98 | 98 |
| 99 // Returns a DOMElementProxyRef to the tab's current DOM document. | 99 // Returns a DOMElementProxyRef to the tab's current DOM document. |
| 100 // This proxy is invalidated when the document changes. | 100 // This proxy is invalidated when the document changes. |
| 101 DOMElementProxyRef GetDOMDocument(); | 101 DOMElementProxyRef GetDOMDocument(); |
| 102 | 102 |
| 103 // Configure extension automation mode. When extension automation | 103 // Configure extension automation mode. When extension automation |
| 104 // mode is turned on, the automation host can overtake extension API calls | 104 // mode is turned on, the automation host can overtake extension API calls |
| 105 // e.g. to make UI tests for extensions easier to write. Returns true if | 105 // e.g. to make UI tests for extensions easier to write. Returns true if |
| 106 // the message is successfully sent. | 106 // the message is successfully sent. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 // Gets the process ID that corresponds to the content area of this tab. | 203 // Gets the process ID that corresponds to the content area of this tab. |
| 204 // Returns true if the call was successful. If the specified tab has no | 204 // Returns true if the call was successful. If the specified tab has no |
| 205 // separate process for rendering its content, the return value is true but | 205 // separate process for rendering its content, the return value is true but |
| 206 // the process_id is 0. | 206 // the process_id is 0. |
| 207 bool GetProcessID(int* process_id) const WARN_UNUSED_RESULT; | 207 bool GetProcessID(int* process_id) const WARN_UNUSED_RESULT; |
| 208 | 208 |
| 209 // Supply or cancel authentication to a login prompt. These are synchronous | 209 // Supply or cancel authentication to a login prompt. These are synchronous |
| 210 // calls and hence block until the load finishes (or another login prompt | 210 // calls and hence block until the load finishes (or another login prompt |
| 211 // appears, in the case of invalid login info). | 211 // appears, in the case of invalid login info). |
| 212 bool SetAuth(const std::wstring& username, | 212 bool SetAuth(const string16& username, |
| 213 const std::wstring& password) WARN_UNUSED_RESULT; | 213 const string16& password) WARN_UNUSED_RESULT; |
| 214 bool CancelAuth() WARN_UNUSED_RESULT; | 214 bool CancelAuth() WARN_UNUSED_RESULT; |
| 215 | 215 |
| 216 // Checks if this tab has a login prompt waiting for auth. This will be | 216 // Checks if this tab has a login prompt waiting for auth. This will be |
| 217 // true if a navigation results in a login prompt, and if an attempted login | 217 // true if a navigation results in a login prompt, and if an attempted login |
| 218 // fails. | 218 // fails. |
| 219 // Note that this is only valid if you've done a navigation on this same | 219 // Note that this is only valid if you've done a navigation on this same |
| 220 // object; different TabProxy objects can refer to the same Tab. Calls | 220 // object; different TabProxy objects can refer to the same Tab. Calls |
| 221 // that can set this are NavigateToURL, GoBack, and GoForward. | 221 // that can set this are NavigateToURL, GoBack, and GoForward. |
| 222 // TODO(mpcomplete): we have no way of knowing if auth is needed after either | 222 // TODO(mpcomplete): we have no way of knowing if auth is needed after either |
| 223 // NavigateToURLAsync, or after appending a tab with an URL that triggers | 223 // NavigateToURLAsync, or after appending a tab with an URL that triggers |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 // purposes. | 432 // purposes. |
| 433 void LastObjectRemoved(); | 433 void LastObjectRemoved(); |
| 434 | 434 |
| 435 private: | 435 private: |
| 436 base::Lock list_lock_; // Protects the observers_list_. | 436 base::Lock list_lock_; // Protects the observers_list_. |
| 437 ObserverList<TabProxyDelegate> observers_list_; | 437 ObserverList<TabProxyDelegate> observers_list_; |
| 438 DISALLOW_COPY_AND_ASSIGN(TabProxy); | 438 DISALLOW_COPY_AND_ASSIGN(TabProxy); |
| 439 }; | 439 }; |
| 440 | 440 |
| 441 #endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H_ | 441 #endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H_ |
| OLD | NEW |