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

Side by Side Diff: chrome/test/chromedriver/element_commands.cc

Issue 12764021: [chromedriver] Support clicking an element in sub frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/chromedriver/element_commands.h" 5 #include "chrome/test/chromedriver/element_commands.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/third_party/icu/icu_utf.h" 10 #include "base/third_party/icu/icu_utf.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 Status ExecuteHoverOverElement( 119 Status ExecuteHoverOverElement(
120 Session* session, 120 Session* session,
121 WebView* web_view, 121 WebView* web_view,
122 const std::string& element_id, 122 const std::string& element_id,
123 const base::DictionaryValue& params, 123 const base::DictionaryValue& params,
124 scoped_ptr<base::Value>* value) { 124 scoped_ptr<base::Value>* value) {
125 WebPoint location; 125 WebPoint location;
126 Status status = GetElementClickableLocation( 126 Status status = GetElementClickableLocation(
127 session, web_view, element_id, &location, NULL); 127 session, web_view, element_id, &location);
128 if (status.IsError()) 128 if (status.IsError())
129 return status; 129 return status;
130 130
131 MouseEvent move_event( 131 MouseEvent move_event(
132 kMovedMouseEventType, kNoneMouseButton, location.x, location.y, 0); 132 kMovedMouseEventType, kNoneMouseButton, location.x, location.y, 0);
133 std::list<MouseEvent> events; 133 std::list<MouseEvent> events;
134 events.push_back(move_event); 134 events.push_back(move_event);
135 status = web_view->DispatchMouseEvents(events); 135 status = web_view->DispatchMouseEvents(events);
136 if (status.IsOk()) 136 if (status.IsOk())
137 session->mouse_position = location; 137 session->mouse_position = location;
(...skipping 15 matching lines...) Expand all
153 status = IsOptionElementTogglable( 153 status = IsOptionElementTogglable(
154 session, web_view, element_id, &is_toggleable); 154 session, web_view, element_id, &is_toggleable);
155 if (status.IsError()) 155 if (status.IsError())
156 return status; 156 return status;
157 if (is_toggleable) 157 if (is_toggleable)
158 return ToggleOptionElement(session, web_view, element_id); 158 return ToggleOptionElement(session, web_view, element_id);
159 else 159 else
160 return SetOptionElementSelected(session, web_view, element_id, true); 160 return SetOptionElementSelected(session, web_view, element_id, true);
161 } else { 161 } else {
162 WebPoint location; 162 WebPoint location;
163 bool is_clickable;
164 status = GetElementClickableLocation( 163 status = GetElementClickableLocation(
165 session, web_view, element_id, &location, &is_clickable); 164 session, web_view, element_id, &location);
166 if (status.IsError()) 165 if (status.IsError())
167 return status; 166 return status;
168 if (!is_clickable)
169 return Status(kUnknownError, status.message());
170 167
171 std::list<MouseEvent> events; 168 std::list<MouseEvent> events;
172 events.push_back( 169 events.push_back(
173 MouseEvent(kMovedMouseEventType, kNoneMouseButton, 170 MouseEvent(kMovedMouseEventType, kNoneMouseButton,
174 location.x, location.y, 0)); 171 location.x, location.y, 0));
175 events.push_back( 172 events.push_back(
176 MouseEvent(kPressedMouseEventType, kLeftMouseButton, 173 MouseEvent(kPressedMouseEventType, kLeftMouseButton,
177 location.x, location.y, 1)); 174 location.x, location.y, 1));
178 events.push_back( 175 events.push_back(
179 MouseEvent(kReleasedMouseEventType, kLeftMouseButton, 176 MouseEvent(kReleasedMouseEventType, kLeftMouseButton,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 WebView* web_view, 411 WebView* web_view,
415 const std::string& element_id, 412 const std::string& element_id,
416 const base::DictionaryValue& params, 413 const base::DictionaryValue& params,
417 scoped_ptr<base::Value>* value) { 414 scoped_ptr<base::Value>* value) {
418 std::string other_element_id; 415 std::string other_element_id;
419 if (!params.GetString("other", &other_element_id)) 416 if (!params.GetString("other", &other_element_id))
420 return Status(kUnknownError, "'other' must be a string"); 417 return Status(kUnknownError, "'other' must be a string");
421 value->reset(new base::FundamentalValue(element_id == other_element_id)); 418 value->reset(new base::FundamentalValue(element_id == other_element_id));
422 return Status(kOk); 419 return Status(kOk);
423 } 420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698