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

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

Issue 13870016: [chromedriver] Fix nested frame issue for command getElementLocationOnceScrolledIntoView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Just rebase. Created 7 years, 8 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
« no previous file with comments | « chrome/test/chromedriver/element_util.h ('k') | chrome/test/chromedriver/test_expectations » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_util.h" 5 #include "chrome/test/chromedriver/element_util.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 16 matching lines...) Expand all
27 return false; 27 return false;
28 double x, y; 28 double x, y;
29 if (!dict_value->GetDouble("x", &x) || 29 if (!dict_value->GetDouble("x", &x) ||
30 !dict_value->GetDouble("y", &y)) 30 !dict_value->GetDouble("y", &y))
31 return false; 31 return false;
32 point->x = static_cast<int>(x); 32 point->x = static_cast<int>(x);
33 point->y = static_cast<int>(y); 33 point->y = static_cast<int>(y);
34 return true; 34 return true;
35 } 35 }
36 36
37 base::Value* CreateValueFrom(const WebPoint& point) {
38 base::DictionaryValue* dict = new base::DictionaryValue();
39 dict->SetInteger("x", point.x);
40 dict->SetInteger("y", point.y);
41 return dict;
42 }
43
44 bool ParseFromValue(base::Value* value, WebSize* size) { 37 bool ParseFromValue(base::Value* value, WebSize* size) {
45 base::DictionaryValue* dict_value; 38 base::DictionaryValue* dict_value;
46 if (!value->GetAsDictionary(&dict_value)) 39 if (!value->GetAsDictionary(&dict_value))
47 return false; 40 return false;
48 double width, height; 41 double width, height;
49 if (!dict_value->GetDouble("width", &width) || 42 if (!dict_value->GetDouble("width", &width) ||
50 !dict_value->GetDouble("height", &height)) 43 !dict_value->GetDouble("height", &height))
51 return false; 44 return false;
52 size->width = static_cast<int>(width); 45 size->width = static_cast<int>(width);
53 size->height = static_cast<int>(height); 46 size->height = static_cast<int>(height);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 205 }
213 206
214 } // namespace 207 } // namespace
215 208
216 base::DictionaryValue* CreateElement(const std::string& element_id) { 209 base::DictionaryValue* CreateElement(const std::string& element_id) {
217 base::DictionaryValue* element = new base::DictionaryValue(); 210 base::DictionaryValue* element = new base::DictionaryValue();
218 element->SetString(kElementKey, element_id); 211 element->SetString(kElementKey, element_id);
219 return element; 212 return element;
220 } 213 }
221 214
215 base::Value* CreateValueFrom(const WebPoint& point) {
216 base::DictionaryValue* dict = new base::DictionaryValue();
217 dict->SetInteger("x", point.x);
218 dict->SetInteger("y", point.y);
219 return dict;
220 }
221
222 Status FindElement( 222 Status FindElement(
223 int interval_ms, 223 int interval_ms,
224 bool only_one, 224 bool only_one,
225 const std::string* root_element_id, 225 const std::string* root_element_id,
226 Session* session, 226 Session* session,
227 WebView* web_view, 227 WebView* web_view,
228 const base::DictionaryValue& params, 228 const base::DictionaryValue& params,
229 scoped_ptr<base::Value>* value) { 229 scoped_ptr<base::Value>* value) {
230 std::string strategy; 230 std::string strategy;
231 if (!params.GetString("using", &strategy)) 231 if (!params.GetString("using", &strategy))
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 status = ScrollElementRegionIntoViewHelper( 578 status = ScrollElementRegionIntoViewHelper(
579 rit->parent_frame_id, web_view, frame_element_id, 579 rit->parent_frame_id, web_view, frame_element_id,
580 WebRect(region_offset, region_size), 580 WebRect(region_offset, region_size),
581 center, verify_clickable, &region_offset); 581 center, verify_clickable, &region_offset);
582 if (status.IsError()) 582 if (status.IsError())
583 return status; 583 return status;
584 } 584 }
585 *location = region_offset; 585 *location = region_offset;
586 return Status(kOk); 586 return Status(kOk);
587 } 587 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/element_util.h ('k') | chrome/test/chromedriver/test_expectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698