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" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/string_util.h" |
13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 16 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
16 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 17 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
17 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 18 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
18 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
20 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 21 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
21 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Handles an HTTP request sent to the test server. This handler either | 171 // 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 | 172 // 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_|. | 173 // of the URLs that we mock, otherwise this handler delegates to |fake_gaia_|. |
173 std::unique_ptr<net::test_server::HttpResponse> HandleRequest( | 174 std::unique_ptr<net::test_server::HttpResponse> HandleRequest( |
174 const net::test_server::HttpRequest& request) { | 175 const net::test_server::HttpRequest& request) { |
175 std::unique_ptr<net::test_server::HttpResponse> response; | 176 std::unique_ptr<net::test_server::HttpResponse> response; |
176 | 177 |
177 GaiaUrls* gaia = GaiaUrls::GetInstance(); | 178 GaiaUrls* gaia = GaiaUrls::GetInstance(); |
178 if (request.relative_url == gaia->client_login_to_oauth2_url().path() || | 179 if (request.relative_url == gaia->client_login_to_oauth2_url().path() || |
179 request.relative_url == gaia->oauth2_token_url().path() || | 180 request.relative_url == gaia->oauth2_token_url().path() || |
180 request.relative_url.find(kDMRegisterRequest) == 0 || | 181 base::StartsWith(request.relative_url, kDMRegisterRequest, |
181 request.relative_url.find(kDMPolicyRequest) == 0) { | 182 base::CompareCase::SENSITIVE) || |
| 183 base::StartsWith(request.relative_url, kDMPolicyRequest, |
| 184 base::CompareCase::SENSITIVE)) { |
182 if (!responses_.empty()) { | 185 if (!responses_.empty()) { |
183 response.reset(responses_.back()); | 186 response.reset(responses_.back()); |
184 responses_.pop_back(); | 187 responses_.pop_back(); |
185 } | 188 } |
186 } | 189 } |
187 | 190 |
188 return response; | 191 return response; |
189 } | 192 } |
190 | 193 |
191 // Creates a new canned response that will respond with the given HTTP | 194 // Creates a new canned response that will respond with the given HTTP |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 {3, kUsernameOtherDomain, true}, | 331 {3, kUsernameOtherDomain, true}, |
329 {4, kUsernameOtherDomain, true}, | 332 {4, kUsernameOtherDomain, true}, |
330 {5, kUsernameOtherDomain, true}, | 333 {5, kUsernameOtherDomain, true}, |
331 }; | 334 }; |
332 | 335 |
333 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, | 336 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, |
334 BlockingLoginTest, | 337 BlockingLoginTest, |
335 testing::ValuesIn(kBlockinLoginTestCases)); | 338 testing::ValuesIn(kBlockinLoginTestCases)); |
336 | 339 |
337 } // namespace chromeos | 340 } // namespace chromeos |
OLD | NEW |