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

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

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: Adding e2e test Created 3 years, 8 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.h
diff --git a/chrome/test/chromedriver/devtools_events_logger.h b/chrome/test/chromedriver/devtools_events_logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8fc2ff52ecf48bec5a0b51465632a40c5a27bae
--- /dev/null
+++ b/chrome/test/chromedriver/devtools_events_logger.h
@@ -0,0 +1,47 @@
+// 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.
+
+#ifndef CHROME_TEST_CHROMEDRIVER_DEVTOOLS_EVENTS_LOGGER_H_
+#define CHROME_TEST_CHROMEDRIVER_DEVTOOLS_EVENTS_LOGGER_H_
+
+#include <string>
+#include <unordered_set>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/values.h"
+#include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
+#include "chrome/test/chromedriver/chrome/log.h"
+#include "chrome/test/chromedriver/chrome/status.h"
+
+// Collects DevTools events into Log messages with info level.
+//
+// The message is a JSON string of the following structure:
+// {
+// "message": { "method": "...", "params": { ... }} // DevTools message.
+// }
+
+class DevToolsEventsLogger : public DevToolsEventListener {
+ public:
+ // Creates a |DevToolsEventsLogger| with specific preferences.
+ DevToolsEventsLogger(Log* log, const base::ListValue* prefs);
+
+ ~DevToolsEventsLogger() override;
+
+ Status OnConnected(DevToolsClient* client) override;
+
+ Status OnEvent(DevToolsClient* client,
+ const std::string& method,
+ const base::DictionaryValue& params) override;
+
+ private:
+ Log* log_; // The log where to create entries.
+
+ const base::ListValue* prefs_;
+ std::unordered_set<std::string> events_;
+
+ DISALLOW_COPY_AND_ASSIGN(DevToolsEventsLogger);
+};
+
+#endif // CHROME_TEST_CHROMEDRIVER_DEVTOOLS_EVENTS_LOGGER_H_

Powered by Google App Engine
This is Rietveld 408576698