Index: chrome/test/chromedriver/logging.cc |
diff --git a/chrome/test/chromedriver/logging.cc b/chrome/test/chromedriver/logging.cc |
index 5933f2a8c202cb85786bedfba5fb728b3444017e..94b3a460e3019cf22d34a416e8c9faa4739bfdc9 100644 |
--- a/chrome/test/chromedriver/logging.cc |
+++ b/chrome/test/chromedriver/logging.cc |
@@ -150,6 +150,26 @@ scoped_ptr<base::ListValue> WebDriverLog::GetAndClearEntries() { |
return ret.Pass(); |
} |
+std::string WebDriverLog::GetFirstErrorMessage() const { |
+ for (base::ListValue::iterator it = entries_->begin(); |
+ it != entries_->end(); |
+ ++it) { |
+ base::DictionaryValue* log_entry = NULL; |
+ (*it)->GetAsDictionary(&log_entry); |
+ if (log_entry != NULL) { |
+ std::string level; |
+ if (log_entry->GetString("level", &level)) { |
+ if (level == kLevelToName[Log::kError]) { |
+ std::string message; |
+ if (log_entry->GetString("message", &message)) |
+ return message; |
+ } |
+ } |
+ } |
+ } |
+ return std::string(); |
+} |
+ |
void WebDriverLog::AddEntryTimestamped(const base::Time& timestamp, |
Log::Level level, |
const std::string& source, |