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

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

Issue 2285933003: Remove more usage of the base::ListValue::Append(Value*) overload. (Closed)
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « chrome/test/chromedriver/element_util.h ('k') | chrome/test/chromedriver/logging.cc » ('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 <utility> 7 #include <utility>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 !dict_value->GetDouble("width", &width) || 65 !dict_value->GetDouble("width", &width) ||
66 !dict_value->GetDouble("height", &height)) 66 !dict_value->GetDouble("height", &height))
67 return false; 67 return false;
68 rect->origin.x = static_cast<int>(x); 68 rect->origin.x = static_cast<int>(x);
69 rect->origin.y = static_cast<int>(y); 69 rect->origin.y = static_cast<int>(y);
70 rect->size.width = static_cast<int>(width); 70 rect->size.width = static_cast<int>(width);
71 rect->size.height = static_cast<int>(height); 71 rect->size.height = static_cast<int>(height);
72 return true; 72 return true;
73 } 73 }
74 74
75 base::Value* CreateValueFrom(const WebRect& rect) { 75 std::unique_ptr<base::DictionaryValue> CreateValueFrom(const WebRect& rect) {
76 base::DictionaryValue* dict = new base::DictionaryValue(); 76 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
77 dict->SetInteger("left", rect.X()); 77 dict->SetInteger("left", rect.X());
78 dict->SetInteger("top", rect.Y()); 78 dict->SetInteger("top", rect.Y());
79 dict->SetInteger("width", rect.Width()); 79 dict->SetInteger("width", rect.Width());
80 dict->SetInteger("height", rect.Height()); 80 dict->SetInteger("height", rect.Height());
81 return dict; 81 return dict;
82 } 82 }
83 83
84 Status CallAtomsJs(const std::string& frame, 84 Status CallAtomsJs(const std::string& frame,
85 WebView* web_view, 85 WebView* web_view,
86 const char* const* atom_function, 86 const char* const* atom_function,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 base::StringToInt(border_top_str, &border_top_tmp); 200 base::StringToInt(border_top_str, &border_top_tmp);
201 if (border_left_tmp == -1 || border_top_tmp == -1) 201 if (border_left_tmp == -1 || border_top_tmp == -1)
202 return Status(kUnknownError, "failed to get border width of element"); 202 return Status(kUnknownError, "failed to get border width of element");
203 *border_left = border_left_tmp; 203 *border_left = border_left_tmp;
204 *border_top = border_top_tmp; 204 *border_top = border_top_tmp;
205 return Status(kOk); 205 return Status(kOk);
206 } 206 }
207 207
208 } // namespace 208 } // namespace
209 209
210 base::DictionaryValue* CreateElement(const std::string& element_id) { 210 std::unique_ptr<base::DictionaryValue> CreateElement(
211 base::DictionaryValue* element = new base::DictionaryValue(); 211 const std::string& element_id) {
212 std::unique_ptr<base::DictionaryValue> element(new base::DictionaryValue());
212 element->SetString(kElementKey, element_id); 213 element->SetString(kElementKey, element_id);
213 return element; 214 return element;
214 } 215 }
215 216
216 base::Value* CreateValueFrom(const WebPoint& point) { 217 std::unique_ptr<base::DictionaryValue> CreateValueFrom(const WebPoint& point) {
217 base::DictionaryValue* dict = new base::DictionaryValue(); 218 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
218 dict->SetInteger("x", point.x); 219 dict->SetInteger("x", point.x);
219 dict->SetInteger("y", point.y); 220 dict->SetInteger("y", point.y);
220 return dict; 221 return dict;
221 } 222 }
222 223
223 Status FindElement(int interval_ms, 224 Status FindElement(int interval_ms,
224 bool only_one, 225 bool only_one,
225 const std::string* root_element_id, 226 const std::string* root_element_id,
226 Session* session, 227 Session* session,
227 WebView* web_view, 228 WebView* web_view,
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 status = ScrollElementRegionIntoViewHelper( 647 status = ScrollElementRegionIntoViewHelper(
647 rit->parent_frame_id, web_view, frame_element_id, 648 rit->parent_frame_id, web_view, frame_element_id,
648 WebRect(region_offset, region_size), 649 WebRect(region_offset, region_size),
649 center, frame_element_id, &region_offset); 650 center, frame_element_id, &region_offset);
650 if (status.IsError()) 651 if (status.IsError())
651 return status; 652 return status;
652 } 653 }
653 *location = region_offset; 654 *location = region_offset;
654 return Status(kOk); 655 return Status(kOk);
655 } 656 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/element_util.h ('k') | chrome/test/chromedriver/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698