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" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 EXPECT_EQ(base::WriteFile( | 156 EXPECT_EQ(base::WriteFile( |
157 user_key_file, | 157 user_key_file, |
158 reinterpret_cast<const char*>(user_key_bits.data()), | 158 reinterpret_cast<const char*>(user_key_bits.data()), |
159 user_key_bits.size()), | 159 user_key_bits.size()), |
160 static_cast<int>(user_key_bits.size())); | 160 static_cast<int>(user_key_bits.size())); |
161 user_policy_builder->policy_data().set_username(user_id); | 161 user_policy_builder->policy_data().set_username(user_id); |
162 return user_policy_builder.Pass(); | 162 return user_policy_builder.Pass(); |
163 } | 163 } |
164 | 164 |
165 // LoginManagerTest: | 165 // LoginManagerTest: |
166 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 166 virtual void SetUpInProcessBrowserTestFixture() override { |
167 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( | 167 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
168 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); | 168 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); |
169 | 169 |
170 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 170 LoginManagerTest::SetUpInProcessBrowserTestFixture(); |
171 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); | 171 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_)); |
172 } | 172 } |
173 | 173 |
174 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 174 virtual void SetUpCommandLine(CommandLine* command_line) override { |
175 // Set the same switches as LoginManagerTest, except that kMultiProfiles is | 175 // Set the same switches as LoginManagerTest, except that kMultiProfiles is |
176 // only set when GetParam() is true and except that kLoginProfile is set | 176 // only set when GetParam() is true and except that kLoginProfile is set |
177 // when GetParam() is false. The latter seems to be required for the sane | 177 // when GetParam() is false. The latter seems to be required for the sane |
178 // start-up of user profiles. | 178 // start-up of user profiles. |
179 command_line->AppendSwitch(switches::kLoginManager); | 179 command_line->AppendSwitch(switches::kLoginManager); |
180 command_line->AppendSwitch(switches::kForceLoginManagerInTests); | 180 command_line->AppendSwitch(switches::kForceLoginManagerInTests); |
181 } | 181 } |
182 | 182 |
183 virtual void SetUpOnMainThread() OVERRIDE { | 183 virtual void SetUpOnMainThread() override { |
184 LoginManagerTest::SetUpOnMainThread(); | 184 LoginManagerTest::SetUpOnMainThread(); |
185 ash::Shell::GetInstance()-> | 185 ash::Shell::GetInstance()-> |
186 desktop_background_controller()->AddObserver(this); | 186 desktop_background_controller()->AddObserver(this); |
187 | 187 |
188 // Set up policy signing. | 188 // Set up policy signing. |
189 user_policy_builders_[0] = GetUserPolicyBuilder(kTestUsers[0]); | 189 user_policy_builders_[0] = GetUserPolicyBuilder(kTestUsers[0]); |
190 user_policy_builders_[1] = GetUserPolicyBuilder(kTestUsers[1]); | 190 user_policy_builders_[1] = GetUserPolicyBuilder(kTestUsers[1]); |
191 | 191 |
192 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 192 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
193 } | 193 } |
194 | 194 |
195 virtual void TearDownOnMainThread() OVERRIDE { | 195 virtual void TearDownOnMainThread() override { |
196 ash::Shell::GetInstance()-> | 196 ash::Shell::GetInstance()-> |
197 desktop_background_controller()->RemoveObserver(this); | 197 desktop_background_controller()->RemoveObserver(this); |
198 LoginManagerTest::TearDownOnMainThread(); | 198 LoginManagerTest::TearDownOnMainThread(); |
199 } | 199 } |
200 | 200 |
201 // ash::DesktopBackgroundControllerObserver: | 201 // ash::DesktopBackgroundControllerObserver: |
202 virtual void OnWallpaperDataChanged() OVERRIDE { | 202 virtual void OnWallpaperDataChanged() override { |
203 ++wallpaper_change_count_; | 203 ++wallpaper_change_count_; |
204 if (run_loop_) | 204 if (run_loop_) |
205 run_loop_->Quit(); | 205 run_loop_->Quit(); |
206 } | 206 } |
207 | 207 |
208 // Runs the loop until wallpaper has changed at least |count| times in total. | 208 // Runs the loop until wallpaper has changed at least |count| times in total. |
209 void RunUntilWallpaperChangeCount(int count) { | 209 void RunUntilWallpaperChangeCount(int count) { |
210 while (wallpaper_change_count_ < count) { | 210 while (wallpaper_change_count_ < count) { |
211 run_loop_.reset(new base::RunLoop); | 211 run_loop_.reset(new base::RunLoop); |
212 run_loop_->Run(); | 212 run_loop_->Run(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 395 |
396 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { | 396 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { |
397 LoginUser(kTestUsers[0]); | 397 LoginUser(kTestUsers[0]); |
398 | 398 |
399 // Wait until wallpaper has been loaded. | 399 // Wait until wallpaper has been loaded. |
400 RunUntilWallpaperChangeCount(1); | 400 RunUntilWallpaperChangeCount(1); |
401 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); | 401 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); |
402 } | 402 } |
403 | 403 |
404 } // namespace chromeos | 404 } // namespace chromeos |
OLD | NEW |