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