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

Side by Side Diff: chrome/test/webdriver/commands/create_session.cc

Issue 23526047: Delete old chromedriver code, and remove mongoose webserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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
(Empty)
1 // Copyright (c) 2012 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 <string>
8
9 #include "base/command_line.h"
10 #include "base/files/file_path.h"
11 #include "base/files/scoped_temp_dir.h"
12 #include "base/values.h"
13 #include "chrome/test/webdriver/commands/response.h"
14 #include "chrome/test/webdriver/webdriver_error.h"
15 #include "chrome/test/webdriver/webdriver_session.h"
16 #include "chrome/test/webdriver/webdriver_session_manager.h"
17
18 namespace webdriver {
19
20 CreateSession::CreateSession(const std::vector<std::string>& path_segments,
21 const base::DictionaryValue* const parameters)
22 : Command(path_segments, parameters) {}
23
24 CreateSession::~CreateSession() {}
25
26 bool CreateSession::DoesPost() { return true; }
27
28 void CreateSession::ExecutePost(Response* const response) {
29 const base::DictionaryValue* dict;
30 if (!GetDictionaryParameter("desiredCapabilities", &dict)) {
31 response->SetError(new Error(
32 kBadRequest, "Missing or invalid 'desiredCapabilities'"));
33 return;
34 }
35
36 // Session manages its own liftime, so do not call delete.
37 Session* session = new Session();
38 Error* error = session->Init(dict);
39 if (error) {
40 response->SetError(error);
41 return;
42 }
43
44 // Redirect to a relative URI. Although prohibited by the HTTP standard,
45 // this is what the IEDriver does. Finding the actual IP address is
46 // difficult, and returning the hostname causes perf problems with the python
47 // bindings on Windows.
48 std::ostringstream stream;
49 stream << SessionManager::GetInstance()->url_base() << "/session/"
50 << session->id();
51 response->SetStatus(kSeeOther);
52 response->SetValue(new base::StringValue(stream.str()));
53 }
54
55 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/commands/create_session.h ('k') | chrome/test/webdriver/commands/execute_async_script_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698