OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_TARGET_LOCATOR_COMMANDS_H_ | |
6 #define CHROME_TEST_WEBDRIVER_COMMANDS_TARGET_LOCATOR_COMMANDS_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "chrome/test/webdriver/commands/webdriver_command.h" | |
12 | |
13 namespace base { | |
14 class DictionaryValue; | |
15 } | |
16 | |
17 namespace webdriver { | |
18 | |
19 class Response; | |
20 class ElementId; | |
21 | |
22 // Gets the current window handle. | |
23 // REST URL: /session/:sessionId/window_handle | |
24 class WindowHandleCommand : public WebDriverCommand { | |
25 public: | |
26 WindowHandleCommand(const std::vector<std::string>& path_segments, | |
27 base::DictionaryValue* parameters); | |
28 virtual ~WindowHandleCommand(); | |
29 | |
30 virtual bool DoesGet() OVERRIDE; | |
31 virtual void ExecuteGet(Response* const response) OVERRIDE; | |
32 | |
33 private: | |
34 DISALLOW_COPY_AND_ASSIGN(WindowHandleCommand); | |
35 }; | |
36 | |
37 // Gets a list of all window handles. | |
38 // REST URL: /session/:sessionId/window_handles | |
39 class WindowHandlesCommand : public WebDriverCommand { | |
40 public: | |
41 WindowHandlesCommand(const std::vector<std::string>& path_segments, | |
42 base::DictionaryValue* parameters); | |
43 virtual ~WindowHandlesCommand(); | |
44 | |
45 virtual bool DoesGet() OVERRIDE; | |
46 virtual void ExecuteGet(Response* const response) OVERRIDE; | |
47 | |
48 private: | |
49 DISALLOW_COPY_AND_ASSIGN(WindowHandlesCommand); | |
50 }; | |
51 | |
52 // Switches to the given window as the default window to execute commands on | |
53 // or closes it. | |
54 // REST URL: /session/:sessionId/window | |
55 class WindowCommand : public WebDriverCommand { | |
56 public: | |
57 WindowCommand(const std::vector<std::string>& path_segments, | |
58 base::DictionaryValue* parameters); | |
59 virtual ~WindowCommand(); | |
60 | |
61 virtual bool DoesPost() OVERRIDE; | |
62 virtual bool DoesDelete() OVERRIDE; | |
63 virtual void ExecutePost(Response* const response) OVERRIDE; | |
64 virtual void ExecuteDelete(Response* const response) OVERRIDE; | |
65 | |
66 virtual bool ShouldRunPreAndPostCommandHandlers() OVERRIDE; | |
67 | |
68 private: | |
69 DISALLOW_COPY_AND_ASSIGN(WindowCommand); | |
70 }; | |
71 | |
72 // Switches to the given frame as the default frame to execute commands in. | |
73 // REST URL: /session/:sessionId/frame | |
74 class SwitchFrameCommand : public WebDriverCommand { | |
75 public: | |
76 SwitchFrameCommand(const std::vector<std::string>& path_segments, | |
77 base::DictionaryValue* parameters); | |
78 virtual ~SwitchFrameCommand(); | |
79 | |
80 virtual bool DoesPost() OVERRIDE; | |
81 virtual void ExecutePost(Response* const response) OVERRIDE; | |
82 | |
83 private: | |
84 bool GetWebElementParameter(const std::string& key, ElementId* out) const; | |
85 | |
86 DISALLOW_COPY_AND_ASSIGN(SwitchFrameCommand); | |
87 }; | |
88 | |
89 // Retrieves the active element on the current page. | |
90 class ActiveElementCommand : public WebDriverCommand { | |
91 public: | |
92 ActiveElementCommand(const std::vector<std::string>& path_segments, | |
93 base::DictionaryValue* parameters); | |
94 virtual ~ActiveElementCommand(); | |
95 | |
96 virtual bool DoesPost() OVERRIDE; | |
97 virtual void ExecutePost(Response* const response) OVERRIDE; | |
98 | |
99 private: | |
100 DISALLOW_COPY_AND_ASSIGN(ActiveElementCommand); | |
101 }; | |
102 | |
103 } // namespace webdriver | |
104 | |
105 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_TARGET_LOCATOR_COMMANDS_H_ | |
OLD | NEW |