Skip to content

Commit 1c3ce22

Browse files
committed
Merge branch 'WD_1.X_dev' of https://portal-ua.globallogic.com/git/wd into WD_1.X_dev
2 parents d9923b1 + 4e6a5be commit 1c3ce22

File tree

8 files changed

+83
-7
lines changed

8 files changed

+83
-7
lines changed

src/Test/main.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include "webdriver_server.h"
3737
#include "webdriver_view_transitions.h"
3838
#include "versioninfo.h"
39+
#include "webdriver_route_table.h"
40+
#include "shutdown_command.h"
3941

4042
#if (WD_TEST_ENABLE_WEB_VIEW == 1)
4143
#include "extension_qt/web_view_creator.h"
@@ -140,6 +142,12 @@ int main(int argc, char *argv[])
140142
if (0 != wd_server->Configure(cmd_line)) {
141143
return 1;
142144
}
145+
146+
webdriver::RouteTable *routeTableWithShutdownCommand = new webdriver::RouteTable(wd_server->GetRouteTable());
147+
const char shutdownCommandRoute[] = "/-CISCO-shutdown";
148+
routeTableWithShutdownCommand->Add<webdriver::ShutdownCommand>(shutdownCommandRoute);
149+
wd_server->SetRouteTable(routeTableWithShutdownCommand);
150+
143151

144152
setQtSettings();
145153
wd_server->Start();

src/Test/shutdown_command.cc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include "shutdown_command.h"
2+
#include <iostream>
3+
#include "webdriver_server.h"
4+
5+
#include <QtCore/qglobal.h>
6+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
7+
#include <QtConcurrent/QtConcurrentRun>
8+
#include <QtWidgets/QApplication>
9+
#else
10+
#include <QtGui/QApplication>
11+
#endif
12+
13+
namespace webdriver {
14+
15+
ShutdownCommand::ShutdownCommand(const std::vector<std::string> &path_segments,
16+
const base::DictionaryValue * const parameters)
17+
: Command(path_segments, parameters) {}
18+
19+
ShutdownCommand::~ShutdownCommand() { }
20+
21+
void ShutdownCommand::ExecutePost(Response * const response)
22+
{
23+
Server *wd_server = Server::GetInstance();
24+
QApplication::quit();
25+
wd_server->Stop(true);
26+
}
27+
28+
bool ShutdownCommand::DoesPost() const
29+
{
30+
return true;
31+
}
32+
33+
}

src/Test/shutdown_command.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef SHUTDOWN_COMMAND_H
2+
#define SHUTDOWN_COMMAND_H
3+
4+
#include "commands/command.h"
5+
#include "commands/response.h"
6+
7+
namespace webdriver {
8+
9+
class ShutdownCommand : public Command
10+
{
11+
public:
12+
ShutdownCommand(const std::vector<std::string>& path_segments,
13+
const base::DictionaryValue* const parameters);
14+
virtual ~ShutdownCommand();
15+
16+
virtual bool DoesPost() const OVERRIDE;
17+
18+
virtual void ExecutePost(Response* const response) OVERRIDE;
19+
20+
private:
21+
DISALLOW_COPY_AND_ASSIGN(ShutdownCommand);
22+
};
23+
24+
}
25+
26+
#endif // SHUTDOWN_COMMAND_H

src/webdriver/webdriver_route_table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ CommandCreatorPtr RouteTable::GetRouteForURL(const std::string& url, std::string
115115
bool RouteTable::AddRoute(const std::string& uri_pattern,
116116
const CommandCreatorPtr& creator) {
117117
// custom command check
118-
if (!CommandRoutes::IsStandardRoute(uri_pattern)) {
118+
if (false){//!CommandRoutes::IsStandardRoute(uri_pattern)) {
119119
std::vector<std::string> url_segments;
120120
base::SplitString(uri_pattern, '/', &url_segments);
121121

src/webdriver/webdriver_session.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,14 @@ void Session::RemoveView(const ViewId& viewId) {
406406

407407
void Session::UpdateViews(const std::set<ViewId>& views) {
408408
ViewsMap::iterator it;
409+
ViewId vi;
409410

410411
for (it = views_.begin(); it != views_.end(); ++it) {
411-
if (0 == views.count(ViewId(it->first))) {
412+
vi = ViewId(it->first);
413+
414+
if (vi.is_valid() && 0 == views.count(vi)) {
412415
// invalidate handle
413-
RemoveView(ViewId(it->first));
416+
RemoveView(vi);
414417
}
415418
}
416419
}

src/webdriver/webdriver_view_enumerator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void ViewEnumerator::EnumerateViews(Session* session, std::vector<ViewId>* views
1919
std::copy(views_set.begin(), views_set.end(), std::back_inserter(*views));
2020

2121
// update session to remove dangling sessionIds
22-
session->logger().Log(kFineLogLevel, base::StringPrintf("EnumerateViews found %d views.", views_set.size()));
22+
session->logger().Log(kFineLogLevel, base::StringPrintf("EnumerateViews found %d views.", (int)views_set.size()));
2323
session->UpdateViews(views_set);
2424
}
2525

wd_build_options.gypi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@
7777
'action': ['mkdir', '-p', '<(INTERMEDIATE_DIR)'],
7878
} ],
7979

80-
'defines': [
80+
'defines': [
8181
'OS_POSIX',
82-
],
83-
} ],
82+
],
83+
84+
'xcode_settings': {
85+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
86+
},
87+
} ],
8488
],
8589
}

wd_test.gyp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201

202202
'sources': [
203203
'src/Test/main.cc',
204+
'src/Test/shutdown_command.cc',
204205
],
205206

206207
'conditions': [
@@ -256,6 +257,7 @@
256257

257258
'sources': [
258259
'src/Test/main.cc',
260+
'src/Test/shutdown_command.cc',
259261
],
260262

261263
'conditions': [

0 commit comments

Comments
 (0)