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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 kAccountId2, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), | 395 kAccountId2, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), |
396 public_session_input_method_id_(base::StringPrintf( | 396 public_session_input_method_id_(base::StringPrintf( |
397 kPublicSessionInputMethodIDTemplate, | 397 kPublicSessionInputMethodIDTemplate, |
398 chromeos::extension_ime_util::kXkbExtensionId)), | 398 chromeos::extension_ime_util::kXkbExtensionId)), |
399 contents_(NULL) { | 399 contents_(NULL) { |
400 set_exit_when_last_browser_closes(false); | 400 set_exit_when_last_browser_closes(false); |
401 } | 401 } |
402 | 402 |
403 virtual ~DeviceLocalAccountTest() {} | 403 virtual ~DeviceLocalAccountTest() {} |
404 | 404 |
405 virtual void SetUp() OVERRIDE { | 405 virtual void SetUp() override { |
406 // Configure and start the test server. | 406 // Configure and start the test server. |
407 scoped_ptr<crypto::RSAPrivateKey> signing_key( | 407 scoped_ptr<crypto::RSAPrivateKey> signing_key( |
408 PolicyBuilder::CreateTestSigningKey()); | 408 PolicyBuilder::CreateTestSigningKey()); |
409 ASSERT_TRUE(test_server_.SetSigningKeyAndSignature( | 409 ASSERT_TRUE(test_server_.SetSigningKeyAndSignature( |
410 signing_key.get(), PolicyBuilder::GetTestSigningKeySignature())); | 410 signing_key.get(), PolicyBuilder::GetTestSigningKeySignature())); |
411 signing_key.reset(); | 411 signing_key.reset(); |
412 test_server_.RegisterClient(PolicyBuilder::kFakeToken, | 412 test_server_.RegisterClient(PolicyBuilder::kFakeToken, |
413 PolicyBuilder::kFakeDeviceId); | 413 PolicyBuilder::kFakeDeviceId); |
414 ASSERT_TRUE(test_server_.Start()); | 414 ASSERT_TRUE(test_server_.Start()); |
415 | 415 |
416 BrowserList::AddObserver(this); | 416 BrowserList::AddObserver(this); |
417 | 417 |
418 DevicePolicyCrosBrowserTest::SetUp(); | 418 DevicePolicyCrosBrowserTest::SetUp(); |
419 } | 419 } |
420 | 420 |
421 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 421 virtual void SetUpCommandLine(CommandLine* command_line) override { |
422 DevicePolicyCrosBrowserTest::SetUpCommandLine(command_line); | 422 DevicePolicyCrosBrowserTest::SetUpCommandLine(command_line); |
423 command_line->AppendSwitch(chromeos::switches::kLoginManager); | 423 command_line->AppendSwitch(chromeos::switches::kLoginManager); |
424 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); | 424 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); |
425 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 425 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); |
426 command_line->AppendSwitchASCII(policy::switches::kDeviceManagementUrl, | 426 command_line->AppendSwitchASCII(policy::switches::kDeviceManagementUrl, |
427 test_server_.GetServiceURL().spec()); | 427 test_server_.GetServiceURL().spec()); |
428 } | 428 } |
429 | 429 |
430 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 430 virtual void SetUpInProcessBrowserTestFixture() override { |
431 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); | 431 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); |
432 | 432 |
433 // Clear command-line arguments (but keep command-line switches) so the | 433 // Clear command-line arguments (but keep command-line switches) so the |
434 // startup pages policy takes effect. | 434 // startup pages policy takes effect. |
435 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 435 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
436 CommandLine::StringVector argv(command_line->argv()); | 436 CommandLine::StringVector argv(command_line->argv()); |
437 argv.erase(argv.begin() + argv.size() - command_line->GetArgs().size(), | 437 argv.erase(argv.begin() + argv.size() - command_line->GetArgs().size(), |
438 argv.end()); | 438 argv.end()); |
439 command_line->InitFromArgv(argv); | 439 command_line->InitFromArgv(argv); |
440 | 440 |
441 InstallOwnerKey(); | 441 InstallOwnerKey(); |
442 MarkAsEnterpriseOwned(); | 442 MarkAsEnterpriseOwned(); |
443 | 443 |
444 InitializePolicy(); | 444 InitializePolicy(); |
445 } | 445 } |
446 | 446 |
447 virtual void SetUpOnMainThread() OVERRIDE { | 447 virtual void SetUpOnMainThread() override { |
448 DevicePolicyCrosBrowserTest::SetUpOnMainThread(); | 448 DevicePolicyCrosBrowserTest::SetUpOnMainThread(); |
449 | 449 |
450 initial_locale_ = g_browser_process->GetApplicationLocale(); | 450 initial_locale_ = g_browser_process->GetApplicationLocale(); |
451 initial_language_ = l10n_util::GetLanguage(initial_locale_); | 451 initial_language_ = l10n_util::GetLanguage(initial_locale_); |
452 | 452 |
453 content::WindowedNotificationObserver( | 453 content::WindowedNotificationObserver( |
454 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 454 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
455 content::NotificationService::AllSources()).Wait(); | 455 content::NotificationService::AllSources()).Wait(); |
456 | 456 |
457 chromeos::LoginDisplayHostImpl* host = | 457 chromeos::LoginDisplayHostImpl* host = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 " languageSelect.addEventListener('focus', blurAndReportSuccess);", | 493 " languageSelect.addEventListener('focus', blurAndReportSuccess);", |
494 &done)); | 494 &done)); |
495 | 495 |
496 // Skip to the login screen. | 496 // Skip to the login screen. |
497 chromeos::WizardController* wizard_controller = | 497 chromeos::WizardController* wizard_controller = |
498 chromeos::WizardController::default_controller(); | 498 chromeos::WizardController::default_controller(); |
499 ASSERT_TRUE(wizard_controller); | 499 ASSERT_TRUE(wizard_controller); |
500 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 500 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
501 } | 501 } |
502 | 502 |
503 virtual void TearDownOnMainThread() OVERRIDE { | 503 virtual void TearDownOnMainThread() override { |
504 BrowserList::RemoveObserver(this); | 504 BrowserList::RemoveObserver(this); |
505 | 505 |
506 // This shuts down the login UI. | 506 // This shuts down the login UI. |
507 base::MessageLoop::current()->PostTask(FROM_HERE, | 507 base::MessageLoop::current()->PostTask(FROM_HERE, |
508 base::Bind(&chrome::AttemptExit)); | 508 base::Bind(&chrome::AttemptExit)); |
509 base::RunLoop().RunUntilIdle(); | 509 base::RunLoop().RunUntilIdle(); |
510 } | 510 } |
511 | 511 |
512 virtual void LocalStateChanged( | 512 virtual void LocalStateChanged( |
513 user_manager::UserManager* user_manager) OVERRIDE { | 513 user_manager::UserManager* user_manager) override { |
514 if (run_loop_) | 514 if (run_loop_) |
515 run_loop_->Quit(); | 515 run_loop_->Quit(); |
516 } | 516 } |
517 | 517 |
518 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE { | 518 virtual void OnBrowserRemoved(Browser* browser) override { |
519 if (run_loop_) | 519 if (run_loop_) |
520 run_loop_->Quit(); | 520 run_loop_->Quit(); |
521 } | 521 } |
522 | 522 |
523 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) OVERRIDE { | 523 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) override { |
524 if (run_loop_) | 524 if (run_loop_) |
525 run_loop_->Quit(); | 525 run_loop_->Quit(); |
526 } | 526 } |
527 | 527 |
528 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) OVERRIDE { | 528 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) override { |
529 if (run_loop_) | 529 if (run_loop_) |
530 run_loop_->Quit(); | 530 run_loop_->Quit(); |
531 } | 531 } |
532 | 532 |
533 void InitializePolicy() { | 533 void InitializePolicy() { |
534 device_policy()->policy_data().set_public_key_version(1); | 534 device_policy()->policy_data().set_public_key_version(1); |
535 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); | 535 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); |
536 proto.mutable_show_user_names()->set_show_user_names(true); | 536 proto.mutable_show_user_names()->set_show_user_names(true); |
537 | 537 |
538 device_local_account_policy_.policy_data().set_policy_type( | 538 device_local_account_policy_.policy_data().set_policy_type( |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 ASSERT_TRUE(content::ExecuteScript(contents_, | 2065 ASSERT_TRUE(content::ExecuteScript(contents_, |
2066 "$('tos-accept-button').click();")); | 2066 "$('tos-accept-button').click();")); |
2067 | 2067 |
2068 WaitForSessionStart(); | 2068 WaitForSessionStart(); |
2069 } | 2069 } |
2070 | 2070 |
2071 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2071 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2072 TermsOfServiceDownloadTest, testing::Bool()); | 2072 TermsOfServiceDownloadTest, testing::Bool()); |
2073 | 2073 |
2074 } // namespace policy | 2074 } // namespace policy |
OLD | NEW |