| 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/set_timeout_commands.h" | 5 #include "chrome/test/webdriver/commands/set_timeout_commands.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/test/webdriver/commands/response.h" | 11 #include "chrome/test/webdriver/commands/response.h" |
| 12 #include "chrome/test/webdriver/webdriver_error.h" | 12 #include "chrome/test/webdriver/webdriver_error.h" |
| 13 #include "chrome/test/webdriver/webdriver_session.h" | 13 #include "chrome/test/webdriver/webdriver_session.h" |
| 14 | 14 |
| 15 namespace webdriver { | 15 namespace webdriver { |
| 16 | 16 |
| 17 SetTimeoutCommand::SetTimeoutCommand( | 17 SetTimeoutCommand::SetTimeoutCommand( |
| 18 const std::vector<std::string>& path_segments, | 18 const std::vector<std::string>& path_segments, |
| 19 const DictionaryValue* const parameters) : | 19 DictionaryValue* const parameters) : |
| 20 WebDriverCommand(path_segments, parameters) {} | 20 WebDriverCommand(path_segments, parameters) {} |
| 21 | 21 |
| 22 SetTimeoutCommand::~SetTimeoutCommand() {} | 22 SetTimeoutCommand::~SetTimeoutCommand() {} |
| 23 | 23 |
| 24 bool SetTimeoutCommand::DoesPost() { | 24 bool SetTimeoutCommand::DoesPost() { |
| 25 return true; | 25 return true; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void SetTimeoutCommand::ExecutePost(Response* const response) { | 28 void SetTimeoutCommand::ExecutePost(Response* const response) { |
| 29 // Timeout value in milliseconds | 29 // Timeout value in milliseconds |
| (...skipping 23 matching lines...) Expand all Loading... |
| 53 if (ms_to_wait < 0) { | 53 if (ms_to_wait < 0) { |
| 54 response->SetError(new Error(kBadRequest, "Timeout must be non-negative")); | 54 response->SetError(new Error(kBadRequest, "Timeout must be non-negative")); |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 | 57 |
| 58 SetTimeout(ms_to_wait); | 58 SetTimeout(ms_to_wait); |
| 59 } | 59 } |
| 60 | 60 |
| 61 SetAsyncScriptTimeoutCommand::SetAsyncScriptTimeoutCommand( | 61 SetAsyncScriptTimeoutCommand::SetAsyncScriptTimeoutCommand( |
| 62 const std::vector<std::string>& path_segments, | 62 const std::vector<std::string>& path_segments, |
| 63 const DictionaryValue* const parameters) | 63 DictionaryValue* const parameters) |
| 64 : SetTimeoutCommand(path_segments, parameters) {} | 64 : SetTimeoutCommand(path_segments, parameters) {} |
| 65 | 65 |
| 66 SetAsyncScriptTimeoutCommand::~SetAsyncScriptTimeoutCommand() {} | 66 SetAsyncScriptTimeoutCommand::~SetAsyncScriptTimeoutCommand() {} |
| 67 | 67 |
| 68 void SetAsyncScriptTimeoutCommand::SetTimeout(int timeout_ms) { | 68 void SetAsyncScriptTimeoutCommand::SetTimeout(int timeout_ms) { |
| 69 session_->set_async_script_timeout(timeout_ms); | 69 session_->set_async_script_timeout(timeout_ms); |
| 70 } | 70 } |
| 71 | 71 |
| 72 ImplicitWaitCommand::ImplicitWaitCommand( | 72 ImplicitWaitCommand::ImplicitWaitCommand( |
| 73 const std::vector<std::string>& path_segments, | 73 const std::vector<std::string>& path_segments, |
| 74 const DictionaryValue* const parameters) | 74 DictionaryValue* const parameters) |
| 75 : SetTimeoutCommand(path_segments, parameters) {} | 75 : SetTimeoutCommand(path_segments, parameters) {} |
| 76 | 76 |
| 77 ImplicitWaitCommand::~ImplicitWaitCommand() {} | 77 ImplicitWaitCommand::~ImplicitWaitCommand() {} |
| 78 | 78 |
| 79 void ImplicitWaitCommand::SetTimeout(int timeout_ms) { | 79 void ImplicitWaitCommand::SetTimeout(int timeout_ms) { |
| 80 session_->set_implicit_wait(timeout_ms); | 80 session_->set_implicit_wait(timeout_ms); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace webdriver | 83 } // namespace webdriver |
| OLD | NEW |