| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 9 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 10 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 10 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 30 |
| 31 using net::test_server::BasicHttpResponse; | 31 using net::test_server::BasicHttpResponse; |
| 32 using net::test_server::HttpRequest; | 32 using net::test_server::HttpRequest; |
| 33 using net::test_server::HttpResponse; | 33 using net::test_server::HttpResponse; |
| 34 | 34 |
| 35 namespace chromeos { | 35 namespace chromeos { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 const char kTestAuthSIDCookie[] = "fake-auth-SID-cookie"; |
| 40 const char kTestAuthLSIDCookie[] = "fake-auth-LSID-cookie"; |
| 39 const char kTestAuthCode[] = "fake-auth-code"; | 41 const char kTestAuthCode[] = "fake-auth-code"; |
| 40 const char kTestGaiaUberToken[] = "fake-uber-token"; | 42 const char kTestGaiaUberToken[] = "fake-uber-token"; |
| 41 const char kTestAuthLoginAccessToken[] = "fake-access-token"; | 43 const char kTestAuthLoginAccessToken[] = "fake-access-token"; |
| 42 const char kTestRefreshToken[] = "fake-refresh-token"; | 44 const char kTestRefreshToken[] = "fake-refresh-token"; |
| 43 const char kTestSessionSIDCookie[] = "fake-session-SID-cookie"; | 45 const char kTestSessionSIDCookie[] = "fake-session-SID-cookie"; |
| 44 const char kTestSessionLSIDCookie[] = "fake-session-LSID-cookie"; | 46 const char kTestSessionLSIDCookie[] = "fake-session-LSID-cookie"; |
| 45 | 47 |
| 46 const char kRelayState[] = "RelayState"; | 48 const char kRelayState[] = "RelayState"; |
| 47 | 49 |
| 48 const char kDefaultIdpHtml[] = | 50 const char kDefaultIdpHtml[] = |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 GURL::Replacements replace_saml_idp_host; | 170 GURL::Replacements replace_saml_idp_host; |
| 169 replace_saml_idp_host.SetHostStr(saml_idp_host); | 171 replace_saml_idp_host.SetHostStr(saml_idp_host); |
| 170 GURL saml_idp_url = server_url.ReplaceComponents(replace_saml_idp_host); | 172 GURL saml_idp_url = server_url.ReplaceComponents(replace_saml_idp_host); |
| 171 saml_idp_url = saml_idp_url.Resolve("/SAML/SSO"); | 173 saml_idp_url = saml_idp_url.Resolve("/SAML/SSO"); |
| 172 | 174 |
| 173 fake_saml_idp_.SetUp(saml_idp_url.path(), gaia_url_); | 175 fake_saml_idp_.SetUp(saml_idp_url.path(), gaia_url_); |
| 174 fake_gaia_.RegisterSamlUser("saml_user", saml_idp_url); | 176 fake_gaia_.RegisterSamlUser("saml_user", saml_idp_url); |
| 175 } | 177 } |
| 176 | 178 |
| 177 virtual void SetUpOnMainThread() OVERRIDE { | 179 virtual void SetUpOnMainThread() OVERRIDE { |
| 178 fake_gaia_.SetAuthTokens(kTestAuthCode, | 180 FakeGaia::MergeSessionParams params; |
| 179 kTestRefreshToken, | 181 params.auth_sid_cookie = kTestAuthSIDCookie; |
| 180 kTestAuthLoginAccessToken, | 182 params.auth_lsid_cookie = kTestAuthLSIDCookie; |
| 181 kTestGaiaUberToken, | 183 params.auth_code = kTestAuthCode; |
| 182 kTestSessionSIDCookie, | 184 params.refresh_token = kTestRefreshToken; |
| 183 kTestSessionLSIDCookie); | 185 params.access_token = kTestAuthLoginAccessToken; |
| 186 params.gaia_uber_token = kTestGaiaUberToken; |
| 187 params.session_sid_cookie = kTestSessionSIDCookie; |
| 188 params.session_lsid_cookie = kTestSessionLSIDCookie; |
| 189 fake_gaia_.SetMergeSessionParams(params); |
| 184 | 190 |
| 185 embedded_test_server()->RegisterRequestHandler( | 191 embedded_test_server()->RegisterRequestHandler( |
| 186 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_))); | 192 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_))); |
| 187 embedded_test_server()->RegisterRequestHandler(base::Bind( | 193 embedded_test_server()->RegisterRequestHandler(base::Bind( |
| 188 &FakeSamlIdp::HandleRequest, base::Unretained(&fake_saml_idp_))); | 194 &FakeSamlIdp::HandleRequest, base::Unretained(&fake_saml_idp_))); |
| 189 | 195 |
| 190 // Restart the thread as the sandbox host process has already been spawned. | 196 // Restart the thread as the sandbox host process has already been spawned. |
| 191 embedded_test_server()->RestartThreadAndListen(); | 197 embedded_test_server()->RestartThreadAndListen(); |
| 192 } | 198 } |
| 193 | 199 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 SetSignFormField("Email", "fake_user"); | 394 SetSignFormField("Email", "fake_user"); |
| 389 ExecuteJsInSigninFrame("document.getElementById('IdPForm').submit();"); | 395 ExecuteJsInSigninFrame("document.getElementById('IdPForm').submit();"); |
| 390 | 396 |
| 391 OobeScreenWaiter(OobeDisplay::SCREEN_MESSAGE_BOX).Wait(); | 397 OobeScreenWaiter(OobeDisplay::SCREEN_MESSAGE_BOX).Wait(); |
| 392 JsExpect( | 398 JsExpect( |
| 393 "$('message-box-title').textContent == " | 399 "$('message-box-title').textContent == " |
| 394 "loadTimeData.getString('noPasswordWarningTitle')"); | 400 "loadTimeData.getString('noPasswordWarningTitle')"); |
| 395 } | 401 } |
| 396 | 402 |
| 397 } // namespace chromeos | 403 } // namespace chromeos |
| OLD | NEW |