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

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

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: New DevToolsEventsLogger Created 3 years, 9 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/devtools_events_logger.cc
diff --git a/chrome/test/chromedriver/devtools_events_logger.cc b/chrome/test/chromedriver/devtools_events_logger.cc
new file mode 100644
index 0000000000000000000000000000000000000000..49b4adcef3d4b775708a2d27855561a11a008b31
--- /dev/null
+++ b/chrome/test/chromedriver/devtools_events_logger.cc
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/test/chromedriver/devtools_events_logger.h"
+
+#include "base/values.h"
+#include "chrome/test/chromedriver/chrome/devtools_client.h"
+#include "chrome/test/chromedriver/chrome/devtools_client_impl.h"
+
+DevToolsEventsLogger::DevToolsEventsLogger(Log* log,
+ const base::ListValue* prefs)
+ : BaseLogger(log),
+ prefs_(prefs) {}
+
+inline DevToolsEventsLogger::~DevToolsEventsLogger() {}
+
+Status DevToolsEventsLogger::OnConnected(DevToolsClient* client) {
+ for (base::ListValue::const_iterator it = prefs_->begin();
+ it != prefs_->end();
+ ++it) {
+ std::string event;
+ (*it)->GetAsString(&event);
+ events_.insert(event);
+ }
+ return Status(kOk);
+}
+
+Status DevToolsEventsLogger::OnEvent(
+ DevToolsClient* client,
+ const std::string& method,
+ const base::DictionaryValue& params) {
+ std::unordered_set<std::string>::iterator it = events_.find(method);
+ if (it != events_.end()) {
+ AddLogEntry(client->GetId(), method, params);
+ }
+ return Status(kOk);
+}

Powered by Google App Engine
This is Rietveld 408576698