OLD | NEW |
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 <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 for (size_t i = 0; i < extensions_list->GetSize(); ++i) { | 155 for (size_t i = 0; i < extensions_list->GetSize(); ++i) { |
156 std::string base64_extension; | 156 std::string base64_extension; |
157 if (!extensions_list->GetString(i, &base64_extension)) { | 157 if (!extensions_list->GetString(i, &base64_extension)) { |
158 response->SetError(new Error( | 158 response->SetError(new Error( |
159 kBadRequest, "Extension must be a base64 encoded string.")); | 159 kBadRequest, "Extension must be a base64 encoded string.")); |
160 return; | 160 return; |
161 } | 161 } |
162 FilePath extension_file( | 162 FilePath extension_file( |
163 extensions_dir.path().AppendASCII("extension" + | 163 extensions_dir.path().AppendASCII("extension" + |
164 base::IntToString(i))); | 164 base::IntToString(i) + ".crx")); |
165 std::string message; | 165 std::string message; |
166 if (!WriteBase64DataToFile(extension_file, base64_extension, &message)) { | 166 if (!WriteBase64DataToFile(extension_file, base64_extension, &message)) { |
167 response->SetError(new Error(kBadRequest, message)); | 167 response->SetError(new Error(kBadRequest, message)); |
168 return; | 168 return; |
169 } | 169 } |
170 extensions.push_back(extension_file); | 170 extensions.push_back(extension_file); |
171 } | 171 } |
172 } else if (capabilities->HasKey(kExtensions)) { | 172 } else if (capabilities->HasKey(kExtensions)) { |
173 response->SetError(new Error( | 173 response->SetError(new Error( |
174 kBadRequest, "Extensions must be a list of base64 encoded strings")); | 174 kBadRequest, "Extensions must be a list of base64 encoded strings")); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // difficult, and returning the hostname causes perf problems with the python | 214 // difficult, and returning the hostname causes perf problems with the python |
215 // bindings on Windows. | 215 // bindings on Windows. |
216 std::ostringstream stream; | 216 std::ostringstream stream; |
217 stream << SessionManager::GetInstance()->url_base() << "/session/" | 217 stream << SessionManager::GetInstance()->url_base() << "/session/" |
218 << session->id(); | 218 << session->id(); |
219 response->SetStatus(kSeeOther); | 219 response->SetStatus(kSeeOther); |
220 response->SetValue(Value::CreateStringValue(stream.str())); | 220 response->SetValue(Value::CreateStringValue(stream.str())); |
221 } | 221 } |
222 | 222 |
223 } // namespace webdriver | 223 } // namespace webdriver |
OLD | NEW |