| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/test/chromedriver/logging.h" | 5 #include "chrome/test/chromedriver/logging.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 WebDriverLog::~WebDriverLog() { | 145 WebDriverLog::~WebDriverLog() { |
| 146 VLOG(1) << "Log type '" << type_ << "' lost " | 146 VLOG(1) << "Log type '" << type_ << "' lost " |
| 147 << entries_->GetSize() << " entries on destruction"; | 147 << entries_->GetSize() << " entries on destruction"; |
| 148 } | 148 } |
| 149 | 149 |
| 150 scoped_ptr<base::ListValue> WebDriverLog::GetAndClearEntries() { | 150 scoped_ptr<base::ListValue> WebDriverLog::GetAndClearEntries() { |
| 151 scoped_ptr<base::ListValue> ret(entries_.release()); | 151 scoped_ptr<base::ListValue> ret(entries_.release()); |
| 152 entries_.reset(new base::ListValue()); | 152 entries_.reset(new base::ListValue()); |
| 153 return ret.Pass(); | 153 return ret; |
| 154 } | 154 } |
| 155 | 155 |
| 156 std::string WebDriverLog::GetFirstErrorMessage() const { | 156 std::string WebDriverLog::GetFirstErrorMessage() const { |
| 157 for (base::ListValue::iterator it = entries_->begin(); | 157 for (base::ListValue::iterator it = entries_->begin(); |
| 158 it != entries_->end(); | 158 it != entries_->end(); |
| 159 ++it) { | 159 ++it) { |
| 160 base::DictionaryValue* log_entry = NULL; | 160 base::DictionaryValue* log_entry = NULL; |
| 161 (*it)->GetAsDictionary(&log_entry); | 161 (*it)->GetAsDictionary(&log_entry); |
| 162 if (log_entry != NULL) { | 162 if (log_entry != NULL) { |
| 163 std::string level; | 163 std::string level; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 logs.push_back(browser_log); | 288 logs.push_back(browser_log); |
| 289 // If the level is OFF, don't even bother listening for DevTools events. | 289 // If the level is OFF, don't even bother listening for DevTools events. |
| 290 if (browser_log_level != Log::kOff) | 290 if (browser_log_level != Log::kOff) |
| 291 devtools_listeners.push_back(new ConsoleLogger(browser_log)); | 291 devtools_listeners.push_back(new ConsoleLogger(browser_log)); |
| 292 | 292 |
| 293 out_logs->swap(logs); | 293 out_logs->swap(logs); |
| 294 out_devtools_listeners->swap(devtools_listeners); | 294 out_devtools_listeners->swap(devtools_listeners); |
| 295 out_command_listeners->swap(command_listeners); | 295 out_command_listeners->swap(command_listeners); |
| 296 return Status(kOk); | 296 return Status(kOk); |
| 297 } | 297 } |
| OLD | NEW |