| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/common/wallpaper/wallpaper_controller.h" | 11 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 12 #include "ash/common/wallpaper/wallpaper_controller_observer.h" | 12 #include "ash/common/wallpaper/wallpaper_controller_observer.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 18 #include "base/json/json_writer.h" | 18 #include "base/json/json_writer.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #include "base/run_loop.h" | 21 #include "base/run_loop.h" |
| 22 #include "chrome/browser/chromeos/login/login_manager_test.h" | 22 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 23 #include "chrome/browser/chromeos/login/startup_utils.h" | 23 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 24 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 24 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 25 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 25 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 26 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u
til.h" | 27 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u
til.h" |
| 27 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 28 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 28 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 29 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 29 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 30 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 31 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 33 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 32 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
| 33 #include "chromeos/chromeos_paths.h" | 35 #include "chromeos/chromeos_paths.h" |
| 34 #include "chromeos/chromeos_switches.h" | 36 #include "chromeos/chromeos_switches.h" |
| 35 #include "chromeos/cryptohome/system_salt_getter.h" | 37 #include "chromeos/cryptohome/system_salt_getter.h" |
| 36 #include "chromeos/dbus/cryptohome_client.h" | 38 #include "chromeos/dbus/cryptohome_client.h" |
| 37 #include "chromeos/dbus/dbus_thread_manager.h" | 39 #include "chromeos/dbus/dbus_thread_manager.h" |
| 38 #include "chromeos/dbus/fake_session_manager_client.h" | 40 #include "chromeos/dbus/fake_session_manager_client.h" |
| 39 #include "chromeos/dbus/session_manager_client.h" | 41 #include "chromeos/dbus/session_manager_client.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 user_key_file, | 170 user_key_file, |
| 169 reinterpret_cast<const char*>(user_key_bits.data()), | 171 reinterpret_cast<const char*>(user_key_bits.data()), |
| 170 user_key_bits.size()), | 172 user_key_bits.size()), |
| 171 static_cast<int>(user_key_bits.size())); | 173 static_cast<int>(user_key_bits.size())); |
| 172 user_policy_builder->policy_data().set_username(account_id.GetUserEmail()); | 174 user_policy_builder->policy_data().set_username(account_id.GetUserEmail()); |
| 173 return user_policy_builder; | 175 return user_policy_builder; |
| 174 } | 176 } |
| 175 | 177 |
| 176 // LoginManagerTest: | 178 // LoginManagerTest: |
| 177 void SetUpInProcessBrowserTestFixture() override { | 179 void SetUpInProcessBrowserTestFixture() override { |
| 180 // Set up fake install attributes. |
| 181 std::unique_ptr<chromeos::StubInstallAttributes> attributes = |
| 182 base::MakeUnique<chromeos::StubInstallAttributes>(); |
| 183 attributes->SetEnterprise("fake-domain", "fake-id"); |
| 184 policy::BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting( |
| 185 attributes.release()); |
| 186 |
| 178 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( | 187 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
| 179 std::unique_ptr<SessionManagerClient>(fake_session_manager_client_)); | 188 std::unique_ptr<SessionManagerClient>(fake_session_manager_client_)); |
| 180 | 189 |
| 181 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 190 LoginManagerTest::SetUpInProcessBrowserTestFixture(); |
| 182 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); | 191 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); |
| 183 } | 192 } |
| 184 | 193 |
| 185 void SetUpCommandLine(base::CommandLine* command_line) override { | 194 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 186 // Set the same switches as LoginManagerTest, except that kMultiProfiles is | 195 // Set the same switches as LoginManagerTest, except that kMultiProfiles is |
| 187 // only set when GetParam() is true and except that kLoginProfile is set | 196 // only set when GetParam() is true and except that kLoginProfile is set |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 412 |
| 404 // Wait until default wallpaper has been loaded. | 413 // Wait until default wallpaper has been loaded. |
| 405 RunUntilWallpaperChangeCount(1); | 414 RunUntilWallpaperChangeCount(1); |
| 406 | 415 |
| 407 // Set wallpaper policy to red image. | 416 // Set wallpaper policy to red image. |
| 408 InjectPolicy(0, kRedImageFileName); | 417 InjectPolicy(0, kRedImageFileName); |
| 409 | 418 |
| 410 // Run until wallpaper has changed. | 419 // Run until wallpaper has changed. |
| 411 RunUntilWallpaperChangeCount(2); | 420 RunUntilWallpaperChangeCount(2); |
| 412 ASSERT_EQ(kRedImageColor, GetAverageWallpaperColor()); | 421 ASSERT_EQ(kRedImageColor, GetAverageWallpaperColor()); |
| 422 StartupUtils::MarkOobeCompleted(); |
| 413 } | 423 } |
| 414 | 424 |
| 415 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { | 425 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { |
| 416 LoginUser(testUsers_[0].GetUserEmail()); | 426 LoginUser(testUsers_[0].GetUserEmail()); |
| 417 | 427 |
| 418 // Wait until wallpaper has been loaded. | 428 // Wait until wallpaper has been loaded. |
| 419 RunUntilWallpaperChangeCount(1); | 429 RunUntilWallpaperChangeCount(1); |
| 420 ASSERT_EQ(kRedImageColor, GetAverageWallpaperColor()); | 430 ASSERT_EQ(kRedImageColor, GetAverageWallpaperColor()); |
| 421 } | 431 } |
| 422 | 432 |
| 423 } // namespace chromeos | 433 } // namespace chromeos |
| OLD | NEW |