2015-04-13 12:09:26 -04:00
|
|
|
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
|
// distributed with this work for additional information
|
|
|
|
|
// regarding copyright ownership. The SFC licenses this file
|
|
|
|
|
// to you under the Apache License, Version 2.0 (the "License");
|
2013-01-11 22:18:32 +01:00
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
|
|
#include "WebDriver.h"
|
2017-02-14 09:48:56 -08:00
|
|
|
|
2013-04-10 00:02:15 +04:00
|
|
|
#include "logging.h"
|
2013-01-11 22:18:32 +01:00
|
|
|
|
2017-02-14 09:48:56 -08:00
|
|
|
#include "StringUtilities.h"
|
|
|
|
|
|
2013-03-20 10:59:48 -04:00
|
|
|
webdriver::Server* StartServer(int port,
|
|
|
|
|
const std::wstring& host,
|
|
|
|
|
const std::wstring& log_level,
|
|
|
|
|
const std::wstring& log_file,
|
2014-09-05 02:00:00 +00:00
|
|
|
const std::wstring& version,
|
2015-10-30 15:47:54 -04:00
|
|
|
const std::wstring& whitelist) {
|
2013-04-10 00:02:15 +04:00
|
|
|
LOG(TRACE) << "Entering StartServer";
|
2013-01-11 22:18:32 +01:00
|
|
|
if (server == NULL) {
|
2013-04-10 00:02:15 +04:00
|
|
|
LOG(DEBUG) << "Instantiating webdriver server";
|
|
|
|
|
|
2013-03-21 13:58:47 -04:00
|
|
|
std::string converted_host = webdriver::StringUtilities::ToString(host);
|
|
|
|
|
std::string converted_log_level = webdriver::StringUtilities::ToString(log_level);
|
|
|
|
|
std::string converted_log_file = webdriver::StringUtilities::ToString(log_file);
|
|
|
|
|
std::string converted_version = webdriver::StringUtilities::ToString(version);
|
2015-10-30 15:47:54 -04:00
|
|
|
std::string converted_acl = webdriver::StringUtilities::ToString(whitelist);
|
2013-03-20 10:59:48 -04:00
|
|
|
server = new webdriver::IEServer(port,
|
|
|
|
|
converted_host,
|
|
|
|
|
converted_log_level,
|
|
|
|
|
converted_log_file,
|
2014-09-05 02:00:00 +00:00
|
|
|
converted_version,
|
2015-10-30 15:47:54 -04:00
|
|
|
converted_acl);
|
2013-01-11 22:18:32 +01:00
|
|
|
if (!server->Start()) {
|
2013-04-10 00:02:15 +04:00
|
|
|
LOG(TRACE) << "Starting of IEServer is failed";
|
2013-01-11 22:18:32 +01:00
|
|
|
delete server;
|
|
|
|
|
server = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return server;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 10:59:48 -04:00
|
|
|
void StopServer() {
|
2013-04-10 00:02:15 +04:00
|
|
|
LOG(TRACE) << "Entering StopServer";
|
2013-01-11 22:18:32 +01:00
|
|
|
if (server) {
|
|
|
|
|
server->Stop();
|
|
|
|
|
delete server;
|
|
|
|
|
server = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|