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

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

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
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>
8
7 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
10 #include "base/threading/platform_thread.h" 12 #include "base/threading/platform_thread.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "chrome/test/chromedriver/basic_types.h" 15 #include "chrome/test/chromedriver/basic_types.h"
14 #include "chrome/test/chromedriver/chrome/chrome.h" 16 #include "chrome/test/chromedriver/chrome/chrome.h"
15 #include "chrome/test/chromedriver/chrome/js.h" 17 #include "chrome/test/chromedriver/chrome/js.h"
16 #include "chrome/test/chromedriver/chrome/status.h" 18 #include "chrome/test/chromedriver/chrome/status.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return Status(kUnknownError, "'value' must be a string"); 235 return Status(kUnknownError, "'value' must be a string");
234 236
235 std::string script; 237 std::string script;
236 if (only_one) 238 if (only_one)
237 script = webdriver::atoms::asString(webdriver::atoms::FIND_ELEMENT); 239 script = webdriver::atoms::asString(webdriver::atoms::FIND_ELEMENT);
238 else 240 else
239 script = webdriver::atoms::asString(webdriver::atoms::FIND_ELEMENTS); 241 script = webdriver::atoms::asString(webdriver::atoms::FIND_ELEMENTS);
240 std::unique_ptr<base::DictionaryValue> locator(new base::DictionaryValue()); 242 std::unique_ptr<base::DictionaryValue> locator(new base::DictionaryValue());
241 locator->SetString(strategy, target); 243 locator->SetString(strategy, target);
242 base::ListValue arguments; 244 base::ListValue arguments;
243 arguments.Append(locator.release()); 245 arguments.Append(std::move(locator));
244 if (root_element_id) 246 if (root_element_id)
245 arguments.Append(CreateElement(*root_element_id)); 247 arguments.Append(CreateElement(*root_element_id));
246 248
247 base::TimeTicks start_time = base::TimeTicks::Now(); 249 base::TimeTicks start_time = base::TimeTicks::Now();
248 while (true) { 250 while (true) {
249 std::unique_ptr<base::Value> temp; 251 std::unique_ptr<base::Value> temp;
250 Status status = web_view->CallFunction( 252 Status status = web_view->CallFunction(
251 session->GetCurrentFrameId(), script, arguments, &temp); 253 session->GetCurrentFrameId(), script, arguments, &temp);
252 if (status.IsError()) 254 if (status.IsError())
253 return status; 255 return status;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 status = ScrollElementRegionIntoViewHelper( 646 status = ScrollElementRegionIntoViewHelper(
645 rit->parent_frame_id, web_view, frame_element_id, 647 rit->parent_frame_id, web_view, frame_element_id,
646 WebRect(region_offset, region_size), 648 WebRect(region_offset, region_size),
647 center, frame_element_id, &region_offset); 649 center, frame_element_id, &region_offset);
648 if (status.IsError()) 650 if (status.IsError())
649 return status; 651 return status;
650 } 652 }
651 *location = region_offset; 653 *location = region_offset;
652 return Status(kOk); 654 return Status(kOk);
653 } 655 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698