| 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/find_element_commands.h" | 5 #include "chrome/test/webdriver/commands/find_element_commands.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/test/webdriver/commands/response.h" | 8 #include "chrome/test/webdriver/commands/response.h" |
| 9 #include "chrome/test/webdriver/error_codes.h" | 9 #include "chrome/test/webdriver/error_codes.h" |
| 10 #include "chrome/test/webdriver/session.h" | 10 #include "chrome/test/webdriver/session.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 if (!GetStringParameter("using", &locator) || | 30 if (!GetStringParameter("using", &locator) || |
| 31 !GetStringParameter("value", &query)) { | 31 !GetStringParameter("value", &query)) { |
| 32 SET_WEBDRIVER_ERROR(response, | 32 SET_WEBDRIVER_ERROR(response, |
| 33 "Request is missing required 'using' and/or 'value' data", kBadRequest); | 33 "Request is missing required 'using' and/or 'value' data", kBadRequest); |
| 34 return; | 34 return; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // TODO(jmikhail): The findElement(s) atom should handle this conversion. | 37 // TODO(jmikhail): The findElement(s) atom should handle this conversion. |
| 38 if (locator == "class name") { | 38 if (locator == "class name") { |
| 39 locator = LocatorType::kClassName; | 39 locator = LocatorType::kClassName; |
| 40 } else if (locator == "css selector") { |
| 41 locator = LocatorType::kCss; |
| 40 } else if (locator == "link text") { | 42 } else if (locator == "link text") { |
| 41 locator = LocatorType::kLinkText; | 43 locator = LocatorType::kLinkText; |
| 42 } else if (locator == "partial link text") { | 44 } else if (locator == "partial link text") { |
| 43 locator = LocatorType::kPartialLinkText; | 45 locator = LocatorType::kPartialLinkText; |
| 44 } else if (locator == "tag name") { | 46 } else if (locator == "tag name") { |
| 45 locator = LocatorType::kTagName; | 47 locator = LocatorType::kTagName; |
| 46 } | 48 } |
| 47 // The other locators do not need conversion. If the client supplied an | 49 // The other locators do not need conversion. If the client supplied an |
| 48 // invalid locator, let it fail in the atom. | 50 // invalid locator, let it fail in the atom. |
| 49 | 51 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 66 ListValue* element_list = new ListValue(); | 68 ListValue* element_list = new ListValue(); |
| 67 for (size_t i = 0; i < elements.size(); ++i) | 69 for (size_t i = 0; i < elements.size(); ++i) |
| 68 element_list->Append(elements[i].ToValue()); | 70 element_list->Append(elements[i].ToValue()); |
| 69 response->SetValue(element_list); | 71 response->SetValue(element_list); |
| 70 } | 72 } |
| 71 } | 73 } |
| 72 response->SetStatus(code); | 74 response->SetStatus(code); |
| 73 } | 75 } |
| 74 | 76 |
| 75 } // namespace webdriver | 77 } // namespace webdriver |
| OLD | NEW |