| 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/navigate_commands.h" | 5 #include "chrome/test/webdriver/commands/navigate_commands.h" |
| 6 | 6 |
| 7 namespace webdriver { | 7 namespace webdriver { |
| 8 | 8 |
| 9 ForwardCommand::ForwardCommand(const std::vector<std::string>& path_segments, |
| 10 const DictionaryValue* const parameters) |
| 11 : WebDriverCommand(path_segments, parameters) {} |
| 12 |
| 13 ForwardCommand::~ForwardCommand() {} |
| 14 |
| 15 bool ForwardCommand::DoesPost() { |
| 16 return true; |
| 17 } |
| 18 |
| 9 void ForwardCommand::ExecutePost(Response* const response) { | 19 void ForwardCommand::ExecutePost(Response* const response) { |
| 10 if (!session_->GoForward()) { | 20 if (!session_->GoForward()) { |
| 11 SET_WEBDRIVER_ERROR(response, "GoForward failed", kInternalServerError); | 21 SET_WEBDRIVER_ERROR(response, "GoForward failed", kInternalServerError); |
| 12 return; | 22 return; |
| 13 } | 23 } |
| 14 | 24 |
| 15 session_->set_current_frame_xpath(""); | 25 session_->set_current_frame_xpath(""); |
| 16 response->set_status(kSuccess); | 26 response->set_status(kSuccess); |
| 17 } | 27 } |
| 18 | 28 |
| 29 bool ForwardCommand::RequiresValidTab() { |
| 30 return true; |
| 31 } |
| 32 |
| 33 BackCommand::BackCommand(const std::vector<std::string>& path_segments, |
| 34 const DictionaryValue* const parameters) |
| 35 : WebDriverCommand(path_segments, parameters) {} |
| 36 |
| 37 BackCommand::~BackCommand() {} |
| 38 |
| 39 bool BackCommand::DoesPost() { |
| 40 return true; |
| 41 } |
| 42 |
| 19 void BackCommand::ExecutePost(Response* const response) { | 43 void BackCommand::ExecutePost(Response* const response) { |
| 20 if (!session_->GoBack()) { | 44 if (!session_->GoBack()) { |
| 21 SET_WEBDRIVER_ERROR(response, "GoBack failed", kInternalServerError); | 45 SET_WEBDRIVER_ERROR(response, "GoBack failed", kInternalServerError); |
| 22 return; | 46 return; |
| 23 } | 47 } |
| 24 | 48 |
| 25 session_->set_current_frame_xpath(""); | 49 session_->set_current_frame_xpath(""); |
| 26 response->set_status(kSuccess); | 50 response->set_status(kSuccess); |
| 27 } | 51 } |
| 28 | 52 |
| 53 bool BackCommand::RequiresValidTab() { |
| 54 return true; |
| 55 } |
| 56 |
| 57 RefreshCommand::RefreshCommand(const std::vector<std::string>& path_segments, |
| 58 const DictionaryValue* const parameters) |
| 59 : WebDriverCommand(path_segments, parameters) {} |
| 60 |
| 61 RefreshCommand::~RefreshCommand() {} |
| 62 |
| 63 bool RefreshCommand::DoesPost() { |
| 64 return true; |
| 65 } |
| 66 |
| 29 void RefreshCommand::ExecutePost(Response* const response) { | 67 void RefreshCommand::ExecutePost(Response* const response) { |
| 30 if (!session_->Reload()) { | 68 if (!session_->Reload()) { |
| 31 SET_WEBDRIVER_ERROR(response, "Reload failed", kInternalServerError); | 69 SET_WEBDRIVER_ERROR(response, "Reload failed", kInternalServerError); |
| 32 return; | 70 return; |
| 33 } | 71 } |
| 34 | 72 |
| 35 session_->set_current_frame_xpath(""); | 73 session_->set_current_frame_xpath(""); |
| 36 response->set_status(kSuccess); | 74 response->set_status(kSuccess); |
| 37 } | 75 } |
| 38 | 76 |
| 77 bool RefreshCommand::RequiresValidTab() { |
| 78 return true; |
| 79 } |
| 80 |
| 39 } // namespace webdriver | 81 } // namespace webdriver |
| OLD | NEW |