| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 emptied_ = false; | 163 emptied_ = false; |
| 164 } | 164 } |
| 165 return ret; | 165 return ret; |
| 166 } | 166 } |
| 167 | 167 |
| 168 bool GetFirstErrorMessageFromList(const base::ListValue* list, | 168 bool GetFirstErrorMessageFromList(const base::ListValue* list, |
| 169 std::string* message) { | 169 std::string* message) { |
| 170 for (base::ListValue::const_iterator it = list->begin(); | 170 for (base::ListValue::const_iterator it = list->begin(); |
| 171 it != list->end(); | 171 it != list->end(); |
| 172 ++it) { | 172 ++it) { |
| 173 base::DictionaryValue* log_entry = NULL; | 173 const base::DictionaryValue* log_entry = NULL; |
| 174 (*it)->GetAsDictionary(&log_entry); | 174 it->GetAsDictionary(&log_entry); |
| 175 if (log_entry != NULL) { | 175 if (log_entry != NULL) { |
| 176 std::string level; | 176 std::string level; |
| 177 if (log_entry->GetString("level", &level)) | 177 if (log_entry->GetString("level", &level)) |
| 178 if (level == kLevelToName[Log::kError]) | 178 if (level == kLevelToName[Log::kError]) |
| 179 if (log_entry->GetString("message", message)) | 179 if (log_entry->GetString("message", message)) |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 return false; | 183 return false; |
| 184 } | 184 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 logs.push_back(browser_log); | 318 logs.push_back(browser_log); |
| 319 // If the level is OFF, don't even bother listening for DevTools events. | 319 // If the level is OFF, don't even bother listening for DevTools events. |
| 320 if (browser_log_level != Log::kOff) | 320 if (browser_log_level != Log::kOff) |
| 321 devtools_listeners.push_back(new ConsoleLogger(browser_log)); | 321 devtools_listeners.push_back(new ConsoleLogger(browser_log)); |
| 322 | 322 |
| 323 out_logs->swap(logs); | 323 out_logs->swap(logs); |
| 324 out_devtools_listeners->swap(devtools_listeners); | 324 out_devtools_listeners->swap(devtools_listeners); |
| 325 out_command_listeners->swap(command_listeners); | 325 out_command_listeners->swap(command_listeners); |
| 326 return Status(kOk); | 326 return Status(kOk); |
| 327 } | 327 } |
| OLD | NEW |