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/find_element_commands.h" | 5 #include "chrome/test/webdriver/commands/find_element_commands.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // Searching under a custom root if the URL pattern is | 45 // Searching under a custom root if the URL pattern is |
46 // "/session/$session/element/$id/element(s)" | 46 // "/session/$session/element/$id/element(s)" |
47 root_element_id_ = GetPathVariable(4); | 47 root_element_id_ = GetPathVariable(4); |
48 | 48 |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 void FindElementCommand::ExecutePost(Response* const response) { | 52 void FindElementCommand::ExecutePost(Response* const response) { |
53 scoped_ptr<ListValue> args(new ListValue()); | 53 scoped_ptr<ListValue> args(new ListValue()); |
54 DictionaryValue* locator = new DictionaryValue(); | 54 DictionaryValue* locator = new DictionaryValue(); |
55 ErrorCode error; | 55 ErrorCode error = 0; // clang (complex flow) |
56 std::wstring jscript; | 56 std::wstring jscript; |
57 Value* result = NULL; | 57 Value* result = NULL; |
58 bool done = false; | 58 bool done = false; |
59 | 59 |
60 // Set the command we are using to locate the value beging searched for. | 60 // Set the command we are using to locate the value beging searched for. |
61 locator->SetString(use_, value_); | 61 locator->SetString(use_, value_); |
62 args->Append(locator); | 62 args->Append(locator); |
63 args->Append(root_element_id_.size() == 0 ? Value::CreateNullValue() : | 63 args->Append(root_element_id_.size() == 0 ? Value::CreateNullValue() : |
64 WebDriverCommand::GetElementIdAsDictionaryValue(root_element_id_)); | 64 WebDriverCommand::GetElementIdAsDictionaryValue(root_element_id_)); |
65 if (find_one_element_) { | 65 if (find_one_element_) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 done = done || elapsed_time > session_->implicit_wait(); | 103 done = done || elapsed_time > session_->implicit_wait(); |
104 base::PlatformThread::Sleep(50); // Prevent a busy loop that eats the cpu. | 104 base::PlatformThread::Sleep(50); // Prevent a busy loop that eats the cpu. |
105 } | 105 } |
106 | 106 |
107 response->set_value(result); | 107 response->set_value(result); |
108 response->set_status(error); | 108 response->set_status(error); |
109 } | 109 } |
110 | 110 |
111 } // namespace webdriver | 111 } // namespace webdriver |
112 | 112 |
OLD | NEW |