| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "chrome/test/webdriver/commands/command.h" | 5 #include "chrome/test/webdriver/commands/command.h" |
| 6 | 6 |
| 7 namespace webdriver { | 7 namespace webdriver { |
| 8 | 8 |
| 9 // Error message taken from: | 9 // Error message taken from: |
| 10 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#Response_Status_Codes | 10 // http://code.google.com/p/selenium/wiki/JsonWireProtocol#Response_Status_Codes |
| 11 const char* const Response::kStatusKey = "status"; | 11 const char* const Response::kStatusKey = "status"; |
| 12 const char* const Response::kValueKey = "value"; | 12 const char* const Response::kValueKey = "value"; |
| 13 const char* const Response::kMessageKey = "message"; | 13 const char* const Response::kMessageKey = "message"; |
| 14 const char* const Response::kScreenKey = "screen"; | 14 const char* const Response::kScreenKey = "screen"; |
| 15 const char* const Response::kClassKey = "class"; | 15 const char* const Response::kClassKey = "class"; |
| 16 const char* const Response::kStackTrace = "stackTrace"; | 16 const char* const Response::kStackTrace = "stackTrace"; |
| 17 const char* const Response::kFileName = "fileName"; | 17 const char* const Response::kFileName = "fileName"; |
| 18 const char* const Response::kLineNumber = "lineNumber"; | 18 const char* const Response::kLineNumber = "lineNumber"; |
| 19 | 19 |
| 20 Command::Command(const std::vector<std::string>& path_segments, |
| 21 const DictionaryValue* const parameters) |
| 22 : path_segments_(path_segments), |
| 23 parameters_(parameters) {} |
| 24 |
| 25 Command::~Command() {} |
| 26 |
| 27 bool Command::DoesDelete() { |
| 28 return false; |
| 29 } |
| 30 |
| 31 bool Command::DoesGet() { |
| 32 return false; |
| 33 } |
| 34 |
| 35 bool Command::DoesPost() { |
| 36 return false; |
| 37 } |
| 38 |
| 39 bool Command::Init(Response* const response) { |
| 40 return true; |
| 41 } |
| 42 |
| 20 bool Command::GetStringParameter(const std::string& key, | 43 bool Command::GetStringParameter(const std::string& key, |
| 21 string16* out) const { | 44 string16* out) const { |
| 22 return parameters_.get() != NULL && parameters_->GetString(key, out); | 45 return parameters_.get() != NULL && parameters_->GetString(key, out); |
| 23 } | 46 } |
| 24 | 47 |
| 25 bool Command::GetStringParameter(const std::string& key, | 48 bool Command::GetStringParameter(const std::string& key, |
| 26 std::string* out) const { | 49 std::string* out) const { |
| 27 return parameters_.get() != NULL && parameters_->GetString(key, out); | 50 return parameters_.get() != NULL && parameters_->GetString(key, out); |
| 28 } | 51 } |
| 29 | 52 |
| 30 bool Command::GetStringASCIIParameter(const std::string& key, | 53 bool Command::GetStringASCIIParameter(const std::string& key, |
| 31 std::string* out) const { | 54 std::string* out) const { |
| 32 return parameters_.get() != NULL && parameters_->GetStringASCII(key, out); | 55 return parameters_.get() != NULL && parameters_->GetStringASCII(key, out); |
| 33 } | 56 } |
| 34 | 57 |
| 35 bool Command::GetBooleanParameter(const std::string& key, | 58 bool Command::GetBooleanParameter(const std::string& key, |
| 36 bool* out) const { | 59 bool* out) const { |
| 37 return parameters_.get() != NULL && parameters_->GetBoolean(key, out); | 60 return parameters_.get() != NULL && parameters_->GetBoolean(key, out); |
| 38 } | 61 } |
| 39 | 62 |
| 40 bool Command::GetIntegerParameter(const std::string& key, | 63 bool Command::GetIntegerParameter(const std::string& key, |
| 41 int* out) const { | 64 int* out) const { |
| 42 return parameters_.get() != NULL && parameters_->GetInteger(key, out); | 65 return parameters_.get() != NULL && parameters_->GetInteger(key, out); |
| 43 } | 66 } |
| 44 | 67 |
| 45 } // namespace webdriver | 68 } // namespace webdriver |
| 46 | 69 |
| OLD | NEW |