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

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

Issue 2285933003: Remove more usage of the base::ListValue::Append(Value*) overload. (Closed)
Patch Set: rebase Created 4 years, 4 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/window_commands.cc
diff --git a/chrome/test/chromedriver/window_commands.cc b/chrome/test/chromedriver/window_commands.cc
index 6fd252408a35e500d54cd2b5cf73df98ef1bc343..ac2598a6dba354b1b9fc0a03acb23ea73e2fd4e1 100644
--- a/chrome/test/chromedriver/window_commands.cc
+++ b/chrome/test/chromedriver/window_commands.cc
@@ -84,8 +84,9 @@ struct Cookie {
bool session;
};
-base::DictionaryValue* CreateDictionaryFrom(const Cookie& cookie) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+std::unique_ptr<base::DictionaryValue> CreateDictionaryFrom(
+ const Cookie& cookie) {
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("name", cookie.name);
dict->SetString("value", cookie.value);
if (!cookie.domain.empty())
@@ -346,7 +347,7 @@ Status ExecuteSwitchToFrame(Session* session,
const base::DictionaryValue* id_dict;
if (id->GetAsDictionary(&id_dict)) {
script = "function(elem) { return elem; }";
- args.Append(id_dict->DeepCopy());
+ args.Append(id_dict->CreateDeepCopy());
} else {
script =
"function(xpath) {"
@@ -387,7 +388,7 @@ Status ExecuteSwitchToFrame(Session* session,
" frame.setAttribute('cd_frame_id_', id);"
"}";
base::ListValue new_args;
- new_args.Append(element->DeepCopy());
+ new_args.Append(element->CreateDeepCopy());
new_args.AppendString(chrome_driver_id);
result.reset(NULL);
status = web_view->CallFunction(
@@ -902,7 +903,7 @@ Status ExecuteAddCookie(Session* session,
if (!params.GetDictionary("cookie", &cookie))
return Status(kUnknownError, "missing 'cookie'");
base::ListValue args;
- args.Append(cookie->DeepCopy());
+ args.Append(cookie->CreateDeepCopy());
std::unique_ptr<base::Value> result;
return web_view->CallFunction(
session->GetCurrentFrameId(), kAddCookieScript, args, &result);
« no previous file with comments | « chrome/test/chromedriver/performance_logger_unittest.cc ('k') | content/browser/accessibility/accessibility_tree_formatter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698