| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 login_display->ShowSigninScreenForCreds(username, "password"); | 163 login_display->ShowSigninScreenForCreds(username, "password"); |
| 164 | 164 |
| 165 // Wait for the session to start after submitting the credentials. This | 165 // Wait for the session to start after submitting the credentials. This |
| 166 // will wait until all the background requests are done. | 166 // will wait until all the background requests are done. |
| 167 session_started_observer.Wait(); | 167 session_started_observer.Wait(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Handles an HTTP request sent to the test server. This handler either | 170 // Handles an HTTP request sent to the test server. This handler either |
| 171 // uses a canned response in |responses_| if the request path matches one | 171 // uses a canned response in |responses_| if the request path matches one |
| 172 // of the URLs that we mock, otherwise this handler delegates to |fake_gaia_|. | 172 // of the URLs that we mock, otherwise this handler delegates to |fake_gaia_|. |
| 173 scoped_ptr<net::test_server::HttpResponse> HandleRequest( | 173 std::unique_ptr<net::test_server::HttpResponse> HandleRequest( |
| 174 const net::test_server::HttpRequest& request) { | 174 const net::test_server::HttpRequest& request) { |
| 175 scoped_ptr<net::test_server::HttpResponse> response; | 175 std::unique_ptr<net::test_server::HttpResponse> response; |
| 176 | 176 |
| 177 GaiaUrls* gaia = GaiaUrls::GetInstance(); | 177 GaiaUrls* gaia = GaiaUrls::GetInstance(); |
| 178 if (request.relative_url == gaia->client_login_to_oauth2_url().path() || | 178 if (request.relative_url == gaia->client_login_to_oauth2_url().path() || |
| 179 request.relative_url == gaia->oauth2_token_url().path() || | 179 request.relative_url == gaia->oauth2_token_url().path() || |
| 180 request.relative_url.find(kDMRegisterRequest) == 0 || | 180 request.relative_url.find(kDMRegisterRequest) == 0 || |
| 181 request.relative_url.find(kDMPolicyRequest) == 0) { | 181 request.relative_url.find(kDMPolicyRequest) == 0) { |
| 182 if (!responses_.empty()) { | 182 if (!responses_.empty()) { |
| 183 response.reset(responses_.back()); | 183 response.reset(responses_.back()); |
| 184 responses_.pop_back(); | 184 responses_.pop_back(); |
| 185 } | 185 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 {3, kUsernameOtherDomain, true}, | 328 {3, kUsernameOtherDomain, true}, |
| 329 {4, kUsernameOtherDomain, true}, | 329 {4, kUsernameOtherDomain, true}, |
| 330 {5, kUsernameOtherDomain, true}, | 330 {5, kUsernameOtherDomain, true}, |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, | 333 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, |
| 334 BlockingLoginTest, | 334 BlockingLoginTest, |
| 335 testing::ValuesIn(kBlockinLoginTestCases)); | 335 testing::ValuesIn(kBlockinLoginTestCases)); |
| 336 | 336 |
| 337 } // namespace chromeos | 337 } // namespace chromeos |
| OLD | NEW |