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

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

Issue 14591005: C++ readability review from original change https://chromiumcodereview.appspot.com/14263024/ (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Fix types in CHECK comparisons. Created 7 years, 6 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
« no previous file with comments | « chrome/test/chromedriver/chrome/performance_logger_unittest.cc ('k') | chrome/test/chromedriver/logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/logging.h
diff --git a/chrome/test/chromedriver/logging.h b/chrome/test/chromedriver/logging.h
index 25f46ce17d898d64169d6c1e097193643f337e0e..9c741b59841e0dad0e5eb9a49525ebbd961dc9ec 100644
--- a/chrome/test/chromedriver/logging.h
+++ b/chrome/test/chromedriver/logging.h
@@ -18,10 +18,11 @@ class DevToolsEventListener;
class ListValue;
class Status;
-// Accumulates WebDriver Logging API events of a given type and minimum level.
+// Accumulates WebDriver Logging API entries of a given type and minimum level.
// See https://code.google.com/p/selenium/wiki/Logging.
class WebDriverLog : public Log {
public:
+ // Constants corresponding to log entry severity levels in the wire protocol.
enum WebDriverLevel {
kWdAll,
kWdDebug,
@@ -34,22 +35,28 @@ class WebDriverLog : public Log {
// Converts WD wire protocol level name -> WebDriverLevel, false on bad name.
static bool NameToLevel(const std::string& name, WebDriverLevel* out_level);
+ // Creates a WebDriverLog with the given type and minimum level.
WebDriverLog(const std::string& type, WebDriverLevel min_wd_level);
virtual ~WebDriverLog();
+ // Returns this log's type, for the WD wire protocol "/log" and "/log/types".
const std::string& GetType();
+ // Returns entries accumulated so far, as a ListValue ready for serialization
+ // into the wire protocol response to the "/log" command.
+ // The caller assumes ownership of the ListValue, and the WebDriverLog
+ // creates and owns a new empty ListValue for further accumulation.
scoped_ptr<base::ListValue> GetAndClearEntries();
- virtual void AddEntry(const base::Time& time,
- Level level,
- const std::string& message) OVERRIDE;
- using Log::AddEntry; // Inherited overload that takes level and message.
+ // Translates a Log entry level into a WebDriver level and stores the entry.
+ virtual void AddEntryTimestamped(const base::Time& timestamp,
+ Level level,
+ const std::string& message) OVERRIDE;
private:
- const std::string type_;
- const WebDriverLevel min_wd_level_;
- scoped_ptr<base::ListValue> entries_;
+ const std::string type_; // WebDriver log type.
+ const WebDriverLevel min_wd_level_; // Minimum level of entries to store.
+ scoped_ptr<base::ListValue> entries_; // Accumulated entries.
DISALLOW_COPY_AND_ASSIGN(WebDriverLog);
};
« no previous file with comments | « chrome/test/chromedriver/chrome/performance_logger_unittest.cc ('k') | chrome/test/chromedriver/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698