| 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 #include "chrome/test/webdriver/commands/webelement_command.h" | 5 #include "chrome/test/webdriver/commands/webelement_command.h" |
| 6 | 6 |
| 7 #include "third_party/webdriver/atoms.h" | 7 #include "third_party/webdriver/atoms.h" |
| 8 #include "chrome/test/webdriver/error_codes.h" | 8 #include "chrome/test/webdriver/error_codes.h" |
| 9 #include "chrome/test/webdriver/utility_functions.h" | 9 #include "chrome/test/webdriver/utility_functions.h" |
| 10 | 10 |
| 11 namespace webdriver { | 11 namespace webdriver { |
| 12 | 12 |
| 13 bool WebElementCommand::Init(Response* const response) { | 13 bool WebElementCommand::Init(Response* const response) { |
| 14 if (WebDriverCommand::Init(response)) { | 14 if (!WebDriverCommand::Init(response)) |
| 15 SET_WEBDRIVER_ERROR(response, "Failure on Init for web element command", | |
| 16 kInternalServerError); | |
| 17 return false; | 15 return false; |
| 18 } | |
| 19 | 16 |
| 20 // There should be at least 5 segments to match | 17 // There should be at least 5 segments to match |
| 21 // "/session/$session/element/$id" | 18 // "/session/$session/element/$id" |
| 22 if (path_segments_.size() < 5) { | 19 if (path_segments_.size() < 5) { |
| 23 SET_WEBDRIVER_ERROR(response, "Path segments is less than 5", | 20 SET_WEBDRIVER_ERROR(response, "Path segments is less than 5", |
| 24 kBadRequest); | 21 kBadRequest); |
| 25 return false; | 22 return false; |
| 26 } | 23 } |
| 27 | 24 |
| 28 // We cannot verify the ID is valid until we execute the command and | 25 // We cannot verify the ID is valid until we execute the command and |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 << "{width:number, height:number} dictionary." << std::endl; | 73 << "{width:number, height:number} dictionary." << std::endl; |
| 77 return false; | 74 return false; |
| 78 } | 75 } |
| 79 | 76 |
| 80 DictionaryValue* dict = static_cast<DictionaryValue*>(result); | 77 DictionaryValue* dict = static_cast<DictionaryValue*>(result); |
| 81 return dict->GetInteger("width", width) && | 78 return dict->GetInteger("width", width) && |
| 82 dict->GetInteger("height", height); | 79 dict->GetInteger("height", height); |
| 83 } | 80 } |
| 84 | 81 |
| 85 } // namespace webdriver | 82 } // namespace webdriver |
| OLD | NEW |