summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation/automation_proxy.cc
diff options
context:
space:
mode:
authorhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-01 17:00:29 +0000
committerhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-01 17:00:29 +0000
commit2449703fd43147babd98ad124a396c445c3c3daf (patch)
tree910bf5f4344d79234b7e6e784479002f9997f83f /chrome/test/automation/automation_proxy.cc
parentd4bf3bf8357815bf18377b3451d1919b1cd12a05 (diff)
downloadchromium_src-2449703fd43147babd98ad124a396c445c3c3daf.zip
chromium_src-2449703fd43147babd98ad124a396c445c3c3daf.tar.gz
chromium_src-2449703fd43147babd98ad124a396c445c3c3daf.tar.bz2
Making CloseWindow and CloseTab automation API
synchronous and robust. Adding automation APIs with corresponding IPC messages to count and find normal browser windows. Review URL: http://codereview.chromium.org/99268 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15058 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation/automation_proxy.cc')
-rw-r--r--chrome/test/automation/automation_proxy.cc34
1 files changed, 33 insertions, 1 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index ef70de8..5489745 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -299,6 +299,24 @@ bool AutomationProxy::GetBrowserWindowCount(int* num_windows) {
return succeeded;
}
+bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) {
+ if (!num_windows) {
+ NOTREACHED();
+ return false;
+ }
+
+ bool succeeded = SendWithTimeout(
+ new AutomationMsg_NormalBrowserWindowCount(0, num_windows),
+ command_execution_timeout_ms(), NULL);
+
+ if (!succeeded) {
+ DLOG(ERROR) << "GetNormalWindowCount did not complete in a timely fashion";
+ return false;
+ }
+
+ return succeeded;
+}
+
bool AutomationProxy::WaitForWindowCountToBecome(int count,
int wait_timeout) {
const TimeTicks start = TimeTicks::Now();
@@ -438,7 +456,6 @@ WindowProxy* AutomationProxy::GetActiveWindow() {
return new WindowProxy(this, tracker_.get(), handle);
}
-
BrowserProxy* AutomationProxy::GetBrowserWindow(int window_index) {
int handle = 0;
@@ -456,6 +473,21 @@ BrowserProxy* AutomationProxy::GetBrowserWindow(int window_index) {
return new BrowserProxy(this, tracker_.get(), handle);
}
+BrowserProxy* AutomationProxy::FindNormalBrowserWindow() {
+ int handle = 0;
+
+ if (!SendWithTimeout(new AutomationMsg_FindNormalBrowserWindow(0, &handle),
+ command_execution_timeout_ms(), NULL)) {
+ return NULL;
+ }
+
+ if (handle == 0) {
+ return NULL;
+ }
+
+ return new BrowserProxy(this, tracker_.get(), handle);
+}
+
BrowserProxy* AutomationProxy::GetLastActiveBrowserWindow() {
int handle = 0;