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/create_session.h" | 5 #include "chrome/test/webdriver/commands/create_session.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 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 | 14 |
15 namespace webdriver { | 15 namespace webdriver { |
16 | 16 |
17 void CreateSession::ExecutePost(Response* const response) { | 17 void CreateSession::ExecutePost(Response* const response) { |
18 SessionManager* session_manager = Singleton<SessionManager>::get(); | 18 SessionManager* session_manager = SessionManager::GetInstance(); |
19 std::string session_id; | 19 std::string session_id; |
20 | 20 |
21 if (!session_manager->Create(&session_id)) { | 21 if (!session_manager->Create(&session_id)) { |
22 response->set_status(kUnknownError); | 22 response->set_status(kUnknownError); |
23 response->set_value(Value::CreateStringValue("Failed to create session")); | 23 response->set_value(Value::CreateStringValue("Failed to create session")); |
24 return; | 24 return; |
25 } | 25 } |
26 | 26 |
27 VLOG(1) << "Created session " << session_id; | 27 VLOG(1) << "Created session " << session_id; |
28 std::ostringstream stream; | 28 std::ostringstream stream; |
29 stream << "http://" << session_manager->GetIPAddress() << "/session/" | 29 stream << "http://" << session_manager->GetIPAddress() << "/session/" |
30 << session_id; | 30 << session_id; |
31 response->set_status(kSeeOther); | 31 response->set_status(kSeeOther); |
32 response->set_value(Value::CreateStringValue(stream.str())); | 32 response->set_value(Value::CreateStringValue(stream.str())); |
33 } | 33 } |
34 | 34 |
35 } // namespace webdriver | 35 } // namespace webdriver |
36 | 36 |
OLD | NEW |