forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIEWebDriverManagerCommandExecutor.h
More file actions
108 lines (87 loc) · 3.84 KB
/
Copy pathIEWebDriverManagerCommandExecutor.h
File metadata and controls
108 lines (87 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// 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");
// 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.
#ifndef WEBDRIVER_IE_IEWEBDRIVERMANAGERCOMMANDEXECUTOR_H_
#define WEBDRIVER_IE_IEWEBDRIVERMANAGERCOMMANDEXECUTOR_H_
#include <Objbase.h>
#include <map>
#include <string>
#include <vector>
#include "BrowserFactory.h"
#include "IEWebDriverManager.h"
#include "command.h"
#include "messages.h"
#include "response.h"
namespace webdriver {
// We use a CWindowImpl (creating a hidden window) here because we
// want to synchronize access to the command handler. For that we
// use SendMessage() most of the time, and SendMessage() requires
// a window handle.
class IEWebDriverManagerCommandExecutor : public CWindowImpl<IEWebDriverManagerCommandExecutor> {
public:
DECLARE_WND_CLASS(L"WebDriverWndClass")
BEGIN_MSG_MAP(Session)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WD_SET_COMMAND, OnSetCommand)
MESSAGE_HANDLER(WD_EXEC_COMMAND, OnExecCommand)
MESSAGE_HANDLER(WD_GET_RESPONSE_LENGTH, OnGetResponseLength)
MESSAGE_HANDLER(WD_GET_RESPONSE, OnGetResponse)
MESSAGE_HANDLER(WD_IS_SESSION_VALID, OnIsSessionValid)
MESSAGE_HANDLER(WD_GET_QUIT_STATUS, OnGetQuitStatus)
END_MSG_MAP()
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSetCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnExecCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnGetResponseLength(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnGetResponse(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnIsSessionValid(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnGetQuitStatus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
std::string session_id(void) const { return this->session_id_; }
static unsigned int WINAPI ThreadProc(LPVOID lpParameter);
static bool IsComponentRegistered(void);
std::string current_browser_id(void) const {
return this->current_browser_id_;
}
void set_current_browser_id(const std::string& browser_id) {
this->current_browser_id_ = browser_id;
}
bool is_valid(void) const { return this->is_valid_; }
void set_is_valid(const bool session_is_valid) {
this->is_valid_ = session_is_valid;
}
bool is_quitting(void) const { return this->is_quitting_; }
void set_is_quitting(const bool session_is_quitting) {
this->is_quitting_ = session_is_quitting;
}
BrowserFactory* browser_factory(void) const { return this->factory_; }
int port(void) const { return this->port_; }
int browser_version(void) const { return this->factory_->browser_version(); }
private:
void DispatchCommand(void);
std::string current_browser_id_;
std::string session_id_;
int port_;
Command current_command_;
std::string serialized_response_;
bool is_waiting_;
bool is_valid_;
bool is_quitting_;
BrowserFactory* factory_;
CComPtr<IIEWebDriverManager> manager_;
};
} // namespace webdriver
#endif // WEBDRIVER_IE_IEWEBDRIVERMANAGERCOMMANDEXECUTOR_H_