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

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: Rewrite ConsoleLogger::OnEvent from stringstream to printf. Created 7 years, 7 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/logging.h
diff --git a/chrome/test/chromedriver/logging.h b/chrome/test/chromedriver/logging.h
index 25f46ce17d898d64169d6c1e097193643f337e0e..56b301db1e068497c38ba0c1122e510d5b74bca5 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,29 @@ 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.
jdennett 2013/05/23 03:44:24 That much I could guess from the name ;-) An exam
klm 2013/05/23 15:21:39 Done.
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();
+ // Translates a Log entry level into a WebDriver level and stores the entry.
virtual void AddEntry(const base::Time& time,
Level level,
const std::string& message) OVERRIDE;
using Log::AddEntry; // Inherited overload that takes level and message.
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);
};

Powered by Google App Engine
This is Rietveld 408576698