| 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 #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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool Command::DoesPost() { | 35 bool Command::DoesPost() { |
| 36 return false; | 36 return false; |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool Command::Init(Response* const response) { | 39 bool Command::Init(Response* const response) { |
| 40 return true; | 40 return true; |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool Command::HasParameter(const std::string& key) const { |
| 44 return parameters_.get() && parameters_->HasKey(key); |
| 45 } |
| 46 |
| 43 bool Command::IsNullParameter(const std::string& key) const { | 47 bool Command::IsNullParameter(const std::string& key) const { |
| 44 Value* value; | 48 Value* value; |
| 45 return parameters_.get() && | 49 return parameters_.get() && |
| 46 parameters_->Get(key, &value) && | 50 parameters_->Get(key, &value) && |
| 47 value->IsType(Value::TYPE_NULL); | 51 value->IsType(Value::TYPE_NULL); |
| 48 } | 52 } |
| 49 | 53 |
| 50 bool Command::GetStringParameter(const std::string& key, | 54 bool Command::GetStringParameter(const std::string& key, |
| 51 string16* out) const { | 55 string16* out) const { |
| 52 return parameters_.get() != NULL && parameters_->GetString(key, out); | 56 return parameters_.get() != NULL && parameters_->GetString(key, out); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 65 bool Command::GetBooleanParameter(const std::string& key, | 69 bool Command::GetBooleanParameter(const std::string& key, |
| 66 bool* out) const { | 70 bool* out) const { |
| 67 return parameters_.get() != NULL && parameters_->GetBoolean(key, out); | 71 return parameters_.get() != NULL && parameters_->GetBoolean(key, out); |
| 68 } | 72 } |
| 69 | 73 |
| 70 bool Command::GetIntegerParameter(const std::string& key, | 74 bool Command::GetIntegerParameter(const std::string& key, |
| 71 int* out) const { | 75 int* out) const { |
| 72 return parameters_.get() != NULL && parameters_->GetInteger(key, out); | 76 return parameters_.get() != NULL && parameters_->GetInteger(key, out); |
| 73 } | 77 } |
| 74 | 78 |
| 79 bool Command::GetDoubleParameter(const std::string& key, double* out) const { |
| 80 return parameters_.get() != NULL && parameters_->GetDouble(key, out); |
| 81 } |
| 82 |
| 75 bool Command::GetDictionaryParameter(const std::string& key, | 83 bool Command::GetDictionaryParameter(const std::string& key, |
| 76 DictionaryValue** out) const { | 84 DictionaryValue** out) const { |
| 77 return parameters_.get() != NULL && parameters_->GetDictionary(key, out); | 85 return parameters_.get() != NULL && parameters_->GetDictionary(key, out); |
| 78 } | 86 } |
| 79 | 87 |
| 80 bool Command::GetListParameter(const std::string& key, | 88 bool Command::GetListParameter(const std::string& key, |
| 81 ListValue** out) const { | 89 ListValue** out) const { |
| 82 return parameters_.get() != NULL && parameters_->GetList(key, out); | 90 return parameters_.get() != NULL && parameters_->GetList(key, out); |
| 83 } | 91 } |
| 84 | 92 |
| 85 } // namespace webdriver | 93 } // namespace webdriver |
| OLD | NEW |