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

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

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/test/webdriver/commands/response.h" 13 #include "chrome/test/webdriver/commands/response.h"
14 #include "chrome/test/webdriver/webdriver_error.h" 14 #include "chrome/test/webdriver/webdriver_error.h"
15 #include "chrome/test/webdriver/webdriver_session.h" 15 #include "chrome/test/webdriver/webdriver_session.h"
16 #include "chrome/test/webdriver/webdriver_session_manager.h" 16 #include "chrome/test/webdriver/webdriver_session_manager.h"
17 17
18 namespace webdriver { 18 namespace webdriver {
19 19
20 CreateSession::CreateSession(const std::vector<std::string>& path_segments, 20 CreateSession::CreateSession(const std::vector<std::string>& path_segments,
21 const DictionaryValue* const parameters) 21 const DictionaryValue* const parameters)
22 : Command(path_segments, parameters) {} 22 : Command(path_segments, parameters) {}
23 23
24 CreateSession::~CreateSession() {} 24 CreateSession::~CreateSession() {}
25 25
26 bool CreateSession::DoesPost() { return true; } 26 bool CreateSession::DoesPost() { return true; }
27 27
28 void CreateSession::ExecutePost(Response* const response) { 28 void CreateSession::ExecutePost(Response* const response) {
29 DictionaryValue* dict; 29 const DictionaryValue* dict;
30 if (!GetDictionaryParameter("desiredCapabilities", &dict)) { 30 if (!GetDictionaryParameter("desiredCapabilities", &dict)) {
31 response->SetError(new Error( 31 response->SetError(new Error(
32 kBadRequest, "Missing or invalid 'desiredCapabilities'")); 32 kBadRequest, "Missing or invalid 'desiredCapabilities'"));
33 return; 33 return;
34 } 34 }
35 35
36 // Session manages its own liftime, so do not call delete. 36 // Session manages its own liftime, so do not call delete.
37 Session* session = new Session(); 37 Session* session = new Session();
38 Error* error = session->Init(dict); 38 Error* error = session->Init(dict);
39 if (error) { 39 if (error) {
40 response->SetError(error); 40 response->SetError(error);
41 return; 41 return;
42 } 42 }
43 43
44 // Redirect to a relative URI. Although prohibited by the HTTP standard, 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 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 46 // difficult, and returning the hostname causes perf problems with the python
47 // bindings on Windows. 47 // bindings on Windows.
48 std::ostringstream stream; 48 std::ostringstream stream;
49 stream << SessionManager::GetInstance()->url_base() << "/session/" 49 stream << SessionManager::GetInstance()->url_base() << "/session/"
50 << session->id(); 50 << session->id();
51 response->SetStatus(kSeeOther); 51 response->SetStatus(kSeeOther);
52 response->SetValue(Value::CreateStringValue(stream.str())); 52 response->SetValue(Value::CreateStringValue(stream.str()));
53 } 53 }
54 54
55 } // namespace webdriver 55 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/commands/cookie_commands.cc ('k') | chrome/test/webdriver/commands/execute_async_script_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698