summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_util.cc
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-26 18:12:52 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-26 18:12:52 +0000
commit3aded7fb5db539bd2e39a4c9c5f22b2fa8251f60 (patch)
treeb0de093c81153c4ae6d14d2d8a0efb59df3e8516 /chrome/browser/automation/automation_util.cc
parente4857a219d52c7f3ec6635746b3ce6dafbdfd0b9 (diff)
downloadchromium_src-3aded7fb5db539bd2e39a4c9c5f22b2fa8251f60.zip
chromium_src-3aded7fb5db539bd2e39a4c9c5f22b2fa8251f60.tar.gz
chromium_src-3aded7fb5db539bd2e39a4c9c5f22b2fa8251f60.tar.bz2
Part2 of Convert ChromeDriver to use only the JSON automation interface.
Move common functions to automation_util. BUG=none TEST=none Review URL: http://codereview.chromium.org/6614023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_util.cc')
-rw-r--r--chrome/browser/automation/automation_util.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc
index 99b025c..9d4c39e 100644
--- a/chrome/browser/automation/automation_util.cc
+++ b/chrome/browser/automation/automation_util.cc
@@ -9,13 +9,17 @@
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "base/values.h"
+#include "chrome/browser/automation/automation_provider.h"
#include "chrome/browser/automation/automation_provider_json.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/browser/ui/browser.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/tab_contents/tab_contents.h"
#include "net/base/cookie_monster.h"
#include "net/base/cookie_store.h"
#include "net/url_request/url_request_context.h"
@@ -80,6 +84,21 @@ void DeleteCookieOnIOThread(
namespace automation_util {
+Browser* GetBrowserAt(int index) {
+ if (index < 0 || index >= static_cast<int>(BrowserList::size()))
+ return NULL;
+ return *(BrowserList::begin() + index);
+}
+
+TabContents* GetTabContentsAt(int browser_index, int tab_index) {
+ if (tab_index < 0)
+ return NULL;
+ Browser* browser = GetBrowserAt(browser_index);
+ if (!browser || tab_index >= browser->tab_count())
+ return NULL;
+ return browser->GetTabContentsAt(tab_index);
+}
+
void GetCookies(const GURL& url,
TabContents* contents,
int* value_size,