OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/test/webdriver/commands/create_session.h" |
| 6 |
| 7 #include <sstream> |
| 8 #include <string> |
| 9 |
| 10 #include "base/values.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/common/chrome_constants.h" |
| 13 #include "chrome/common/chrome_switches.h" |
| 14 |
| 15 namespace webdriver { |
| 16 |
| 17 void CreateSession::ExecutePost(Response* const response) { |
| 18 SessionManager* session_manager = Singleton<SessionManager>::get(); |
| 19 std::string session_id; |
| 20 LOG(INFO) << "Creating new session"; |
| 21 if (session_manager->Create(&session_id)) { |
| 22 LOG(INFO) << "Created session " << session_id; |
| 23 std::ostringstream stream; |
| 24 stream << "http://" << session_manager->GetIPAddress() << "/session/" |
| 25 << session_id; |
| 26 response->set_status(kSeeOther); |
| 27 response->set_value(Value::CreateStringValue(stream.str())); |
| 28 } else { |
| 29 response->set_status(kUnknownError); |
| 30 response->set_value(Value::CreateStringValue("Failed to create session")); |
| 31 } |
| 32 } |
| 33 } // namespace webdriver |
| 34 |
OLD | NEW |