OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "chrome/browser/chrome_browser_main.h" | 7 #include "chrome/browser/chrome_browser_main.h" |
8 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 8 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
9 #include "chrome/browser/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
10 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 10 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete()); | 169 EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete()); |
170 delete test_server_; // Destructor wants UI thread. | 170 delete test_server_; // Destructor wants UI thread. |
171 } | 171 } |
172 | 172 |
173 scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { | 173 scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { |
174 GURL url = test_server_->GetURL(request.relative_url); | 174 GURL url = test_server_->GetURL(request.relative_url); |
175 LOG(INFO) << "Http request: " << url.spec(); | 175 LOG(INFO) << "Http request: " << url.spec(); |
176 | 176 |
177 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); | 177 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); |
178 if (url.path() == "/ServiceLogin") { | 178 if (url.path() == "/ServiceLogin") { |
179 http_response->set_code(net::test_server::SUCCESS); | 179 http_response->set_code(net::HTTP_OK); |
180 http_response->set_content(service_login_response_); | 180 http_response->set_content(service_login_response_); |
181 http_response->set_content_type("text/html"); | 181 http_response->set_content_type("text/html"); |
182 } else if (url.path() == "/ServiceLoginAuth") { | 182 } else if (url.path() == "/ServiceLoginAuth") { |
183 LOG(INFO) << "Params: " << request.content; | 183 LOG(INFO) << "Params: " << request.content; |
184 static const char kContinueParam[] = "continue="; | 184 static const char kContinueParam[] = "continue="; |
185 int continue_arg_begin = request.content.find(kContinueParam) + | 185 int continue_arg_begin = request.content.find(kContinueParam) + |
186 arraysize(kContinueParam) - 1; | 186 arraysize(kContinueParam) - 1; |
187 int continue_arg_end = request.content.find("&", continue_arg_begin); | 187 int continue_arg_end = request.content.find("&", continue_arg_begin); |
188 const std::string continue_url = request.content.substr( | 188 const std::string continue_url = request.content.substr( |
189 continue_arg_begin, continue_arg_end - continue_arg_begin); | 189 continue_arg_begin, continue_arg_end - continue_arg_begin); |
190 http_response->set_code(net::test_server::SUCCESS); | 190 http_response->set_code(net::HTTP_OK); |
191 const std::string redirect_js = | 191 const std::string redirect_js = |
192 "document.location.href = unescape('" + continue_url + "');"; | 192 "document.location.href = unescape('" + continue_url + "');"; |
193 http_response->set_content( | 193 http_response->set_content( |
194 "<HTML><HEAD><SCRIPT>\n" + redirect_js + "\n</SCRIPT></HEAD></HTML>"); | 194 "<HTML><HEAD><SCRIPT>\n" + redirect_js + "\n</SCRIPT></HEAD></HTML>"); |
195 http_response->set_content_type("text/html"); | 195 http_response->set_content_type("text/html"); |
196 } else { | 196 } else { |
197 NOTREACHED() << url.path(); | 197 NOTREACHED() << url.path(); |
198 } | 198 } |
199 return http_response.PassAs<HttpResponse>(); | 199 return http_response.PassAs<HttpResponse>(); |
200 } | 200 } |
(...skipping 13 matching lines...) Expand all Loading... |
214 wizard_controller->SkipToLoginForTesting(); | 214 wizard_controller->SkipToLoginForTesting(); |
215 | 215 |
216 scoped_refptr<content::MessageLoopRunner> runner = | 216 scoped_refptr<content::MessageLoopRunner> runner = |
217 new content::MessageLoopRunner; | 217 new content::MessageLoopRunner; |
218 content_browser_client_->browser_main_extra_parts_->set_quit_task( | 218 content_browser_client_->browser_main_extra_parts_->set_quit_task( |
219 runner->QuitClosure()); | 219 runner->QuitClosure()); |
220 runner->Run(); | 220 runner->Run(); |
221 } | 221 } |
222 | 222 |
223 } // namespace | 223 } // namespace |
OLD | NEW |