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/browser_connection_commands.h" 6 7 #include <string> 8 9 #include "chrome/test/webdriver/commands/response.h" 10 #include "chrome/test/webdriver/webdriver_error.h" 11 #include "chrome/test/webdriver/webdriver_session.h" 12 13 namespace webdriver { 14 15 BrowserConnectionCommand::BrowserConnectionCommand( 16 const std::vector<std::string>& path_segments, 17 const base::DictionaryValue* const parameters) 18 : WebDriverCommand(path_segments, parameters) {} 19 20 BrowserConnectionCommand::~BrowserConnectionCommand() {} 21 22 bool BrowserConnectionCommand::DoesGet() { 23 return true; 24 } 25 26 void BrowserConnectionCommand::ExecuteGet(Response* const response) { 27 bool online; 28 Error* error = session_->GetBrowserConnectionState(&online); 29 if (error) { 30 response->SetError(error); 31 return; 32 } 33 response->SetValue(new base::FundamentalValue(online)); 34 } 35 36 } // namespace webdriver 37