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 |
| 11 #include <utility> |
| 12 |
11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
12 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
13 #include "base/logging.h" | 15 #include "base/logging.h" |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
16 #include "base/time/time.h" | 18 #include "base/time/time.h" |
17 #include "build/build_config.h" | 19 #include "build/build_config.h" |
18 #include "chrome/test/chromedriver/capabilities.h" | 20 #include "chrome/test/chromedriver/capabilities.h" |
19 #include "chrome/test/chromedriver/chrome/console_logger.h" | 21 #include "chrome/test/chromedriver/chrome/console_logger.h" |
20 #include "chrome/test/chromedriver/chrome/status.h" | 22 #include "chrome/test/chromedriver/chrome/status.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 return; | 183 return; |
182 | 184 |
183 std::unique_ptr<base::DictionaryValue> log_entry_dict( | 185 std::unique_ptr<base::DictionaryValue> log_entry_dict( |
184 new base::DictionaryValue()); | 186 new base::DictionaryValue()); |
185 log_entry_dict->SetDouble("timestamp", | 187 log_entry_dict->SetDouble("timestamp", |
186 static_cast<int64_t>(timestamp.ToJsTime())); | 188 static_cast<int64_t>(timestamp.ToJsTime())); |
187 log_entry_dict->SetString("level", LevelToName(level)); | 189 log_entry_dict->SetString("level", LevelToName(level)); |
188 if (!source.empty()) | 190 if (!source.empty()) |
189 log_entry_dict->SetString("source", source); | 191 log_entry_dict->SetString("source", source); |
190 log_entry_dict->SetString("message", message); | 192 log_entry_dict->SetString("message", message); |
191 entries_->Append(log_entry_dict.release()); | 193 entries_->Append(std::move(log_entry_dict)); |
192 } | 194 } |
193 | 195 |
194 const std::string& WebDriverLog::type() const { | 196 const std::string& WebDriverLog::type() const { |
195 return type_; | 197 return type_; |
196 } | 198 } |
197 | 199 |
198 void WebDriverLog::set_min_level(Level min_level) { | 200 void WebDriverLog::set_min_level(Level min_level) { |
199 min_level_ = min_level; | 201 min_level_ = min_level; |
200 } | 202 } |
201 | 203 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 logs.push_back(browser_log); | 291 logs.push_back(browser_log); |
290 // If the level is OFF, don't even bother listening for DevTools events. | 292 // If the level is OFF, don't even bother listening for DevTools events. |
291 if (browser_log_level != Log::kOff) | 293 if (browser_log_level != Log::kOff) |
292 devtools_listeners.push_back(new ConsoleLogger(browser_log)); | 294 devtools_listeners.push_back(new ConsoleLogger(browser_log)); |
293 | 295 |
294 out_logs->swap(logs); | 296 out_logs->swap(logs); |
295 out_devtools_listeners->swap(devtools_listeners); | 297 out_devtools_listeners->swap(devtools_listeners); |
296 out_command_listeners->swap(command_listeners); | 298 out_command_listeners->swap(command_listeners); |
297 return Status(kOk); | 299 return Status(kOk); |
298 } | 300 } |
OLD | NEW |