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

Unified Diff: chrome/test/chromedriver/session.cc

Issue 12764021: [chromedriver] Support clicking an element in sub frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 9 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/chromedriver/session.cc
diff --git a/chrome/test/chromedriver/session.cc b/chrome/test/chromedriver/session.cc
index d65a42729d12c34201898914650d0798bfca0096..52474c8e6d2b6b47f1c68428dce265c19936f85c 100644
--- a/chrome/test/chromedriver/session.cc
+++ b/chrome/test/chromedriver/session.cc
@@ -13,6 +13,12 @@
#include "chrome/test/chromedriver/version.h"
#include "chrome/test/chromedriver/web_view.h"
+FrameElement::FrameElement(const std::string& parent_frame_id,
+ const std::string& frame_id,
+ const std::string& chromedriver_frame_id)
+ : parent_frame_id(parent_frame_id), frame_id(frame_id),
kkania 2013/03/13 00:06:20 normal style is to put these on separate lines if
chrisgao (Use stgao instead) 2013/03/13 00:36:48 Done.
+ chromedriver_frame_id(chromedriver_frame_id) {}
+
Session::Session(const std::string& id)
: id(id),
mouse_position(0, 0),
@@ -52,6 +58,25 @@ Status Session::GetTargetWindow(WebView** web_view) {
return Status(kNoSuchWindow, "target window already closed");
}
+void Session::SwitchToTopFrame() {
+ frame_elements.clear();
+}
+
+void Session::SwitchToSubFrame(const std::string& frame_id,
+ const std::string& chromedriver_frame_id) {
+ std::string parent_frame_id = "";
kkania 2013/03/13 00:06:20 remove = ""
chrisgao (Use stgao instead) 2013/03/13 00:36:48 Done.
+ if (!frame_elements.empty())
+ parent_frame_id = frame_elements.back().frame_id;
+ frame_elements.push_back(
+ FrameElement(parent_frame_id, frame_id, chromedriver_frame_id));
+}
+
+std::string Session::GetCurrentFrameId() const {
+ if (frame_elements.empty())
+ return "";
+ return frame_elements.back().frame_id;
+}
+
scoped_ptr<base::DictionaryValue> Session::CreateCapabilities() {
scoped_ptr<base::DictionaryValue> caps(new base::DictionaryValue());
caps->SetString("browserName", "chrome");

Powered by Google App Engine
This is Rietveld 408576698