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

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

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: Adding stub, quick code reorg 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
« no previous file with comments | « chrome/test/chromedriver/devtools_events_logger.h ('k') | chrome/test/chromedriver/logging.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/test/chromedriver/devtools_events_logger.h"
6
7 #include "base/json/json_writer.h"
8 #include "chrome/test/chromedriver/chrome/devtools_client.h"
9 #include "chrome/test/chromedriver/chrome/devtools_client_impl.h"
10
11 DevToolsEventsLogger::DevToolsEventsLogger(Log* log,
12 const base::ListValue* prefs)
13 : log_(log),
14 prefs_(prefs) {}
15
16 inline DevToolsEventsLogger::~DevToolsEventsLogger() {}
17
18 Status DevToolsEventsLogger::OnConnected(DevToolsClient* client) {
19 for (base::ListValue::const_iterator it = prefs_->begin();
20 it != prefs_->end();
21 ++it) {
22 std::string event;
23 it->GetAsString(&event);
24 events_.insert(event);
25 }
26 return Status(kOk);
27 }
28
29 Status DevToolsEventsLogger::OnEvent(DevToolsClient* client,
30 const std::string& method,
31 const base::DictionaryValue& params) {
32 std::unordered_set<std::string>::iterator it = events_.find(method);
33 if (it != events_.end()) {
34 base::DictionaryValue log_message_dict;
35 log_message_dict.SetString("method", method);
36 log_message_dict.Set("params", params.DeepCopy());
37 std::string log_message_json;
38 base::JSONWriter::Write(log_message_dict, &log_message_json);
39
40 log_->AddEntry(Log::kInfo, log_message_json);
41 }
42 return Status(kOk);
43 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/devtools_events_logger.h ('k') | chrome/test/chromedriver/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698