OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/test/chromedriver/logging.h" |
| 6 |
| 7 #include "chrome/test/chromedriver/capabilities.h" |
| 8 #include "chrome/test/chromedriver/chrome/devtools_event_logger.h" |
| 9 #include "chrome/test/chromedriver/chrome/status.h" |
| 10 |
| 11 Status CreateLoggers(const Capabilities& capabilities, |
| 12 ScopedVector<DevToolsEventLogger>* out_loggers) { |
| 13 if (capabilities.logging_prefs) { |
| 14 ScopedVector<DevToolsEventLogger> loggers; |
| 15 for (DictionaryValue::Iterator pref(*capabilities.logging_prefs); |
| 16 !pref.IsAtEnd(); pref.Advance()) { |
| 17 const std::string type = pref.key(); |
| 18 std::string level; |
| 19 if (!pref.value().GetAsString(&level)) { |
| 20 return Status(kUnknownError, |
| 21 "logging level must be a string for log type: " + type); |
| 22 } |
| 23 if ("profiler" == type) { |
| 24 std::vector<std::string> domains; |
| 25 domains.push_back("Network"); |
| 26 domains.push_back("Page"); |
| 27 domains.push_back("Timeline"); |
| 28 loggers.push_back(new DevToolsEventLogger(type, domains, level)); |
| 29 } else { |
| 30 return Status(kUnknownError, "unsupported log type: " + type); |
| 31 } |
| 32 // TODO(klm): Implement and add here the console logger. |
| 33 } |
| 34 out_loggers->swap(loggers); |
| 35 } |
| 36 return Status(kOk); |
| 37 } |
OLD | NEW |