summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation/tab_proxy.h
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 16:34:15 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 16:34:15 +0000
commitf18744fd5ec25ee780633e039a9f53d2cce3b49c (patch)
tree4d81c829dbf6e1710f546277a7907f5c0a928937 /chrome/test/automation/tab_proxy.h
parent966ddf0958e0e3eb3a145c5a9908bc8662e174be (diff)
downloadchromium_src-f18744fd5ec25ee780633e039a9f53d2cce3b49c.zip
chromium_src-f18744fd5ec25ee780633e039a9f53d2cce3b49c.tar.gz
chromium_src-f18744fd5ec25ee780633e039a9f53d2cce3b49c.tar.bz2
Add ability to manipulate DOM elements from the automation proxy. Rework the way that javascript is packaged and parsed in the JavascriptExecutionController, and add some waiting methods.
BUG=none TEST=none Review URL: http://codereview.chromium.org/1632001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation/tab_proxy.h')
-rw-r--r--chrome/test/automation/tab_proxy.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index e7a7951..8115871 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -21,6 +21,8 @@
#include "chrome/browser/tab_contents/security_style.h"
#include "chrome/test/automation/automation_constants.h"
#include "chrome/test/automation/automation_handle_tracker.h"
+#include "chrome/test/automation/dom_element_proxy.h"
+#include "chrome/test/automation/javascript_execution_controller.h"
class GURL;
class Value;
@@ -40,7 +42,8 @@ enum AutomationPageFontSize {
LARGEST_FONT = 36
};
-class TabProxy : public AutomationResourceProxy {
+class TabProxy : public AutomationResourceProxy,
+ public JavaScriptExecutionController {
public:
class TabProxyDelegate {
public:
@@ -88,6 +91,10 @@ class TabProxy : public AutomationResourceProxy {
const std::wstring& jscript,
Value** value) WARN_UNUSED_RESULT;
+ // Returns a DOMElementProxyRef to the tab's current DOM document.
+ // This proxy is invalidated when the document changes.
+ DOMElementProxyRef GetDOMDocument();
+
// Configure extension automation mode. When extension automation
// mode is turned on, the automation host can overtake extension API calls
// e.g. to make UI tests for extensions easier to write. Returns true if
@@ -385,6 +392,20 @@ class TabProxy : public AutomationResourceProxy {
void OnChannelError();
protected:
virtual ~TabProxy() {}
+
+ // Override JavaScriptExecutionController methods.
+ // Executes |script| and gets the response JSON. Returns true on success.
+ bool ExecuteJavaScriptAndGetJSON(const std::string& script,
+ std::string* json) WARN_UNUSED_RESULT;
+
+ // Called when tracking the first object. Used for reference counting
+ // purposes.
+ void FirstObjectAdded();
+
+ // Called when no longer tracking any objects. Used for reference counting
+ // purposes.
+ void LastObjectRemoved();
+
private:
Lock list_lock_; // Protects the observers_list_.
ObserverList<TabProxyDelegate> observers_list_;