| 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 Command::Command(const std::vector<std::string>& path_segments, | 9 Command::Command(const std::vector<std::string>& path_segments, |
| 10 const DictionaryValue* const parameters) | 10 DictionaryValue* const parameters) |
| 11 : path_segments_(path_segments), | 11 : path_segments_(path_segments), |
| 12 parameters_(parameters) {} | 12 parameters_(parameters) {} |
| 13 | 13 |
| 14 Command::~Command() {} | 14 Command::~Command() {} |
| 15 | 15 |
| 16 bool Command::DoesDelete() { | 16 bool Command::DoesDelete() { |
| 17 return false; | 17 return false; |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool Command::DoesGet() { | 20 bool Command::DoesGet() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 std::string Command::GetPathVariable(const size_t i) const { | 34 std::string Command::GetPathVariable(const size_t i) const { |
| 35 return i < path_segments_.size() ? path_segments_.at(i) : ""; | 35 return i < path_segments_.size() ? path_segments_.at(i) : ""; |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool Command::HasParameter(const std::string& key) const { | 38 bool Command::HasParameter(const std::string& key) const { |
| 39 return parameters_.get() && parameters_->HasKey(key); | 39 return parameters_.get() && parameters_->HasKey(key); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool Command::IsNullParameter(const std::string& key) const { | 42 bool Command::IsNullParameter(const std::string& key) const { |
| 43 Value* value; | 43 const Value* value; |
| 44 return parameters_.get() && | 44 return parameters_.get() && |
| 45 parameters_->Get(key, &value) && | 45 parameters_->Get(key, &value) && |
| 46 value->IsType(Value::TYPE_NULL); | 46 value->IsType(Value::TYPE_NULL); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool Command::GetStringParameter(const std::string& key, | 49 bool Command::GetStringParameter(const std::string& key, |
| 50 string16* out) const { | 50 string16* out) const { |
| 51 return parameters_.get() != NULL && parameters_->GetString(key, out); | 51 return parameters_.get() != NULL && parameters_->GetString(key, out); |
| 52 } | 52 } |
| 53 | 53 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 74 bool Command::GetDoubleParameter(const std::string& key, double* out) const { | 74 bool Command::GetDoubleParameter(const std::string& key, double* out) const { |
| 75 return parameters_.get() != NULL && parameters_->GetDouble(key, out); | 75 return parameters_.get() != NULL && parameters_->GetDouble(key, out); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool Command::GetDictionaryParameter(const std::string& key, | 78 bool Command::GetDictionaryParameter(const std::string& key, |
| 79 DictionaryValue** out) const { | 79 DictionaryValue** out) const { |
| 80 return parameters_.get() != NULL && parameters_->GetDictionary(key, out); | 80 return parameters_.get() != NULL && parameters_->GetDictionary(key, out); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool Command::GetListParameter(const std::string& key, | 83 bool Command::GetListParameter(const std::string& key, |
| 84 ListValue** out) const { | 84 const ListValue** out) const { |
| 85 return parameters_.get() != NULL && parameters_->GetList(key, out); | 85 return parameters_.get() != NULL && parameters_->GetList(key, out); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace webdriver | 88 } // namespace webdriver |
| OLD | NEW |