| 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_COMMAND_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ | 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "build/build_config.h" |
| 15 |
| 16 #if defined(OS_MACOX) |
| 14 #include "base/mac/scoped_nsautorelease_pool.h" | 17 #include "base/mac/scoped_nsautorelease_pool.h" |
| 18 #endif |
| 15 | 19 |
| 16 namespace webdriver { | 20 namespace webdriver { |
| 17 | 21 |
| 18 class Error; | 22 class Error; |
| 19 class Response; | 23 class Response; |
| 20 | 24 |
| 21 // Base class for a command mapped to a URL in the WebDriver REST API. Each | 25 // Base class for a command mapped to a URL in the WebDriver REST API. Each |
| 22 // URL may respond to commands sent with a DELETE, GET/HEAD, or POST HTTP | 26 // URL may respond to commands sent with a DELETE, GET/HEAD, or POST HTTP |
| 23 // request. For more information on the WebDriver REST API, see | 27 // request. For more information on the WebDriver REST API, see |
| 24 // http://code.google.com/p/selenium/wiki/JsonWireProtocol | 28 // http://code.google.com/p/selenium/wiki/JsonWireProtocol |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 DictionaryValue** out) const; | 98 DictionaryValue** out) const; |
| 95 | 99 |
| 96 // Provides the command parameter with the given |key| as a list. Returns | 100 // Provides the command parameter with the given |key| as a list. Returns |
| 97 // false if there is no such parameter, or if it is not a list. | 101 // false if there is no such parameter, or if it is not a list. |
| 98 bool GetListParameter(const std::string& key, ListValue** out) const; | 102 bool GetListParameter(const std::string& key, ListValue** out) const; |
| 99 | 103 |
| 100 private: | 104 private: |
| 101 const std::vector<std::string> path_segments_; | 105 const std::vector<std::string> path_segments_; |
| 102 const scoped_ptr<const DictionaryValue> parameters_; | 106 const scoped_ptr<const DictionaryValue> parameters_; |
| 103 | 107 |
| 108 #if defined(OS_MACOX) |
| 104 // An autorelease pool must exist on any thread where Objective C is used, | 109 // An autorelease pool must exist on any thread where Objective C is used, |
| 105 // even implicitly. Otherwise the warning: | 110 // even implicitly. Otherwise the warning: |
| 106 // "Objects autoreleased with no pool in place." | 111 // "Objects autoreleased with no pool in place." |
| 107 // is printed for every object deallocted. Since every incomming command to | 112 // is printed for every object deallocted. Since every incomming command to |
| 108 // chrome driver is allocated a new thread, the release pool is declared here. | 113 // chrome driver is allocated a new thread, the release pool is declared here. |
| 109 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 114 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
| 115 #endif |
| 110 | 116 |
| 111 DISALLOW_COPY_AND_ASSIGN(Command); | 117 DISALLOW_COPY_AND_ASSIGN(Command); |
| 112 }; | 118 }; |
| 113 | 119 |
| 114 } // namespace webdriver | 120 } // namespace webdriver |
| 115 | 121 |
| 116 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ | 122 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_COMMAND_H_ |
| OLD | NEW |