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