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 3 // found in the LICENSE file. 4 5 #include "chrome/test/webdriver/commands/navigate_commands.h" 6 7 #include "chrome/test/webdriver/commands/response.h" 8 #include "chrome/test/webdriver/webdriver_error.h" 9 #include "chrome/test/webdriver/webdriver_session.h" 10 11 namespace webdriver { 12 13 ForwardCommand::ForwardCommand(const std::vector<std::string>& path_segments, 14 const DictionaryValue* const parameters) 15 : WebDriverCommand(path_segments, parameters) {} 16 17 ForwardCommand::~ForwardCommand() {} 18 19 bool ForwardCommand::DoesPost() { 20 return true; 21 } 22 23 void ForwardCommand::ExecutePost(Response* const response) { 24 Error* error = session_->GoForward(); 25 if (error) 26 response->SetError(error); 27 } 28 29 BackCommand::BackCommand(const std::vector<std::string>& path_segments, 30 const DictionaryValue* const parameters) 31 : WebDriverCommand(path_segments, parameters) {} 32 33 BackCommand::~BackCommand() {} 34 35 bool BackCommand::DoesPost() { 36 return true; 37 } 38 39 void BackCommand::ExecutePost(Response* const response) { 40 Error* error = session_->GoBack(); 41 if (error) 42 response->SetError(error); 43 } 44 45 RefreshCommand::RefreshCommand(const std::vector<std::string>& path_segments, 46 const DictionaryValue* const parameters) 47 : WebDriverCommand(path_segments, parameters) {} 48 49 RefreshCommand::~RefreshCommand() {} 50 51 bool RefreshCommand::DoesPost() { 52 return true; 53 } 54 55 void RefreshCommand::ExecutePost(Response* const response) { 56 Error* error = session_->Reload(); 57 if (error) 58 response->SetError(error); 59 } 60 61 } // namespace webdriver 62