| 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/target_locator_commands.h" | 5 #include "chrome/test/webdriver/commands/target_locator_commands.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/test/webdriver/commands/response.h" | 9 #include "chrome/test/webdriver/commands/response.h" |
| 10 #include "chrome/test/webdriver/webdriver_element_id.h" | 10 #include "chrome/test/webdriver/webdriver_element_id.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 session_->SwitchToTopFrame(); | 126 session_->SwitchToTopFrame(); |
| 127 } else { | 127 } else { |
| 128 error = new Error(kBadRequest, "Invalid 'id' parameter"); | 128 error = new Error(kBadRequest, "Invalid 'id' parameter"); |
| 129 } | 129 } |
| 130 if (error) | 130 if (error) |
| 131 response->SetError(error); | 131 response->SetError(error); |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool SwitchFrameCommand::GetWebElementParameter(const std::string& key, | 134 bool SwitchFrameCommand::GetWebElementParameter(const std::string& key, |
| 135 ElementId* out) const { | 135 ElementId* out) const { |
| 136 DictionaryValue* value; | 136 const DictionaryValue* value; |
| 137 if (!GetDictionaryParameter(key, &value)) | 137 if (!GetDictionaryParameter(key, &value)) |
| 138 return false; | 138 return false; |
| 139 | 139 |
| 140 ElementId id(value); | 140 ElementId id(value); |
| 141 if (!id.is_valid()) | 141 if (!id.is_valid()) |
| 142 return false; | 142 return false; |
| 143 | 143 |
| 144 *out = id; | 144 *out = id; |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 162 Error* error = session_->ExecuteScript( | 162 Error* error = session_->ExecuteScript( |
| 163 "return document.activeElement || document.body", &args, &result); | 163 "return document.activeElement || document.body", &args, &result); |
| 164 if (error) { | 164 if (error) { |
| 165 response->SetError(error); | 165 response->SetError(error); |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 response->SetValue(result); | 168 response->SetValue(result); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace webdriver | 171 } // namespace webdriver |
| OLD | NEW |