Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_WEBDRIVER_COMMAND_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_WEBDRIVER_COMMAND_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_WEBDRIVER_COMMAND_H_ | 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_WEBDRIVER_COMMAND_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "chrome/test/webdriver/session_manager.h" | 11 #include "chrome/test/webdriver/session_manager.h" |
|
kkania
2011/02/09 16:53:13
move this include to the .cc
Joe
2011/02/15 02:30:48
Done.
| |
| 12 #include "chrome/test/webdriver/commands/command.h" | 12 #include "chrome/test/webdriver/commands/command.h" |
| 13 | 13 |
|
kkania
2011/02/09 16:53:13
add "class DictionaryValue;"
Joe
2011/02/15 02:30:48
Done.
| |
| 14 namespace webdriver { | 14 namespace webdriver { |
| 15 | 15 |
|
kkania
2011/02/09 16:53:13
add "class Response;"
add "class Session;"
| |
| 16 // All URLs that are found in the document: | 16 // All URLs that are found in the document: |
| 17 // http://code.google.com/p/selenium/wiki/JsonWireProtocol | 17 // http://code.google.com/p/selenium/wiki/JsonWireProtocol |
| 18 // and are to be supported for all browsers and platforms should inhert | 18 // and are to be supported for all browsers and platforms should inhert |
| 19 // this class. For cases which do not invlove interaction with the | 19 // this class. For cases which do not invlove interaction with the |
| 20 // browser, such a transfering a file, inhert from the Command class | 20 // browser, such a transfering a file, inhert from the Command class |
| 21 // directly. | 21 // directly. |
| 22 class WebDriverCommand : public Command { | 22 class WebDriverCommand : public Command { |
| 23 public: | 23 public: |
| 24 inline WebDriverCommand(const std::vector<std::string> path_segments, | 24 inline WebDriverCommand(const std::vector<std::string>& path_segments, |
| 25 const DictionaryValue* const parameters) | 25 const DictionaryValue* const parameters) |
| 26 : Command(path_segments, parameters), session_(NULL) {} | 26 : Command(path_segments, parameters), session_(NULL) {} |
| 27 virtual ~WebDriverCommand() {} | 27 virtual ~WebDriverCommand() {} |
| 28 | 28 |
| 29 // Initializes this webdriver command by fetching the command session and, | 29 // Initializes this webdriver command by fetching the command session and, |
| 30 // if necessary, verifying the session has a valid TabProxy. | 30 // if necessary, verifying the session has a valid TabProxy. |
| 31 virtual bool Init(Response* const response); | 31 virtual bool Init(Response* const response); |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 static const std::string kElementDictionaryKey; | 34 static const std::string kElementDictionaryKey; |
| 35 | 35 |
| 36 // Tests if |dictionary| contains the kElementDictionaryKey, which | 36 // Tests if |dictionary| contains the kElementDictionaryKey, which |
| 37 // indicates that it represents an element. | 37 // indicates that it represents an element. |
| 38 static bool IsElementIdDictionary(const DictionaryValue* const dictionary); | 38 static bool IsElementIdDictionary(const DictionaryValue* const dictionary); |
| 39 | 39 |
| 40 // Returns the |element_id| as a DictionaryValue that conforms with | 40 // Returns the |element_id| as a DictionaryValue that conforms with |
| 41 // WebDriver's wire protocol. On success, returns a dynamically allocated | 41 // WebDriver's wire protocol. On success, returns a dynamically allocated |
| 42 // object that the caller is responsible for deleting. Returns NULL on | 42 // object that the caller is responsible for deleting. Returns NULL on |
| 43 // failure. | 43 // failure. |
| 44 DictionaryValue* GetElementIdAsDictionaryValue(const std::string& element_id); | 44 DictionaryValue* GetElementIdAsDictionaryValue(const std::string& element_id); |
| 45 | 45 |
| 46 Session* session_; | 46 Session* session_; |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(WebDriverCommand); | 48 DISALLOW_COPY_AND_ASSIGN(WebDriverCommand); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace webdriver | 51 } // namespace webdriver |
| 52 | 52 |
| 53 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_WEBDRIVER_COMMAND_H_ | 53 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_WEBDRIVER_COMMAND_H_ |
| OLD | NEW |