| 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 "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
| 6 #include "ash/desktop_background/desktop_background_controller_observer.h" | 6 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/chromeos/login/startup_utils.h" | 28 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 29 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" | 29 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" |
| 30 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 30 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
| 31 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 31 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
| 32 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 32 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 33 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 33 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 34 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 34 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 35 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" | 35 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" |
| 36 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 36 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 37 #include "chrome/browser/chromeos/login/wizard_controller.h" | 37 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 38 #include "chrome/browser/chromeos/ownership/fake_owner_settings_service.h" |
| 38 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 39 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 39 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 40 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 40 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 41 #include "chrome/browser/chromeos/settings/cros_settings.h" | 42 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 42 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 43 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 43 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 44 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 44 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 45 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 45 #include "chrome/browser/extensions/extension_service.h" | 46 #include "chrome/browser/extensions/extension_service.h" |
| 46 #include "chrome/browser/profiles/profile_impl.h" | 47 #include "chrome/browser/profiles/profile_impl.h" |
| 47 #include "chrome/browser/profiles/profile_manager.h" | 48 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 void TearDown() override { | 494 void TearDown() override { |
| 494 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(false); | 495 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(false); |
| 495 OobeBaseTest::TearDown(); | 496 OobeBaseTest::TearDown(); |
| 496 } | 497 } |
| 497 | 498 |
| 498 void SetUpOnMainThread() override { | 499 void SetUpOnMainThread() override { |
| 499 OobeBaseTest::SetUpOnMainThread(); | 500 OobeBaseTest::SetUpOnMainThread(); |
| 500 // Needed to avoid showing Gaia screen instead of owner signin for | 501 // Needed to avoid showing Gaia screen instead of owner signin for |
| 501 // consumer network down test cases. | 502 // consumer network down test cases. |
| 502 StartupUtils::MarkDeviceRegistered(base::Closure()); | 503 StartupUtils::MarkDeviceRegistered(base::Closure()); |
| 504 owner_settings_service_.reset(new chromeos::FakeOwnerSettingsService( |
| 505 ProfileManager::GetPrimaryUserProfile())); |
| 503 } | 506 } |
| 504 | 507 |
| 505 void TearDownOnMainThread() override { | 508 void TearDownOnMainThread() override { |
| 506 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); | 509 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); |
| 507 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); | 510 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); |
| 508 | 511 |
| 509 OobeBaseTest::TearDownOnMainThread(); | 512 OobeBaseTest::TearDownOnMainThread(); |
| 510 | 513 |
| 511 // Clean up while main thread still runs. | 514 // Clean up while main thread still runs. |
| 512 // See http://crbug.com/176659. | 515 // See http://crbug.com/176659. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 523 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? | 526 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? |
| 524 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, | 527 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, |
| 525 base::StringValue(app_id), | 528 base::StringValue(app_id), |
| 526 base::FundamentalValue(diagnostic_mode)); | 529 base::FundamentalValue(diagnostic_mode)); |
| 527 } | 530 } |
| 528 | 531 |
| 529 void ReloadKioskApps() { | 532 void ReloadKioskApps() { |
| 530 SetupTestAppUpdateCheck(); | 533 SetupTestAppUpdateCheck(); |
| 531 | 534 |
| 532 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. | 535 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. |
| 533 KioskAppManager::Get()->RemoveApp(test_app_id_); | 536 KioskAppManager::Get()->RemoveApp(test_app_id_, |
| 534 KioskAppManager::Get()->AddApp(test_app_id_); | 537 owner_settings_service_.get()); |
| 538 KioskAppManager::Get()->AddApp(test_app_id_, owner_settings_service_.get()); |
| 535 } | 539 } |
| 536 | 540 |
| 537 void FireKioskAppSettingsChanged() { | 541 void FireKioskAppSettingsChanged() { |
| 538 KioskAppManager::Get()->UpdateAppData(); | 542 KioskAppManager::Get()->UpdateAppData(); |
| 539 } | 543 } |
| 540 | 544 |
| 541 void SetupTestAppUpdateCheck() { | 545 void SetupTestAppUpdateCheck() { |
| 542 if (!test_app_version().empty()) { | 546 if (!test_app_version().empty()) { |
| 543 fake_cws_->SetUpdateCrx( | 547 fake_cws_->SetUpdateCrx( |
| 544 test_app_id(), test_crx_file(), test_app_version()); | 548 test_app_id(), test_crx_file(), test_app_version()); |
| 545 } | 549 } |
| 546 } | 550 } |
| 547 | 551 |
| 548 void ReloadAutolaunchKioskApps() { | 552 void ReloadAutolaunchKioskApps() { |
| 549 SetupTestAppUpdateCheck(); | 553 SetupTestAppUpdateCheck(); |
| 550 | 554 |
| 551 KioskAppManager::Get()->AddApp(test_app_id_); | 555 KioskAppManager::Get()->AddApp(test_app_id_, owner_settings_service_.get()); |
| 552 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); | 556 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_, |
| 557 owner_settings_service_.get()); |
| 553 } | 558 } |
| 554 | 559 |
| 555 void StartUIForAppLaunch() { | 560 void StartUIForAppLaunch() { |
| 556 if (use_consumer_kiosk_mode_) | 561 if (use_consumer_kiosk_mode_) |
| 557 EnableConsumerKioskMode(); | 562 EnableConsumerKioskMode(); |
| 558 | 563 |
| 559 // Start UI | 564 // Start UI |
| 560 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 565 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
| 561 chromeos::WizardController* wizard_controller = | 566 chromeos::WizardController* wizard_controller = |
| 562 chromeos::WizardController::default_controller(); | 567 chromeos::WizardController::default_controller(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 void set_test_crx_file(const std::string& filename) { | 791 void set_test_crx_file(const std::string& filename) { |
| 787 test_crx_file_ = filename; | 792 test_crx_file_ = filename; |
| 788 } | 793 } |
| 789 const std::string& test_crx_file() const { return test_crx_file_; } | 794 const std::string& test_crx_file() const { return test_crx_file_; } |
| 790 FakeCWS* fake_cws() { return fake_cws_.get(); } | 795 FakeCWS* fake_cws() { return fake_cws_.get(); } |
| 791 | 796 |
| 792 void set_use_consumer_kiosk_mode(bool use) { | 797 void set_use_consumer_kiosk_mode(bool use) { |
| 793 use_consumer_kiosk_mode_ = use; | 798 use_consumer_kiosk_mode_ = use; |
| 794 } | 799 } |
| 795 | 800 |
| 801 scoped_ptr<chromeos::FakeOwnerSettingsService> owner_settings_service_; |
| 802 |
| 796 private: | 803 private: |
| 797 bool use_consumer_kiosk_mode_; | 804 bool use_consumer_kiosk_mode_; |
| 798 std::string test_app_id_; | 805 std::string test_app_id_; |
| 799 std::string test_app_version_; | 806 std::string test_app_version_; |
| 800 std::string test_crx_file_; | 807 std::string test_crx_file_; |
| 801 scoped_ptr<FakeCWS> fake_cws_; | 808 scoped_ptr<FakeCWS> fake_cws_; |
| 802 scoped_ptr<MockUserManager> mock_user_manager_; | 809 scoped_ptr<MockUserManager> mock_user_manager_; |
| 803 | 810 |
| 804 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 811 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
| 805 }; | 812 }; |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 content::WindowedNotificationObserver( | 1989 content::WindowedNotificationObserver( |
| 1983 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1990 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1984 content::NotificationService::AllSources()).Wait(); | 1991 content::NotificationService::AllSources()).Wait(); |
| 1985 | 1992 |
| 1986 // Wait for the wallpaper to load. | 1993 // Wait for the wallpaper to load. |
| 1987 WaitForWallpaper(); | 1994 WaitForWallpaper(); |
| 1988 EXPECT_TRUE(wallpaper_loaded()); | 1995 EXPECT_TRUE(wallpaper_loaded()); |
| 1989 } | 1996 } |
| 1990 | 1997 |
| 1991 } // namespace chromeos | 1998 } // namespace chromeos |
| OLD | NEW |