Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2196)

Unified Diff: chrome/test/webdriver/commands/create_session.cc

Issue 6507015: Implement the target locator commands for ChromeDriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/webdriver/commands/command.cc ('k') | chrome/test/webdriver/commands/session_with_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9f30d15ee444e948aaf1d95cd2a19d2440f44aed..86344444fd76e9587fb08e51faa1ca3e6826802d 100644
--- a/chrome/test/webdriver/commands/create_session.cc
+++ b/chrome/test/webdriver/commands/create_session.cc
@@ -24,28 +24,20 @@ CreateSession::~CreateSession() {}
bool CreateSession::DoesPost() { return true; }
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()));
}
« no previous file with comments | « chrome/test/webdriver/commands/command.cc ('k') | chrome/test/webdriver/commands/session_with_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698