| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/test/webdriver/commands/title_command.h" | 7 #include "chrome/test/webdriver/commands/title_command.h" |
| 8 | 8 |
| 9 namespace webdriver { | 9 namespace webdriver { |
| 10 | 10 |
| 11 TitleCommand::TitleCommand(const std::vector<std::string>& path_segments, |
| 12 const DictionaryValue* const parameters) |
| 13 : WebDriverCommand(path_segments, parameters) {} |
| 14 |
| 15 TitleCommand::~TitleCommand() {} |
| 16 |
| 17 bool TitleCommand::DoesGet() { |
| 18 return true; |
| 19 } |
| 20 |
| 11 void TitleCommand::ExecuteGet(Response* const response) { | 21 void TitleCommand::ExecuteGet(Response* const response) { |
| 12 std::string title; | 22 std::string title; |
| 13 if (!session_->GetTabTitle(&title)) { | 23 if (!session_->GetTabTitle(&title)) { |
| 14 SET_WEBDRIVER_ERROR(response, "GetTabTitle failed", kInternalServerError); | 24 SET_WEBDRIVER_ERROR(response, "GetTabTitle failed", kInternalServerError); |
| 15 return; | 25 return; |
| 16 } | 26 } |
| 17 | 27 |
| 18 response->set_value(new StringValue(title)); | 28 response->set_value(new StringValue(title)); |
| 19 response->set_status(kSuccess); | 29 response->set_status(kSuccess); |
| 20 } | 30 } |
| 21 | 31 |
| 32 bool TitleCommand::RequiresValidTab() { |
| 33 return true; |
| 34 } |
| 35 |
| 22 } // namespace webdriver | 36 } // namespace webdriver |
| OLD | NEW |