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/session_with_id.h" | 5 #include "chrome/test/webdriver/commands/session_with_id.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
13 | 13 |
14 namespace webdriver { | 14 namespace webdriver { |
15 | 15 |
| 16 SessionWithID::SessionWithID(const std::vector<std::string>& path_segments, |
| 17 const DictionaryValue* const parameters) |
| 18 : WebDriverCommand(path_segments, parameters) {} |
| 19 |
| 20 SessionWithID::~SessionWithID() {} |
| 21 |
| 22 bool SessionWithID::DoesGet() { |
| 23 return true; |
| 24 } |
| 25 |
| 26 bool SessionWithID::DoesDelete() { |
| 27 return true; |
| 28 } |
| 29 |
16 void SessionWithID::ExecuteGet(Response* const response) { | 30 void SessionWithID::ExecuteGet(Response* const response) { |
17 DictionaryValue *temp_value = new DictionaryValue(); | 31 DictionaryValue *temp_value = new DictionaryValue(); |
18 | 32 |
19 temp_value->SetString(std::string("browserName"), | 33 temp_value->SetString(std::string("browserName"), |
20 std::string("chrome")); | 34 std::string("chrome")); |
21 temp_value->SetString(std::string("version"), | 35 temp_value->SetString(std::string("version"), |
22 std::string(chrome::kChromeVersion)); | 36 std::string(chrome::kChromeVersion)); |
23 | 37 |
24 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
25 temp_value->SetString(std::string("platform"), std::string("windows")); | 39 temp_value->SetString(std::string("platform"), std::string("windows")); |
(...skipping 12 matching lines...) Expand all Loading... |
38 response->set_status(kSuccess); | 52 response->set_status(kSuccess); |
39 response->set_value(temp_value); | 53 response->set_value(temp_value); |
40 } | 54 } |
41 | 55 |
42 void SessionWithID::ExecuteDelete(Response* const response) { | 56 void SessionWithID::ExecuteDelete(Response* const response) { |
43 session_->Terminate(); | 57 session_->Terminate(); |
44 SessionManager::GetInstance()->Delete(session_->id()); | 58 SessionManager::GetInstance()->Delete(session_->id()); |
45 response->set_status(kSuccess); | 59 response->set_status(kSuccess); |
46 } | 60 } |
47 | 61 |
| 62 bool SessionWithID::RequiresValidTab() { |
| 63 return false; |
| 64 } |
| 65 |
48 } // namespace webdriver | 66 } // namespace webdriver |
OLD | NEW |