Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: chrome/browser/chromeos/login/saml/saml_browsertest.cc

Issue 856493004: Update {virtual,override,final} to follow C++11 style in chrome/browser/chromeos/login. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <cstring> 5 #include <cstring>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 http_response->set_content_type("text/html"); 250 http_response->set_content_type("text/html");
251 251
252 return http_response.Pass(); 252 return http_response.Pass();
253 } 253 }
254 254
255 } // namespace 255 } // namespace
256 256
257 class SamlTest : public InProcessBrowserTest { 257 class SamlTest : public InProcessBrowserTest {
258 public: 258 public:
259 SamlTest() : gaia_frame_parent_("signin-frame"), saml_load_injected_(false) {} 259 SamlTest() : gaia_frame_parent_("signin-frame"), saml_load_injected_(false) {}
260 virtual ~SamlTest() {} 260 ~SamlTest() override {}
261 261
262 virtual void SetUp() override { 262 void SetUp() override {
263 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 263 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
264 264
265 // Start the GAIA https wrapper here so that the GAIA URLs can be pointed at 265 // Start the GAIA https wrapper here so that the GAIA URLs can be pointed at
266 // it in SetUpCommandLine(). 266 // it in SetUpCommandLine().
267 gaia_https_forwarder_.reset( 267 gaia_https_forwarder_.reset(
268 new HTTPSForwarder(embedded_test_server()->base_url())); 268 new HTTPSForwarder(embedded_test_server()->base_url()));
269 ASSERT_TRUE(gaia_https_forwarder_->Start()); 269 ASSERT_TRUE(gaia_https_forwarder_->Start());
270 270
271 // Start the SAML IdP https wrapper here so that GAIA can be pointed at it 271 // Start the SAML IdP https wrapper here so that GAIA can be pointed at it
272 // in SetUpCommandLine(). 272 // in SetUpCommandLine().
273 saml_https_forwarder_.reset( 273 saml_https_forwarder_.reset(
274 new HTTPSForwarder(embedded_test_server()->base_url())); 274 new HTTPSForwarder(embedded_test_server()->base_url()));
275 ASSERT_TRUE(saml_https_forwarder_->Start()); 275 ASSERT_TRUE(saml_https_forwarder_->Start());
276 276
277 // Stop IO thread here because no threads are allowed while 277 // Stop IO thread here because no threads are allowed while
278 // spawning sandbox host process. See crbug.com/322732. 278 // spawning sandbox host process. See crbug.com/322732.
279 embedded_test_server()->StopThread(); 279 embedded_test_server()->StopThread();
280 280
281 InProcessBrowserTest::SetUp(); 281 InProcessBrowserTest::SetUp();
282 } 282 }
283 283
284 virtual void SetUpInProcessBrowserTestFixture() override { 284 void SetUpInProcessBrowserTestFixture() override {
285 host_resolver()->AddRule("*", "127.0.0.1"); 285 host_resolver()->AddRule("*", "127.0.0.1");
286 } 286 }
287 287
288 virtual void SetUpCommandLine(base::CommandLine* command_line) override { 288 void SetUpCommandLine(base::CommandLine* command_line) override {
289 command_line->AppendSwitch(switches::kLoginManager); 289 command_line->AppendSwitch(switches::kLoginManager);
290 command_line->AppendSwitch(switches::kForceLoginManagerInTests); 290 command_line->AppendSwitch(switches::kForceLoginManagerInTests);
291 command_line->AppendSwitch(::switches::kDisableBackgroundNetworking); 291 command_line->AppendSwitch(::switches::kDisableBackgroundNetworking);
292 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 292 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
293 293
294 const GURL gaia_url = gaia_https_forwarder_->GetURL(""); 294 const GURL gaia_url = gaia_https_forwarder_->GetURL("");
295 command_line->AppendSwitchASCII(::switches::kGaiaUrl, gaia_url.spec()); 295 command_line->AppendSwitchASCII(::switches::kGaiaUrl, gaia_url.spec());
296 command_line->AppendSwitchASCII(::switches::kLsoUrl, gaia_url.spec()); 296 command_line->AppendSwitchASCII(::switches::kLsoUrl, gaia_url.spec());
297 command_line->AppendSwitchASCII(::switches::kGoogleApisUrl, 297 command_line->AppendSwitchASCII(::switches::kGoogleApisUrl,
298 gaia_url.spec()); 298 gaia_url.spec());
299 299
300 const GURL saml_idp_url = saml_https_forwarder_->GetURL("SAML"); 300 const GURL saml_idp_url = saml_https_forwarder_->GetURL("SAML");
301 fake_saml_idp_.SetUp(saml_idp_url.path(), gaia_url); 301 fake_saml_idp_.SetUp(saml_idp_url.path(), gaia_url);
302 fake_gaia_.RegisterSamlUser(kFirstSAMLUserEmail, saml_idp_url); 302 fake_gaia_.RegisterSamlUser(kFirstSAMLUserEmail, saml_idp_url);
303 fake_gaia_.RegisterSamlUser(kSecondSAMLUserEmail, saml_idp_url); 303 fake_gaia_.RegisterSamlUser(kSecondSAMLUserEmail, saml_idp_url);
304 fake_gaia_.RegisterSamlUser( 304 fake_gaia_.RegisterSamlUser(
305 kHTTPSAMLUserEmail, 305 kHTTPSAMLUserEmail,
306 embedded_test_server()->base_url().Resolve("/SAML")); 306 embedded_test_server()->base_url().Resolve("/SAML"));
307 fake_gaia_.RegisterSamlUser(kDifferentDomainSAMLUserEmail, saml_idp_url); 307 fake_gaia_.RegisterSamlUser(kDifferentDomainSAMLUserEmail, saml_idp_url);
308 308
309 fake_gaia_.Initialize(); 309 fake_gaia_.Initialize();
310 } 310 }
311 311
312 virtual void SetUpOnMainThread() override { 312 void SetUpOnMainThread() override {
313 fake_gaia_.SetFakeMergeSessionParams(kFirstSAMLUserEmail, 313 fake_gaia_.SetFakeMergeSessionParams(kFirstSAMLUserEmail,
314 kTestAuthSIDCookie1, 314 kTestAuthSIDCookie1,
315 kTestAuthLSIDCookie1); 315 kTestAuthLSIDCookie1);
316 316
317 embedded_test_server()->RegisterRequestHandler( 317 embedded_test_server()->RegisterRequestHandler(
318 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_))); 318 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_)));
319 embedded_test_server()->RegisterRequestHandler(base::Bind( 319 embedded_test_server()->RegisterRequestHandler(base::Bind(
320 &FakeSamlIdp::HandleRequest, base::Unretained(&fake_saml_idp_))); 320 &FakeSamlIdp::HandleRequest, base::Unretained(&fake_saml_idp_)));
321 321
322 // Restart the thread as the sandbox host process has already been spawned. 322 // Restart the thread as the sandbox host process has already been spawned.
323 embedded_test_server()->RestartThreadAndListen(); 323 embedded_test_server()->RestartThreadAndListen();
324 324
325 login_screen_load_observer_.reset(new content::WindowedNotificationObserver( 325 login_screen_load_observer_.reset(new content::WindowedNotificationObserver(
326 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, 326 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
327 content::NotificationService::AllSources())); 327 content::NotificationService::AllSources()));
328 } 328 }
329 329
330 virtual void TearDownOnMainThread() override { 330 void TearDownOnMainThread() override {
331 // If the login display is still showing, exit gracefully. 331 // If the login display is still showing, exit gracefully.
332 if (LoginDisplayHostImpl::default_host()) { 332 if (LoginDisplayHostImpl::default_host()) {
333 base::MessageLoop::current()->PostTask(FROM_HERE, 333 base::MessageLoop::current()->PostTask(FROM_HERE,
334 base::Bind(&chrome::AttemptExit)); 334 base::Bind(&chrome::AttemptExit));
335 content::RunMessageLoop(); 335 content::RunMessageLoop();
336 } 336 }
337 } 337 }
338 338
339 WebUILoginDisplay* GetLoginDisplay() { 339 WebUILoginDisplay* GetLoginDisplay() {
340 ExistingUserController* controller = 340 ExistingUserController* controller =
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 SetSignFormField("Email", "fake_user"); 849 SetSignFormField("Email", "fake_user");
850 SetSignFormField("Password", "fake_password"); 850 SetSignFormField("Password", "fake_password");
851 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); 851 ExecuteJsInSigninFrame("document.getElementById('Submit').click();");
852 852
853 WaitForEnrollmentSuccess(); 853 WaitForEnrollmentSuccess();
854 } 854 }
855 855
856 class SAMLPolicyTest : public SamlTest { 856 class SAMLPolicyTest : public SamlTest {
857 public: 857 public:
858 SAMLPolicyTest(); 858 SAMLPolicyTest();
859 virtual ~SAMLPolicyTest(); 859 ~SAMLPolicyTest() override;
860 860
861 // SamlTest: 861 // SamlTest:
862 virtual void SetUpInProcessBrowserTestFixture() override; 862 void SetUpInProcessBrowserTestFixture() override;
863 virtual void SetUpOnMainThread() override; 863 void SetUpOnMainThread() override;
864 864
865 void SetSAMLOfflineSigninTimeLimitPolicy(int limit); 865 void SetSAMLOfflineSigninTimeLimitPolicy(int limit);
866 void EnableTransferSAMLCookiesPolicy(); 866 void EnableTransferSAMLCookiesPolicy();
867 867
868 void ShowGAIALoginForm(); 868 void ShowGAIALoginForm();
869 void LogInWithSAML(const std::string& user_id, 869 void LogInWithSAML(const std::string& user_id,
870 const std::string& auth_sid_cookie, 870 const std::string& auth_sid_cookie,
871 const std::string& auth_lsid_cookie); 871 const std::string& auth_lsid_cookie);
872 872
873 std::string GetCookieValue(const std::string& name); 873 std::string GetCookieValue(const std::string& name);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 kTestAuthSIDCookie1, 1167 kTestAuthSIDCookie1,
1168 kTestAuthLSIDCookie1); 1168 kTestAuthLSIDCookie1);
1169 1169
1170 GetCookies(); 1170 GetCookies();
1171 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); 1171 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName));
1172 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); 1172 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName));
1173 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); 1173 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName));
1174 } 1174 }
1175 1175
1176 } // namespace chromeos 1176 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/reset_browsertest.cc ('k') | chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698