Skip to content

Commit f2cac0d

Browse files
committed
Add LogLevel support for browser log
1 parent c4ce066 commit f2cac0d

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/chrome/test/webdriver/webdriver_automation.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ void Automation::Init(const BrowserOptions& options, int* build_no, Error** erro
111111
qsrand(QTime::currentTime().msec()+10);
112112
sessionId = qrand();
113113

114+
jslogger.SetMinLogLevel(options.browserLogLevel);
115+
114116
QWebView *pStartView = NULL;
115117

116118
//Searching for a allready opened window
@@ -2467,6 +2469,11 @@ base::ListValue* JSLogger::getLog()
24672469
return retVal;
24682470
}
24692471

2472+
void JSLogger::SetMinLogLevel(LogLevel level)
2473+
{
2474+
browserLogger.set_min_log_level(level);
2475+
}
2476+
24702477
void JSLogger::log(QVariant message)
24712478
{
24722479
browserLogger.Log(kInfoLogLevel, message.toString().toStdString());

src/chrome/test/webdriver/webdriver_automation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class JSLogger : public QObject
7979
public:
8080
JSLogger();
8181
base::ListValue* getLog();
82+
void SetMinLogLevel(LogLevel level);
8283

8384
public slots:
8485
void log(QVariant message);
@@ -128,6 +129,9 @@ class Automation : public QObject {
128129
// The name of WebView class that will be created on session init. If empty
129130
// or can't be resolved create default QWebViewExt
130131
std::string browser_class;
132+
133+
//Logging level for browser
134+
LogLevel browserLogLevel;
131135
};
132136

133137
explicit Automation(const Logger& logger);

src/chrome/test/webdriver/webdriver_capabilities_parser.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ Capabilities::Capabilities()
4343
no_website_testing_defaults(false),
4444
prefs(new DictionaryValue()),
4545
proxy(0) {
46-
log_levels[LogType::kDriver] = kAllLogLevel;
46+
log_levels[LogType::kDriver] = kAllLogLevel;
47+
log_levels[LogType::kBrowser] = kAllLogLevel;
4748
}
4849

4950
Capabilities::~Capabilities() { }

src/chrome/test/webdriver/webdriver_session.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Error* Session::Init(const DictionaryValue* capabilities_dict) {
127127
browser_options.user_data_dir = capabilities_.profile;
128128
browser_options.command = capabilities_.command;
129129
browser_options.browser_class = capabilities_.browser_class;
130+
browser_options.browserLogLevel = capabilities_.log_levels[LogType::kBrowser];
130131
if (!capabilities_.no_website_testing_defaults) {
131132
browser_options.ignore_certificate_errors = true;
132133
}

0 commit comments

Comments
 (0)