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

Side by Side Diff: chrome/test/chromedriver/performance_logger.h

Issue 429693003: [ChromeDriver] Implementing PerfLoggingPrefs for perf log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Increasing test coverage Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ 5 #ifndef CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_
6 #define CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ 6 #define CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_
7 7
8 #include <string>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "chrome/test/chromedriver/capabilities.h"
10 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" 13 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
11 #include "chrome/test/chromedriver/command_listener.h" 14 #include "chrome/test/chromedriver/command_listener.h"
12 15
13 class Log; 16 class Log;
14 17
15 // Translates DevTools profiler events into Log messages with info level. 18 // Translates DevTools profiler events into Log messages with info level.
16 // 19 //
17 // The message is a JSON string of the following structure: 20 // The message is a JSON string of the following structure:
18 // { 21 // {
19 // "webview": <originating WebView ID>, 22 // "webview": <originating WebView ID>,
20 // "message": { "method": "...", "params": { ... }} // DevTools message. 23 // "message": { "method": "...", "params": { ... }} // DevTools message.
21 // } 24 // }
22 class PerformanceLogger : public DevToolsEventListener, public CommandListener { 25 class PerformanceLogger : public DevToolsEventListener, public CommandListener {
23 public: 26 public:
24 // Creates a PerformanceLogger that creates entries in the given Log object. 27 // Creates a |PerformanceLogger| with default preferences that creates entries
25 // The log is owned elsewhere and must not be null. 28 // in the given Log object. The log is owned elsewhere and must not be null.
26 explicit PerformanceLogger(Log* log); 29 explicit PerformanceLogger(Log* log);
27 30
31 // Creates a |PerformanceLogger| with specific preferences.
32 explicit PerformanceLogger(Log* log, const PerfLoggingPrefs& prefs);
samuong 2014/08/04 06:08:22 don't need to make this explicit
johnmoore 2014/08/04 17:37:58 Done.
33
28 // Enables Page,Network,Timeline events for client, which must not be null. 34 // Enables Page,Network,Timeline events for client, which must not be null.
29 virtual Status OnConnected(DevToolsClient* client) OVERRIDE; 35 virtual Status OnConnected(DevToolsClient* client) OVERRIDE;
30 // Translates an event into a log entry. 36 // Translates an event into a log entry.
31 virtual Status OnEvent(DevToolsClient* client, 37 virtual Status OnEvent(DevToolsClient* client,
32 const std::string& method, 38 const std::string& method,
33 const base::DictionaryValue& params) OVERRIDE; 39 const base::DictionaryValue& params) OVERRIDE;
34 40
35 virtual Status BeforeCommand(const std::string& command_name) OVERRIDE; 41 virtual Status BeforeCommand(const std::string& command_name) OVERRIDE;
36 42
37 // PerformanceLogger subscribes to browser-wide |DevToolsClient| for tracing. 43 // PerformanceLogger subscribes to browser-wide |DevToolsClient| for tracing.
38 virtual bool subscribes_to_browser() OVERRIDE; 44 virtual bool subscribes_to_browser() OVERRIDE;
39 45
40 private: 46 private:
41 Log* log_; // The log where to create entries. 47 Log* log_; // The log where to create entries.
48 PerfLoggingPrefs prefs_;
42 49
43 DISALLOW_COPY_AND_ASSIGN(PerformanceLogger); 50 DISALLOW_COPY_AND_ASSIGN(PerformanceLogger);
44 }; 51 };
45 52
46 #endif // CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_ 53 #endif // CHROME_TEST_CHROMEDRIVER_PERFORMANCE_LOGGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698