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); |
}; |