| 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" |
| 11 #include "base/threading/platform_thread.h" |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "third_party/webdriver/atoms.h" | 14 #include "third_party/webdriver/atoms.h" |
| 14 #include "chrome/test/webdriver/error_codes.h" | 15 #include "chrome/test/webdriver/error_codes.h" |
| 15 #include "chrome/test/webdriver/utility_functions.h" | 16 #include "chrome/test/webdriver/utility_functions.h" |
| 16 | 17 |
| 17 namespace webdriver { | 18 namespace webdriver { |
| 18 | 19 |
| 19 bool FindElementCommand::Init(Response* const response) { | 20 bool FindElementCommand::Init(Response* const response) { |
| 20 if (!WebDriverCommand::Init(response)) { | 21 if (!WebDriverCommand::Init(response)) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 (result->GetType() == Value::TYPE_LIST && | 94 (result->GetType() == Value::TYPE_LIST && |
| 94 static_cast<ListValue*>(result)->GetSize() > 0); | 95 static_cast<ListValue*>(result)->GetSize() > 0); |
| 95 } else if (error != kNoSuchElement) { | 96 } else if (error != kNoSuchElement) { |
| 96 SET_WEBDRIVER_ERROR(response, "Internal error in find_element atom", | 97 SET_WEBDRIVER_ERROR(response, "Internal error in find_element atom", |
| 97 kInternalServerError); | 98 kInternalServerError); |
| 98 return; | 99 return; |
| 99 } | 100 } |
| 100 | 101 |
| 101 int64 elapsed_time = (base::Time::Now() - start_time).InMilliseconds(); | 102 int64 elapsed_time = (base::Time::Now() - start_time).InMilliseconds(); |
| 102 done = done || elapsed_time > session_->implicit_wait(); | 103 done = done || elapsed_time > session_->implicit_wait(); |
| 103 PlatformThread::Sleep(50); // Prevent a busy loop that eats the cpu. | 104 base::PlatformThread::Sleep(50); // Prevent a busy loop that eats the cpu. |
| 104 } | 105 } |
| 105 | 106 |
| 106 response->set_value(result); | 107 response->set_value(result); |
| 107 response->set_status(error); | 108 response->set_status(error); |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace webdriver | 111 } // namespace webdriver |
| 111 | 112 |
| OLD | NEW |