OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
johnchen
2017/04/28 21:59:32
Please change this to 2017, and do the same for th
em
2017/04/29 03:07:03
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_TEST_CHROMEDRIVER_DEVTOOLS_EVENTS_LOGGER_H_ | |
6 #define CHROME_TEST_CHROMEDRIVER_DEVTOOLS_EVENTS_LOGGER_H_ | |
7 | |
8 #include <string> | |
9 #include <unordered_set> | |
10 | |
11 #include "base/compiler_specific.h" | |
12 #include "base/macros.h" | |
13 #include "base/values.h" | |
14 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" | |
15 #include "chrome/test/chromedriver/chrome/log.h" | |
16 #include "chrome/test/chromedriver/chrome/status.h" | |
17 | |
18 // Collects DevTools events into Log messages with info level. | |
19 // | |
20 // The message is a JSON string of the following structure: | |
21 // { | |
22 // "message": { "method": "...", "params": { ... }} // DevTools message. | |
23 // } | |
24 | |
25 class DevToolsEventsLogger : public DevToolsEventListener { | |
26 public: | |
27 // Creates a |DevToolsEventsLogger| with specific preferences. | |
28 DevToolsEventsLogger(Log* log, const base::ListValue* prefs); | |
29 | |
30 ~DevToolsEventsLogger() override; | |
31 | |
32 Status OnConnected(DevToolsClient* client) override; | |
33 | |
34 Status OnEvent(DevToolsClient* client, | |
35 const std::string& method, | |
36 const base::DictionaryValue& params) override; | |
37 | |
38 private: | |
39 Log* log_; // The log where to create entries. | |
40 | |
41 const base::ListValue* prefs_; | |
42 std::unordered_set<std::string> events_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(DevToolsEventsLogger); | |
45 }; | |
46 | |
47 #endif // CHROME_TEST_CHROMEDRIVER_DEVTOOLS_EVENTS_LOGGER_H_ | |
OLD | NEW |