| Index: chrome/test/webdriver/commands/create_session.cc
|
| diff --git a/chrome/test/webdriver/commands/create_session.cc b/chrome/test/webdriver/commands/create_session.cc
|
| index d8f51120cbe67b9812282ed0f9676837634b47a5..a7c0f64a66586f6c2d2b512aa42d729db49ecb0e 100644
|
| --- a/chrome/test/webdriver/commands/create_session.cc
|
| +++ b/chrome/test/webdriver/commands/create_session.cc
|
| @@ -16,28 +16,20 @@
|
| namespace webdriver {
|
|
|
| void CreateSession::ExecutePost(Response* const response) {
|
| - SessionManager* session_manager = SessionManager::GetInstance();
|
| - Session* session = session_manager->Create();
|
| - if (!session) {
|
| - SET_WEBDRIVER_ERROR(response,
|
| - "Failed to create session",
|
| - kInternalServerError);
|
| - return;
|
| - }
|
| -
|
| - std::string session_id = session->id();
|
| + // Session manages its own liftime, so do not call delete.
|
| + Session* session = new Session();
|
| if (!session->Init()) {
|
| - session_manager->Delete(session_id);
|
| SET_WEBDRIVER_ERROR(response,
|
| "Failed to initialize session",
|
| kInternalServerError);
|
| return;
|
| }
|
|
|
| - VLOG(1) << "Created session " << session_id;
|
| + SessionManager* session_manager = SessionManager::GetInstance();
|
| + VLOG(1) << "Created session " << session->id();
|
| std::ostringstream stream;
|
| stream << "http://" << session_manager->GetAddress() << "/session/"
|
| - << session_id;
|
| + << session->id();
|
| response->set_status(kSeeOther);
|
| response->set_value(Value::CreateStringValue(stream.str()));
|
| }
|
|
|