Chromium Code Reviews| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/desktop_background_controller_observer.h" | 9 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 20 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 21 #include "chrome/browser/chromeos/login/login_manager_test.h" | 21 #include "chrome/browser/chromeos/login/login_manager_test_helper.h" |
| 22 #include "chrome/browser/chromeos/login/startup_utils.h" | 22 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 23 #include "chrome/browser/chromeos/login/user.h" | 23 #include "chrome/browser/chromeos/login/user.h" |
| 24 #include "chrome/browser/chromeos/login/user_manager.h" | 24 #include "chrome/browser/chromeos/login/user_manager.h" |
| 25 #include "chrome/browser/chromeos/login/wallpaper_manager.h" | 25 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
| 26 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u til.h" | 26 #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" | 27 #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" | 28 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/test/base/in_process_browser_test.h" | |
| 32 #include "chromeos/chromeos_paths.h" | 33 #include "chromeos/chromeos_paths.h" |
| 33 #include "chromeos/chromeos_switches.h" | 34 #include "chromeos/chromeos_switches.h" |
| 34 #include "chromeos/dbus/cryptohome_client.h" | 35 #include "chromeos/dbus/cryptohome_client.h" |
| 35 #include "chromeos/dbus/dbus_thread_manager.h" | 36 #include "chromeos/dbus/dbus_thread_manager.h" |
| 36 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 37 #include "chromeos/dbus/fake_dbus_thread_manager.h" |
| 37 #include "chromeos/dbus/fake_session_manager_client.h" | 38 #include "chromeos/dbus/fake_session_manager_client.h" |
| 38 #include "chromeos/dbus/session_manager_client.h" | 39 #include "chromeos/dbus/session_manager_client.h" |
| 39 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 40 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 40 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 41 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 41 #include "components/policy/core/common/cloud/cloud_policy_validator.h" | 42 #include "components/policy/core/common/cloud/cloud_policy_validator.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 return SkColorSetARGB(0, 0, 0, 0); | 124 return SkColorSetARGB(0, 0, 0, 0); |
| 124 } | 125 } |
| 125 | 126 |
| 126 const SkBitmap& bitmap = representation.sk_bitmap(); | 127 const SkBitmap& bitmap = representation.sk_bitmap(); |
| 127 return ComputeAverageColor(bitmap); | 128 return ComputeAverageColor(bitmap); |
| 128 } | 129 } |
| 129 | 130 |
| 130 } // namespace | 131 } // namespace |
| 131 | 132 |
| 132 class WallpaperManagerPolicyTest | 133 class WallpaperManagerPolicyTest |
| 133 : public LoginManagerTest, | 134 : public InProcessBrowserTest, |
| 134 public ash::DesktopBackgroundControllerObserver, | 135 public ash::DesktopBackgroundControllerObserver, |
| 135 public testing::WithParamInterface<bool> { | 136 public testing::WithParamInterface<bool> { |
| 136 protected: | 137 protected: |
| 137 WallpaperManagerPolicyTest() | 138 WallpaperManagerPolicyTest() |
| 138 : LoginManagerTest(true), | 139 : wallpaper_change_count_(0), |
| 139 wallpaper_change_count_(0), | 140 login_manager_test_helper_(new LoginManagerTestHelper(true)), |
| 140 fake_dbus_thread_manager_(new FakeDBusThreadManager), | 141 fake_dbus_thread_manager_(new FakeDBusThreadManager), |
| 141 fake_session_manager_client_(new FakeSessionManagerClient) { | 142 fake_session_manager_client_(new FakeSessionManagerClient) { |
| 143 set_exit_when_last_browser_closes(false); | |
| 142 fake_dbus_thread_manager_->SetFakeClients(); | 144 fake_dbus_thread_manager_->SetFakeClients(); |
| 143 fake_dbus_thread_manager_->SetSessionManagerClient( | 145 fake_dbus_thread_manager_->SetSessionManagerClient( |
| 144 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); | 146 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); |
| 145 } | 147 } |
| 146 | 148 |
| 147 scoped_ptr<policy::UserPolicyBuilder> GetUserPolicyBuilder( | 149 scoped_ptr<policy::UserPolicyBuilder> GetUserPolicyBuilder( |
| 148 const std::string& user_id) { | 150 const std::string& user_id) { |
| 149 scoped_ptr<policy::UserPolicyBuilder> | 151 scoped_ptr<policy::UserPolicyBuilder> |
| 150 user_policy_builder(new policy::UserPolicyBuilder()); | 152 user_policy_builder(new policy::UserPolicyBuilder()); |
| 151 base::FilePath user_keys_dir; | 153 base::FilePath user_keys_dir; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 164 reinterpret_cast<const char*>(user_key_bits.data()), | 166 reinterpret_cast<const char*>(user_key_bits.data()), |
| 165 user_key_bits.size()), | 167 user_key_bits.size()), |
| 166 static_cast<int>(user_key_bits.size())); | 168 static_cast<int>(user_key_bits.size())); |
| 167 user_policy_builder->policy_data().set_username(user_id); | 169 user_policy_builder->policy_data().set_username(user_id); |
| 168 return user_policy_builder.Pass(); | 170 return user_policy_builder.Pass(); |
| 169 } | 171 } |
| 170 | 172 |
| 171 // LoginManagerTest: | 173 // LoginManagerTest: |
| 172 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 174 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 173 DBusThreadManager::SetInstanceForTesting(fake_dbus_thread_manager_); | 175 DBusThreadManager::SetInstanceForTesting(fake_dbus_thread_manager_); |
| 174 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 176 login_manager_test_helper_->SetUpLoginUtils(); |
| 175 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); | 177 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); |
| 176 } | 178 } |
| 177 | 179 |
| 178 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 180 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 179 // Set the same switches as LoginManagerTest, except that kMultiProfiles is | 181 // Set the same switches as LoginManagerTestHelper, except that |
| 180 // only set when GetParam() is true and except that kLoginProfile is set | 182 // kMultiProfiles is only set when GetParam() is true and kLoginProfile is |
| 181 // when GetParam() is false. The latter seems to be required for the sane | 183 // set when GetParam() is false. The latter seems to be required for the |
| 182 // start-up of user profiles. | 184 // sanestart-up of user profiles. |
|
michaelpg
2014/05/07 00:55:05
"sane start-up"
michaelpg
2014/05/07 02:48:24
Done.
| |
| 183 command_line->AppendSwitch(switches::kLoginManager); | 185 command_line->AppendSwitch(switches::kLoginManager); |
| 184 command_line->AppendSwitch(switches::kForceLoginManagerInTests); | 186 command_line->AppendSwitch(switches::kForceLoginManagerInTests); |
| 185 if (GetParam()) | 187 if (GetParam()) |
| 186 command_line->AppendSwitch(::switches::kMultiProfiles); | 188 command_line->AppendSwitch(::switches::kMultiProfiles); |
| 187 else | 189 else |
| 188 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 190 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 189 } | 191 } |
| 190 | 192 |
| 191 virtual void SetUpOnMainThread() OVERRIDE { | 193 virtual void SetUpOnMainThread() OVERRIDE { |
| 192 LoginManagerTest::SetUpOnMainThread(); | 194 login_manager_test_helper_->SetUp(); |
| 193 ash::Shell::GetInstance()-> | 195 ash::Shell::GetInstance()-> |
| 194 desktop_background_controller()->AddObserver(this); | 196 desktop_background_controller()->AddObserver(this); |
| 195 | 197 |
| 196 // Set up policy signing. | 198 // Set up policy signing. |
| 197 user_policy_builders_[0] = GetUserPolicyBuilder(kTestUsers[0]); | 199 user_policy_builders_[0] = GetUserPolicyBuilder(kTestUsers[0]); |
| 198 user_policy_builders_[1] = GetUserPolicyBuilder(kTestUsers[1]); | 200 user_policy_builders_[1] = GetUserPolicyBuilder(kTestUsers[1]); |
| 199 | 201 |
| 200 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 202 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 201 } | 203 } |
| 202 | 204 |
| 203 virtual void TearDownOnMainThread() OVERRIDE { | 205 virtual void TearDownOnMainThread() OVERRIDE { |
| 204 ash::Shell::GetInstance()-> | 206 ash::Shell::GetInstance()-> |
| 205 desktop_background_controller()->RemoveObserver(this); | 207 desktop_background_controller()->RemoveObserver(this); |
| 206 LoginManagerTest::TearDownOnMainThread(); | 208 InProcessBrowserTest::TearDownOnMainThread(); |
| 209 } | |
| 210 | |
| 211 virtual void CleanUpOnMainThread() OVERRIDE { | |
| 212 login_manager_test_helper_->CleanUp(); | |
| 207 } | 213 } |
| 208 | 214 |
| 209 // ash::DesktopBackgroundControllerObserver: | 215 // ash::DesktopBackgroundControllerObserver: |
| 210 virtual void OnWallpaperDataChanged() OVERRIDE { | 216 virtual void OnWallpaperDataChanged() OVERRIDE { |
| 211 ++wallpaper_change_count_; | 217 ++wallpaper_change_count_; |
| 212 if (run_loop_) | 218 if (run_loop_) |
| 213 run_loop_->Quit(); | 219 run_loop_->Quit(); |
| 214 } | 220 } |
| 215 | 221 |
| 216 // Runs the loop until wallpaper has changed at least |count| times in total. | 222 // Runs the loop until wallpaper has changed at least |count| times in total. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 | 268 |
| 263 // Obtain WallpaperInfo for |user_number| from WallpaperManager. | 269 // Obtain WallpaperInfo for |user_number| from WallpaperManager. |
| 264 void GetUserWallpaperInfo(int user_number, WallpaperInfo* wallpaper_info) { | 270 void GetUserWallpaperInfo(int user_number, WallpaperInfo* wallpaper_info) { |
| 265 WallpaperManager::Get()-> | 271 WallpaperManager::Get()-> |
| 266 GetUserWallpaperInfo(kTestUsers[user_number], wallpaper_info); | 272 GetUserWallpaperInfo(kTestUsers[user_number], wallpaper_info); |
| 267 } | 273 } |
| 268 | 274 |
| 269 base::FilePath test_data_dir_; | 275 base::FilePath test_data_dir_; |
| 270 scoped_ptr<base::RunLoop> run_loop_; | 276 scoped_ptr<base::RunLoop> run_loop_; |
| 271 int wallpaper_change_count_; | 277 int wallpaper_change_count_; |
| 278 scoped_ptr<LoginManagerTestHelper> login_manager_test_helper_; | |
| 272 scoped_ptr<policy::UserPolicyBuilder> user_policy_builders_[2]; | 279 scoped_ptr<policy::UserPolicyBuilder> user_policy_builders_[2]; |
| 273 FakeDBusThreadManager* fake_dbus_thread_manager_; | 280 FakeDBusThreadManager* fake_dbus_thread_manager_; |
| 274 FakeSessionManagerClient* fake_session_manager_client_; | 281 FakeSessionManagerClient* fake_session_manager_client_; |
| 275 | 282 |
| 276 private: | 283 private: |
| 277 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerPolicyTest); | 284 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerPolicyTest); |
| 278 }; | 285 }; |
| 279 | 286 |
| 280 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_SetResetClear) { | 287 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_SetResetClear) { |
| 281 RegisterUser(kTestUsers[0]); | 288 login_manager_test_helper_->RegisterUser(kTestUsers[0]); |
| 282 RegisterUser(kTestUsers[1]); | 289 login_manager_test_helper_->RegisterUser(kTestUsers[1]); |
| 283 StartupUtils::MarkOobeCompleted(); | 290 StartupUtils::MarkOobeCompleted(); |
| 284 } | 291 } |
| 285 | 292 |
| 286 // Verifies that the wallpaper can be set and re-set through policy and that | 293 // Verifies that the wallpaper can be set and re-set through policy and that |
| 287 // setting policy for a user that is not logged in doesn't affect the current | 294 // setting policy for a user that is not logged in doesn't affect the current |
| 288 // user. Also verifies that after the policy has been cleared, the wallpaper | 295 // user. Also verifies that after the policy has been cleared, the wallpaper |
| 289 // reverts to default. | 296 // reverts to default. |
| 290 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, SetResetClear) { | 297 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, SetResetClear) { |
| 291 WallpaperInfo info; | 298 WallpaperInfo info; |
| 292 LoginUser(kTestUsers[0]); | 299 login_manager_test_helper_->LogInUser(kTestUsers[0]); |
| 293 base::RunLoop().RunUntilIdle(); | 300 base::RunLoop().RunUntilIdle(); |
| 294 | 301 |
| 295 // First user: Wait until default wallpaper has been loaded (happens | 302 // First user: Wait until default wallpaper has been loaded (happens |
| 296 // automatically) and store color to recognize it later. | 303 // automatically) and store color to recognize it later. |
| 297 RunUntilWallpaperChangeCount(1); | 304 RunUntilWallpaperChangeCount(1); |
| 298 const SkColor original_background_color = GetAverageBackgroundColor(); | 305 const SkColor original_background_color = GetAverageBackgroundColor(); |
| 299 | 306 |
| 300 // Second user: Set wallpaper policy to blue image. This should not result in | 307 // Second user: Set wallpaper policy to blue image. This should not result in |
| 301 // a wallpaper change, which is checked at the very end of this test. | 308 // a wallpaper change, which is checked at the very end of this test. |
| 302 InjectPolicy(1, kBlueImageFileName); | 309 InjectPolicy(1, kBlueImageFileName); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 323 ASSERT_EQ(User::DEFAULT, info.type); | 330 ASSERT_EQ(User::DEFAULT, info.type); |
| 324 ASSERT_EQ(original_background_color, GetAverageBackgroundColor()); | 331 ASSERT_EQ(original_background_color, GetAverageBackgroundColor()); |
| 325 | 332 |
| 326 // Check wallpaper change count to ensure that setting the second user's | 333 // Check wallpaper change count to ensure that setting the second user's |
| 327 // wallpaper didn't have any effect. | 334 // wallpaper didn't have any effect. |
| 328 ASSERT_EQ(4, wallpaper_change_count_); | 335 ASSERT_EQ(4, wallpaper_change_count_); |
| 329 } | 336 } |
| 330 | 337 |
| 331 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, | 338 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, |
| 332 PRE_PRE_PRE_WallpaperOnLoginScreen) { | 339 PRE_PRE_PRE_WallpaperOnLoginScreen) { |
| 333 RegisterUser(kTestUsers[0]); | 340 login_manager_test_helper_->RegisterUser(kTestUsers[0]); |
| 334 RegisterUser(kTestUsers[1]); | 341 login_manager_test_helper_->RegisterUser(kTestUsers[1]); |
| 335 StartupUtils::MarkOobeCompleted(); | 342 StartupUtils::MarkOobeCompleted(); |
| 336 } | 343 } |
| 337 | 344 |
| 338 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, | 345 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, |
| 339 PRE_PRE_WallpaperOnLoginScreen) { | 346 PRE_PRE_WallpaperOnLoginScreen) { |
| 340 LoginUser(kTestUsers[0]); | 347 login_manager_test_helper_->LogInUser(kTestUsers[0]); |
| 341 | 348 |
| 342 // Wait until default wallpaper has been loaded. | 349 // Wait until default wallpaper has been loaded. |
| 343 RunUntilWallpaperChangeCount(1); | 350 RunUntilWallpaperChangeCount(1); |
| 344 | 351 |
| 345 // Set wallpaper policy to red image. | 352 // Set wallpaper policy to red image. |
| 346 InjectPolicy(0, kRedImageFileName); | 353 InjectPolicy(0, kRedImageFileName); |
| 347 | 354 |
| 348 // Run until wallpaper has changed. | 355 // Run until wallpaper has changed. |
| 349 RunUntilWallpaperChangeCount(2); | 356 RunUntilWallpaperChangeCount(2); |
| 350 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); | 357 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); |
| 351 } | 358 } |
| 352 | 359 |
| 353 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_WallpaperOnLoginScreen) { | 360 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_WallpaperOnLoginScreen) { |
| 354 LoginUser(kTestUsers[1]); | 361 login_manager_test_helper_->LogInUser(kTestUsers[1]); |
| 355 | 362 |
| 356 // Wait until default wallpaper has been loaded. | 363 // Wait until default wallpaper has been loaded. |
| 357 RunUntilWallpaperChangeCount(1); | 364 RunUntilWallpaperChangeCount(1); |
| 358 | 365 |
| 359 // Set wallpaper policy to green image. | 366 // Set wallpaper policy to green image. |
| 360 InjectPolicy(1, kGreenImageFileName); | 367 InjectPolicy(1, kGreenImageFileName); |
| 361 | 368 |
| 362 // Run until wallpaper has changed. | 369 // Run until wallpaper has changed. |
| 363 RunUntilWallpaperChangeCount(2); | 370 RunUntilWallpaperChangeCount(2); |
| 364 ASSERT_EQ(kGreenImageColor, GetAverageBackgroundColor()); | 371 ASSERT_EQ(kGreenImageColor, GetAverageBackgroundColor()); |
| 365 } | 372 } |
| 366 | 373 |
| 367 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, WallpaperOnLoginScreen) { | 374 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, WallpaperOnLoginScreen) { |
| 368 // Wait for active pod's wallpaper to be loaded. | 375 // Wait for active pod's wallpaper to be loaded. |
| 369 RunUntilWallpaperChangeCount(1); | 376 RunUntilWallpaperChangeCount(1); |
| 370 ASSERT_EQ(kGreenImageColor, GetAverageBackgroundColor()); | 377 ASSERT_EQ(kGreenImageColor, GetAverageBackgroundColor()); |
| 371 | 378 |
| 372 // Select the second pod (belonging to user 1). | 379 // Select the second pod (belonging to user 1). |
| 373 ASSERT_TRUE(content::ExecuteScript( | 380 ASSERT_TRUE(content::ExecuteScript( |
| 374 static_cast<chromeos::LoginDisplayHostImpl*>( | 381 static_cast<chromeos::LoginDisplayHostImpl*>( |
| 375 chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI()-> | 382 chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI()-> |
| 376 web_ui()->GetWebContents(), | 383 web_ui()->GetWebContents(), |
| 377 "document.getElementsByClassName('pod')[1].focus();")); | 384 "document.getElementsByClassName('pod')[1].focus();")); |
| 378 RunUntilWallpaperChangeCount(2); | 385 RunUntilWallpaperChangeCount(2); |
| 379 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); | 386 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); |
| 380 } | 387 } |
| 381 | 388 |
| 382 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_PRE_PersistOverLogout) { | 389 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_PRE_PersistOverLogout) { |
| 383 RegisterUser(kTestUsers[0]); | 390 login_manager_test_helper_->RegisterUser(kTestUsers[0]); |
| 384 StartupUtils::MarkOobeCompleted(); | 391 StartupUtils::MarkOobeCompleted(); |
| 385 } | 392 } |
| 386 | 393 |
| 387 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_PersistOverLogout) { | 394 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PRE_PersistOverLogout) { |
| 388 LoginUser(kTestUsers[0]); | 395 login_manager_test_helper_->LogInUser(kTestUsers[0]); |
| 389 | 396 |
| 390 // Wait until default wallpaper has been loaded. | 397 // Wait until default wallpaper has been loaded. |
| 391 RunUntilWallpaperChangeCount(1); | 398 RunUntilWallpaperChangeCount(1); |
| 392 | 399 |
| 393 // Set wallpaper policy to red image. | 400 // Set wallpaper policy to red image. |
| 394 InjectPolicy(0, kRedImageFileName); | 401 InjectPolicy(0, kRedImageFileName); |
| 395 | 402 |
| 396 // Run until wallpaper has changed. | 403 // Run until wallpaper has changed. |
| 397 RunUntilWallpaperChangeCount(2); | 404 RunUntilWallpaperChangeCount(2); |
| 398 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); | 405 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); |
| 399 } | 406 } |
| 400 | 407 |
| 401 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PersistOverLogout) { | 408 IN_PROC_BROWSER_TEST_P(WallpaperManagerPolicyTest, PersistOverLogout) { |
| 402 LoginUser(kTestUsers[0]); | 409 login_manager_test_helper_->LogInUser(kTestUsers[0]); |
| 403 | 410 |
| 404 // Wait until wallpaper has been loaded. | 411 // Wait until wallpaper has been loaded. |
| 405 RunUntilWallpaperChangeCount(1); | 412 RunUntilWallpaperChangeCount(1); |
| 406 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); | 413 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); |
| 407 } | 414 } |
| 408 | 415 |
| 409 INSTANTIATE_TEST_CASE_P(WallpaperManagerPolicyTestInstantiation, | 416 INSTANTIATE_TEST_CASE_P(WallpaperManagerPolicyTestInstantiation, |
| 410 WallpaperManagerPolicyTest, testing::Bool()); | 417 WallpaperManagerPolicyTest, testing::Bool()); |
| 411 | 418 |
| 412 } // namespace chromeos | 419 } // namespace chromeos |
| OLD | NEW |