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

Side by Side 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: address Pawel's concerns 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/test/webdriver/session.h" 13 #include "chrome/test/webdriver/session.h"
14 #include "chrome/test/webdriver/session_manager.h" 14 #include "chrome/test/webdriver/session_manager.h"
15 15
16 namespace webdriver { 16 namespace webdriver {
17 17
18 void CreateSession::ExecutePost(Response* const response) { 18 void CreateSession::ExecutePost(Response* const response) {
19 SessionManager* session_manager = SessionManager::GetInstance(); 19 Session* session = new Session();
Jason Leyba 2011/02/14 21:00:23 I think these changes unnecessarily obfuscate who
20 Session* session = session_manager->Create();
21 if (!session) {
22 SET_WEBDRIVER_ERROR(response,
23 "Failed to create session",
24 kInternalServerError);
25 return;
26 }
27
28 std::string session_id = session->id();
29 if (!session->Init()) { 20 if (!session->Init()) {
30 session_manager->Delete(session_id);
31 SET_WEBDRIVER_ERROR(response, 21 SET_WEBDRIVER_ERROR(response,
32 "Failed to initialize session", 22 "Failed to initialize session",
33 kInternalServerError); 23 kInternalServerError);
34 return; 24 return;
35 } 25 }
36 26
37 VLOG(1) << "Created session " << session_id; 27 SessionManager* session_manager = SessionManager::GetInstance();
28 VLOG(1) << "Created session " << session->id();
38 std::ostringstream stream; 29 std::ostringstream stream;
39 stream << "http://" << session_manager->GetAddress() << "/session/" 30 stream << "http://" << session_manager->GetAddress() << "/session/"
40 << session_id; 31 << session->id();
41 response->set_status(kSeeOther); 32 response->set_status(kSeeOther);
42 response->set_value(Value::CreateStringValue(stream.str())); 33 response->set_value(Value::CreateStringValue(stream.str()));
43 } 34 }
44 35
45 } // namespace webdriver 36 } // namespace webdriver
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698