Skip to content

Commit 401fd7d

Browse files
Andrii MorozAndrii Moroz
authored andcommitted
Merge branch 'WD_1.X_dev' of https://portal-ua.globallogic.com/git/wd into WD_1.X_dev
2 parents efbecbf + 165b392 commit 401fd7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+37667
-39
lines changed

inc/webdriver_access.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#ifndef WEBDRIVER_ACCESS_H
2+
#define WEBDRIVER_ACCESS_H
3+
4+
#include <string>
5+
#include <vector>
6+
#include <list>
7+
#include "base/file_util.h"
8+
9+
namespace webdriver {
10+
11+
struct AccessCommandTable
12+
{
13+
std::string method;
14+
std::string url;
15+
};
16+
17+
struct AccessRule {
18+
long hostIp;
19+
bool isGeneralRule; //for all ip
20+
bool allowed;
21+
std::vector<AccessCommandTable> commandList;
22+
};
23+
24+
class AccessValidator
25+
{
26+
public:
27+
AccessValidator();
28+
~AccessValidator();
29+
void setWhiteList(FilePath &xmlPath);
30+
bool isAllowed(const long &remote_ip, const std::string &url, const std::string &method);
31+
32+
private:
33+
bool convertIpString(const char *str_ip, long *int_ip);
34+
std::list<AccessRule> accessList;
35+
};
36+
37+
} // namespace webdriver
38+
39+
#endif // WEBDRIVER_ACCESS_H

inc/webdriver_server.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ For all options please refer:
6161
#include "base/command_line.h"
6262
#include "base/memory/singleton.h"
6363
#include "base/values.h"
64+
#include "webdriver_access.h"
6465

6566
struct mg_context;
6667
struct mg_connection;
@@ -127,6 +128,7 @@ class Server {
127128
std::string url_base_;
128129
struct mg_context* mg_ctx_;
129130
State state_;
131+
AccessValidator accessValidor;
130132

131133
void DispatchCommand(const std::string& matched_route,
132134
Command* command_ptr,

inc/webdriver_switches.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ class Switches {
7979
/// if parameter specified, user input device enabled
8080
static const char kUserInputDevice[];
8181

82+
/// \page page_webdriver_switches WD Server switches
83+
/// - <b>config</b><br>
84+
/// The path to whitelist file (e.g. whitelist.xml) in
85+
/// XML format with specified list of IP with allowed/disallowed
86+
/// commands for each of them
87+
static const char kWhiteList[];
88+
8289
};
8390

8491
} // namespace webdriver

src/Test/BasicMouseInterfaceTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
class BasicMouseInterfaceTestWidget : public QWidget
77
{
8+
Q_OBJECT
89
public:
910
explicit BasicMouseInterfaceTestWidget(QWidget *parent = 0);
1011

src/Test/CoordinatesTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
class CoordinatesTestWidget : public QWidget
77
{
8+
Q_OBJECT
89
public:
910
CoordinatesTestWidget();
1011
virtual ~CoordinatesTestWidget();

src/Test/DragableWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class DragableWidget : public QWidget
88
{
9+
Q_OBJECT
910
public:
1011
DragableWidget(QWidget *parent = 0);
1112
void setDraggingReportsDestination(QLabel* destination);

src/Test/FindingTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
class FindingTestWidget : public QWidget
77
{
8+
Q_OBJECT
89
public:
910
FindingTestWidget();
1011
virtual ~FindingTestWidget();

src/Test/RestyledLabel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
class RestyledLabel : public QLabel
77
{
8+
Q_OBJECT
89
public:
910
RestyledLabel(const QString &text, QWidget *parent);
1011
};

src/Test/TextHandlingTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
class TextHandlingTestWidget : public QWidget
2929
{
30+
Q_OBJECT
3031
public:
3132
TextHandlingTestWidget();
3233
~TextHandlingTestWidget();

src/Test/TouchTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
class TouchTestWidget : public QWidget
77
{
8+
Q_OBJECT
89
public:
910
explicit TouchTestWidget(QWidget *parent = 0);
1011

0 commit comments

Comments
 (0)