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

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

Issue 2888073002: Remove raw DictionaryValue::Set in //chrome (Closed)
Patch Set: Fix Tests Created 3 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome/devtools_client_impl.h" 5 #include "chrome/test/chromedriver/chrome/devtools_client_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" 16 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
16 #include "chrome/test/chromedriver/chrome/log.h" 17 #include "chrome/test/chromedriver/chrome/log.h"
17 #include "chrome/test/chromedriver/chrome/status.h" 18 #include "chrome/test/chromedriver/chrome/status.h"
18 #include "chrome/test/chromedriver/chrome/util.h" 19 #include "chrome/test/chromedriver/chrome/util.h"
19 #include "chrome/test/chromedriver/net/sync_websocket.h" 20 #include "chrome/test/chromedriver/net/sync_websocket.h"
20 #include "chrome/test/chromedriver/net/url_request_context_getter.h" 21 #include "chrome/test/chromedriver/net/url_request_context_getter.h"
21 22
22 namespace { 23 namespace {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 bool expect_response, 262 bool expect_response,
262 bool wait_for_response, 263 bool wait_for_response,
263 const Timeout* timeout) { 264 const Timeout* timeout) {
264 if (!socket_->IsConnected()) 265 if (!socket_->IsConnected())
265 return Status(kDisconnected, "not connected to DevTools"); 266 return Status(kDisconnected, "not connected to DevTools");
266 267
267 int command_id = next_id_++; 268 int command_id = next_id_++;
268 base::DictionaryValue command; 269 base::DictionaryValue command;
269 command.SetInteger("id", command_id); 270 command.SetInteger("id", command_id);
270 command.SetString("method", method); 271 command.SetString("method", method);
271 command.Set("params", params.DeepCopy()); 272 command.Set("params", base::MakeUnique<base::Value>(params));
272 std::string message = SerializeValue(&command); 273 std::string message = SerializeValue(&command);
273 if (IsVLogOn(1)) { 274 if (IsVLogOn(1)) {
274 VLOG(1) << "DEVTOOLS COMMAND " << method << " (id=" << command_id << ") " 275 VLOG(1) << "DEVTOOLS COMMAND " << method << " (id=" << command_id << ") "
275 << FormatValueForDisplay(params); 276 << FormatValueForDisplay(params);
276 } 277 }
277 if (!socket_->Send(message)) 278 if (!socket_->Send(message))
278 return Status(kDisconnected, "unable to send message to renderer"); 279 return Status(kDisconnected, "unable to send message to renderer");
279 280
280 if (expect_response) { 281 if (expect_response) {
281 linked_ptr<ResponseInfo> response_info = 282 linked_ptr<ResponseInfo> response_info =
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 else if (message_dict->GetDictionary("error", &unscoped_error)) 539 else if (message_dict->GetDictionary("error", &unscoped_error))
539 base::JSONWriter::Write(*unscoped_error, &command_response->error); 540 base::JSONWriter::Write(*unscoped_error, &command_response->error);
540 else 541 else
541 command_response->result.reset(new base::DictionaryValue()); 542 command_response->result.reset(new base::DictionaryValue());
542 return true; 543 return true;
543 } 544 }
544 return false; 545 return false;
545 } 546 }
546 547
547 } // namespace internal 548 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698