Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: chrome/test/webdriver/automation.h

Issue 6507015: Implement the target locator commands for ChromeDriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Pawel's concerns Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/webdriver/automation.h
diff --git a/chrome/test/webdriver/automation.h b/chrome/test/webdriver/automation.h
index ac7d405d99a232d8fb278bd66959a7cd5d2344db..78d91d5561e29337aeea8622901873f9821064a5 100644
--- a/chrome/test/webdriver/automation.h
+++ b/chrome/test/webdriver/automation.h
@@ -5,7 +5,9 @@
#ifndef CHROME_TEST_WEBDRIVER_AUTOMATION_H_
#define CHROME_TEST_WEBDRIVER_AUTOMATION_H_
+#include <map>
#include <string>
+#include <vector>
#include "base/task.h"
#include "base/ref_counted.h"
@@ -14,6 +16,8 @@
#include "chrome/test/ui/ui_test.h"
#include "ui/base/keycodes/keyboard_codes.h"
+class TabProxy;
+
namespace webdriver {
struct WebKeyEvent {
@@ -53,26 +57,39 @@ class Automation : private UITestBase {
// Executes the given |script| in the specified frame of the current
// tab. |result| will be set to the JSON result. Returns true on success.
- void ExecuteScript(const std::string& frame_xpath,
+ void ExecuteScript(int tab_id,
+ const std::string& frame_xpath,
const std::string& script,
std::string* result,
bool* success);
// Sends a key event to the current browser. Waits until the key has
// been processed by the web page.
- void SendWebKeyEvent(const WebKeyEvent& key_event, bool* success);
+ void SendWebKeyEvent(int tab_id, const WebKeyEvent& key_event, bool* success);
+
+ void NavigateToURL(int tab_id, const std::string& url, bool* success);
+ void GoForward(int tab_id, bool* success);
+ void GoBack(int tab_id, bool* success);
+ void Reload(int tab_id, bool* success);
+ void GetURL(int tab_id, std::string* url, bool* success);
+ void GetTabTitle(int tab_id, std::string* tab_title, bool* success);
+
+ // Get persistent IDs for all the tabs currently open. These IDs can be used
+ // to identify the tab as long as the tab exists.
+ void GetTabIds(std::vector<int>* tab_ids, bool* success);
+
+ // Check if the given tab exists currently.
+ void DoesTabExist(int tab_id, bool* does_exist);
- void NavigateToURL(const std::string& url, bool* success);
- void GoForward(bool* success);
- void GoBack(bool* success);
- void Reload(bool* success);
- void GetURL(std::string* url, bool* success);
- void GetTabTitle(std::string* tab_title, bool* success);
+ void CloseTab(int tab_id, bool* success);
private:
- scoped_refptr<BrowserProxy> browser_;
- scoped_refptr<TabProxy> tab_;
+ typedef std::map<int, scoped_refptr<TabProxy> > TabIdMap;
+ TabProxy* GetTabById(int tab_id);
+ // Map from tab ID to |TabProxy|. The tab ID is simply the |AutomationHandle|
+ // for the proxy.
+ TabIdMap tab_id_map_;
ScopedTempDir profile_dir_;
DISALLOW_COPY_AND_ASSIGN(Automation);

Powered by Google App Engine
This is Rietveld 408576698