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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 emptied_ = false; | 164 emptied_ = false; |
165 } | 165 } |
166 return ret; | 166 return ret; |
167 } | 167 } |
168 | 168 |
169 bool GetFirstErrorMessageFromList(const base::ListValue* list, | 169 bool GetFirstErrorMessageFromList(const base::ListValue* list, |
170 std::string* message) { | 170 std::string* message) { |
171 for (base::ListValue::const_iterator it = list->begin(); | 171 for (base::ListValue::const_iterator it = list->begin(); |
172 it != list->end(); | 172 it != list->end(); |
173 ++it) { | 173 ++it) { |
174 const base::DictionaryValue* log_entry = NULL; | 174 base::DictionaryValue* log_entry = NULL; |
175 it->GetAsDictionary(&log_entry); | 175 (*it)->GetAsDictionary(&log_entry); |
176 if (log_entry != NULL) { | 176 if (log_entry != NULL) { |
177 std::string level; | 177 std::string level; |
178 if (log_entry->GetString("level", &level)) | 178 if (log_entry->GetString("level", &level)) |
179 if (level == kLevelToName[Log::kError]) | 179 if (level == kLevelToName[Log::kError]) |
180 if (log_entry->GetString("message", message)) | 180 if (log_entry->GetString("message", message)) |
181 return true; | 181 return true; |
182 } | 182 } |
183 } | 183 } |
184 return false; | 184 return false; |
185 } | 185 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( | 321 devtools_listeners.push_back( |
322 base::MakeUnique<ConsoleLogger>(logs.back().get())); | 322 base::MakeUnique<ConsoleLogger>(logs.back().get())); |
323 | 323 |
324 out_logs->swap(logs); | 324 out_logs->swap(logs); |
325 out_devtools_listeners->swap(devtools_listeners); | 325 out_devtools_listeners->swap(devtools_listeners); |
326 out_command_listeners->swap(command_listeners); | 326 out_command_listeners->swap(command_listeners); |
327 return Status(kOk); | 327 return Status(kOk); |
328 } | 328 } |
OLD | NEW |