Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/test/chromedriver/logging.cc

Issue 14263024: Logging API in chromedriver2. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
12 Status ParseLoggingPrefs(const base::Value& option,
kkania 2013/04/18 17:34:39 move this to the capabilities file
klm 2013/04/18 19:11:31 Done.
13 Capabilities* capabilities) {
14 const base::DictionaryValue* logging_prefs;
15 if (!option.GetAsDictionary(&logging_prefs))
16 return Status(kUnknownError, "'loggingPrefs' must be a dictionary");
17 // TODO(klm): verify log types.
18 // TODO(klm): verify log levels.
19 capabilities->logging_prefs.reset(logging_prefs->DeepCopy());
20 return Status(kOk);
21 }
22
23 Status CreateLoggers(const Capabilities& capabilities,
24 ScopedVector<DevToolsEventLogger>* out_loggers) {
25 ScopedVector<DevToolsEventLogger> loggers;
26 for (DictionaryValue::Iterator pref(*capabilities.logging_prefs);
27 !pref.IsAtEnd(); pref.Advance()) {
28 const std::string type = pref.key();
29 std::string level;
30 if (!pref.value().GetAsString(&level)) {
31 return Status(kUnknownError,
32 "logging level must be a string for log type: " + type);
33 }
34 if ("performance" == type) {
35 std::vector<std::string> domains;
36 domains.push_back("Network");
37 domains.push_back("Page");
38 domains.push_back("Timeline");
39 loggers.push_back(new DevToolsEventLogger(type, domains, level));
40 } else {
41 return Status(kUnknownError, "unsupported log type: " + type);
42 }
43 // TODO(klm): Implement and add here the console logger.
44 }
45 out_loggers->swap(loggers);
46 return Status(kOk);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698