Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc

Issue 23480087: Use username_hash instead of email (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/login/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
6 6
7 #include "ash/ash_resources/grit/ash_resources.h" 7 #include "ash/ash_resources/grit/ash_resources.h"
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/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 24 matching lines...) Expand all
35 35
36 const int kLargeWallpaperResourceId = IDR_AURA_WALLPAPER_DEFAULT_LARGE; 36 const int kLargeWallpaperResourceId = IDR_AURA_WALLPAPER_DEFAULT_LARGE;
37 const int kSmallWallpaperResourceId = IDR_AURA_WALLPAPER_DEFAULT_SMALL; 37 const int kSmallWallpaperResourceId = IDR_AURA_WALLPAPER_DEFAULT_SMALL;
38 38
39 int kLargeWallpaperWidth = 256; 39 int kLargeWallpaperWidth = 256;
40 int kLargeWallpaperHeight = ash::kLargeWallpaperMaxHeight; 40 int kLargeWallpaperHeight = ash::kLargeWallpaperMaxHeight;
41 int kSmallWallpaperWidth = 256; 41 int kSmallWallpaperWidth = 256;
42 int kSmallWallpaperHeight = ash::kSmallWallpaperMaxHeight; 42 int kSmallWallpaperHeight = ash::kSmallWallpaperMaxHeight;
43 43
44 const char kTestUser1[] = "test@domain.com"; 44 const char kTestUser1[] = "test@domain.com";
45 const char kTestUser1Hash[] = "test@domain.com-hash";
45 46
46 } // namespace 47 } // namespace
47 48
48 class WallpaperManagerBrowserTest : public InProcessBrowserTest, 49 class WallpaperManagerBrowserTest : public InProcessBrowserTest,
49 public DesktopBackgroundControllerObserver { 50 public DesktopBackgroundControllerObserver {
50 public: 51 public:
51 WallpaperManagerBrowserTest () : controller_(NULL), 52 WallpaperManagerBrowserTest () : controller_(NULL),
52 local_state_(NULL) { 53 local_state_(NULL) {
53 } 54 }
54 55
(...skipping 29 matching lines...) Expand all
84 base::MessageLoop::current()->Run(); 85 base::MessageLoop::current()->Run();
85 } 86 }
86 87
87 virtual void OnWallpaperDataChanged() OVERRIDE { 88 virtual void OnWallpaperDataChanged() OVERRIDE {
88 base::MessageLoop::current()->Quit(); 89 base::MessageLoop::current()->Quit();
89 } 90 }
90 91
91 protected: 92 protected:
92 // Return custom wallpaper path. Create directory if not exist. 93 // Return custom wallpaper path. Create directory if not exist.
93 base::FilePath GetCustomWallpaperPath(const char* sub_dir, 94 base::FilePath GetCustomWallpaperPath(const char* sub_dir,
94 const std::string& email, 95 const std::string& username_hash,
95 const std::string& id) { 96 const std::string& id) {
96 base::FilePath wallpaper_path = 97 base::FilePath wallpaper_path =
97 WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir, email, id); 98 WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir,
99 username_hash,
100 id);
98 if (!base::DirectoryExists(wallpaper_path.DirName())) 101 if (!base::DirectoryExists(wallpaper_path.DirName()))
99 file_util::CreateDirectory(wallpaper_path.DirName()); 102 file_util::CreateDirectory(wallpaper_path.DirName());
100 103
101 return wallpaper_path; 104 return wallpaper_path;
102 } 105 }
103 106
104 // Logs in |username|. 107 // Logs in |username|.
105 void LogIn(const std::string& username) { 108 void LogIn(const std::string& username, const std::string& username_hash) {
106 UserManager::Get()->UserLoggedIn(username, username, false); 109 UserManager::Get()->UserLoggedIn(username, username_hash, false);
107 } 110 }
108 111
109 // Saves bitmap |resource_id| to disk. 112 // Saves bitmap |resource_id| to disk.
110 void SaveUserWallpaperData(const std::string& username, 113 void SaveUserWallpaperData(const std::string& username,
111 const base::FilePath& wallpaper_path, 114 const base::FilePath& wallpaper_path,
112 int resource_id) { 115 int resource_id) {
113 scoped_refptr<base::RefCountedStaticMemory> image_data( 116 scoped_refptr<base::RefCountedStaticMemory> image_data(
114 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 117 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
115 resource_id, ui::SCALE_FACTOR_100P)); 118 resource_id, ui::SCALE_FACTOR_100P));
116 int written = file_util::WriteFile( 119 int written = file_util::WriteFile(
(...skipping 12 matching lines...) Expand all
129 132
130 private: 133 private:
131 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBrowserTest); 134 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBrowserTest);
132 }; 135 };
133 136
134 // Tests that the appropriate custom wallpaper (large vs. small) is loaded 137 // Tests that the appropriate custom wallpaper (large vs. small) is loaded
135 // depending on the desktop resolution. 138 // depending on the desktop resolution.
136 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 139 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
137 LoadCustomLargeWallpaperForLargeExternalScreen) { 140 LoadCustomLargeWallpaperForLargeExternalScreen) {
138 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); 141 WallpaperManager* wallpaper_manager = WallpaperManager::Get();
139 LogIn(kTestUser1); 142 LogIn(kTestUser1, kTestUser1Hash);
140 // Wait for default wallpaper loaded. 143 // Wait for default wallpaper loaded.
141 WaitAsyncWallpaperLoad(); 144 WaitAsyncWallpaperLoad();
142 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); 145 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue());
143 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( 146 base::FilePath small_wallpaper_path = GetCustomWallpaperPath(
144 kSmallWallpaperSubDir, 147 kSmallWallpaperSubDir,
145 kTestUser1, 148 kTestUser1Hash,
146 id); 149 id);
147 base::FilePath large_wallpaper_path = GetCustomWallpaperPath( 150 base::FilePath large_wallpaper_path = GetCustomWallpaperPath(
148 kLargeWallpaperSubDir, 151 kLargeWallpaperSubDir,
149 kTestUser1, 152 kTestUser1Hash,
150 id); 153 id);
151 154
152 // Saves the small/large resolution wallpapers to small/large custom 155 // Saves the small/large resolution wallpapers to small/large custom
153 // wallpaper paths. 156 // wallpaper paths.
154 SaveUserWallpaperData(kTestUser1, 157 SaveUserWallpaperData(kTestUser1,
155 small_wallpaper_path, 158 small_wallpaper_path,
156 kSmallWallpaperResourceId); 159 kSmallWallpaperResourceId);
157 SaveUserWallpaperData(kTestUser1, 160 SaveUserWallpaperData(kTestUser1,
158 large_wallpaper_path, 161 large_wallpaper_path,
159 kLargeWallpaperResourceId); 162 kLargeWallpaperResourceId);
160 163
164 std::string relative_path = base::FilePath(kTestUser1Hash).Append(id).value();
161 // Saves wallpaper info to local state for user |kTestUser1|. 165 // Saves wallpaper info to local state for user |kTestUser1|.
162 WallpaperInfo info = { 166 WallpaperInfo info = {
163 id, 167 relative_path,
164 WALLPAPER_LAYOUT_CENTER_CROPPED, 168 WALLPAPER_LAYOUT_CENTER_CROPPED,
165 User::CUSTOMIZED, 169 User::CUSTOMIZED,
166 base::Time::Now().LocalMidnight() 170 base::Time::Now().LocalMidnight()
167 }; 171 };
168 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true); 172 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
169 173
170 // Set the wallpaper for |kTestUser1|. 174 // Set the wallpaper for |kTestUser1|.
171 wallpaper_manager->SetUserWallpaper(kTestUser1); 175 wallpaper_manager->SetUserWallpaper(kTestUser1);
172 WaitAsyncWallpaperLoad(); 176 WaitAsyncWallpaperLoad();
173 gfx::ImageSkia wallpaper = controller_->GetWallpaper(); 177 gfx::ImageSkia wallpaper = controller_->GetWallpaper();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 EXPECT_EQ(kLargeWallpaperHeight, wallpaper.height()); 213 EXPECT_EQ(kLargeWallpaperHeight, wallpaper.height());
210 } 214 }
211 215
212 // If chrome tries to reload the same wallpaper twice, the latter request should 216 // If chrome tries to reload the same wallpaper twice, the latter request should
213 // be prevented. Otherwise, there are some strange animation issues as 217 // be prevented. Otherwise, there are some strange animation issues as
214 // described in crbug.com/158383. 218 // described in crbug.com/158383.
215 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 219 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
216 PreventReloadingSameWallpaper) { 220 PreventReloadingSameWallpaper) {
217 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); 221 WallpaperManager* wallpaper_manager = WallpaperManager::Get();
218 // New user log in, a default wallpaper is loaded. 222 // New user log in, a default wallpaper is loaded.
219 LogIn(kTestUser1); 223 LogIn(kTestUser1, kTestUser1Hash);
220 EXPECT_EQ(1, LoadedWallpapers()); 224 EXPECT_EQ(1, LoadedWallpapers());
221 // Loads the same wallpaper before the initial one finished. It should be 225 // Loads the same wallpaper before the initial one finished. It should be
222 // prevented. 226 // prevented.
223 wallpaper_manager->SetUserWallpaper(kTestUser1); 227 wallpaper_manager->SetUserWallpaper(kTestUser1);
224 EXPECT_EQ(1, LoadedWallpapers()); 228 EXPECT_EQ(1, LoadedWallpapers());
225 WaitAsyncWallpaperLoad(); 229 WaitAsyncWallpaperLoad();
226 // Loads the same wallpaper after the initial one finished. It should be 230 // Loads the same wallpaper after the initial one finished. It should be
227 // prevented. 231 // prevented.
228 wallpaper_manager->SetUserWallpaper(kTestUser1); 232 wallpaper_manager->SetUserWallpaper(kTestUser1);
229 EXPECT_EQ(1, LoadedWallpapers()); 233 EXPECT_EQ(1, LoadedWallpapers());
230 wallpaper_manager->ClearWallpaperCache(); 234 wallpaper_manager->ClearWallpaperCache();
231 235
232 // Change wallpaper to a custom wallpaper. 236 // Change wallpaper to a custom wallpaper.
233 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); 237 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue());
234 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( 238 base::FilePath small_wallpaper_path = GetCustomWallpaperPath(
235 kSmallWallpaperSubDir, 239 kSmallWallpaperSubDir,
236 kTestUser1, 240 kTestUser1Hash,
237 id); 241 id);
238 SaveUserWallpaperData(kTestUser1, 242 SaveUserWallpaperData(kTestUser1,
239 small_wallpaper_path, 243 small_wallpaper_path,
240 kSmallWallpaperResourceId); 244 kSmallWallpaperResourceId);
241 245
246 std::string relative_path = base::FilePath(kTestUser1Hash).Append(id).value();
242 // Saves wallpaper info to local state for user |kTestUser1|. 247 // Saves wallpaper info to local state for user |kTestUser1|.
243 WallpaperInfo info = { 248 WallpaperInfo info = {
244 id, 249 relative_path,
245 WALLPAPER_LAYOUT_CENTER_CROPPED, 250 WALLPAPER_LAYOUT_CENTER_CROPPED,
246 User::CUSTOMIZED, 251 User::CUSTOMIZED,
247 base::Time::Now().LocalMidnight() 252 base::Time::Now().LocalMidnight()
248 }; 253 };
249 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true); 254 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
250 255
251 wallpaper_manager->SetUserWallpaper(kTestUser1); 256 wallpaper_manager->SetUserWallpaper(kTestUser1);
252 EXPECT_EQ(2, LoadedWallpapers()); 257 EXPECT_EQ(2, LoadedWallpapers());
253 // Loads the same wallpaper before the initial one finished. It should be 258 // Loads the same wallpaper before the initial one finished. It should be
254 // prevented. 259 // prevented.
255 wallpaper_manager->SetUserWallpaper(kTestUser1); 260 wallpaper_manager->SetUserWallpaper(kTestUser1);
256 EXPECT_EQ(2, LoadedWallpapers()); 261 EXPECT_EQ(2, LoadedWallpapers());
257 WaitAsyncWallpaperLoad(); 262 WaitAsyncWallpaperLoad();
258 wallpaper_manager->SetUserWallpaper(kTestUser1); 263 wallpaper_manager->SetUserWallpaper(kTestUser1);
259 EXPECT_EQ(2, LoadedWallpapers()); 264 EXPECT_EQ(2, LoadedWallpapers());
260 } 265 }
261 266
262 // Some users have old user profiles which may have legacy wallpapers. And these 267 // Some users have old user profiles which may have legacy wallpapers. And these
263 // lagacy wallpapers should migrate to new wallpaper picker version seamlessly. 268 // lagacy wallpapers should migrate to new wallpaper picker version seamlessly.
264 // This tests make sure we compatible with migrated old wallpapers. 269 // This tests make sure we compatible with migrated old wallpapers.
265 // crosbug.com/38429 270 // crosbug.com/38429
266 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 271 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
267 PRE_UseMigratedWallpaperInfo) { 272 PRE_UseMigratedWallpaperInfo) {
268 // New user log in, a default wallpaper is loaded. 273 // New user log in, a default wallpaper is loaded.
269 LogIn(kTestUser1); 274 LogIn(kTestUser1, kTestUser1Hash);
270 WaitAsyncWallpaperLoad(); 275 WaitAsyncWallpaperLoad();
271 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user 276 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user
272 // wallpaper info directly to simulate the wallpaper migration. See 277 // wallpaper info directly to simulate the wallpaper migration. See
273 // crosbug.com/38429 for details about why we modify wallpaper info this way. 278 // crosbug.com/38429 for details about why we modify wallpaper info this way.
274 WallpaperInfo info = { 279 WallpaperInfo info = {
275 "123", 280 "123",
276 WALLPAPER_LAYOUT_CENTER_CROPPED, 281 WALLPAPER_LAYOUT_CENTER_CROPPED,
277 User::DEFAULT, 282 User::DEFAULT,
278 base::Time::Now().LocalMidnight() 283 base::Time::Now().LocalMidnight()
279 }; 284 };
280 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); 285 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true);
281 } 286 }
282 287
283 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 288 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
284 UseMigratedWallpaperInfo) { 289 UseMigratedWallpaperInfo) {
285 LogIn(kTestUser1); 290 LogIn(kTestUser1, kTestUser1Hash);
286 WaitAsyncWallpaperLoad(); 291 WaitAsyncWallpaperLoad();
287 // This test should finish normally. If timeout, it is probably because 292 // This test should finish normally. If timeout, it is probably because
288 // migrated wallpaper is somehow not loaded. Bad things can happen if 293 // migrated wallpaper is somehow not loaded. Bad things can happen if
289 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429. 294 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429.
290 } 295 }
291 296
292 // Some users have old user profiles which may never get a chance to migrate. 297 // Some users have old user profiles which may never get a chance to migrate.
293 // This tests make sure we compatible with these profiles. 298 // This tests make sure we compatible with these profiles.
294 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 299 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
295 PRE_UsePreMigrationWallpaperInfo) { 300 PRE_UsePreMigrationWallpaperInfo) {
296 // New user log in, a default wallpaper is loaded. 301 // New user log in, a default wallpaper is loaded.
297 LogIn(kTestUser1); 302 LogIn(kTestUser1, kTestUser1Hash);
298 WaitAsyncWallpaperLoad(); 303 WaitAsyncWallpaperLoad();
299 // Old wallpaper migration code doesn't exist in codebase anymore. So if 304 // Old wallpaper migration code doesn't exist in codebase anymore. So if
300 // user's profile is not migrated, it is the same as no wallpaper info. To 305 // user's profile is not migrated, it is the same as no wallpaper info. To
301 // simulate this, we remove user's wallpaper info here. 306 // simulate this, we remove user's wallpaper info here.
302 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); 307 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1);
303 } 308 }
304 309
305 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 310 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
306 UsePreMigrationWallpaperInfo) { 311 UsePreMigrationWallpaperInfo) {
307 LogIn(kTestUser1); 312 LogIn(kTestUser1, kTestUser1Hash);
308 WaitAsyncWallpaperLoad(); 313 WaitAsyncWallpaperLoad();
309 // This test should finish normally. If timeout, it is probably because chrome 314 // This test should finish normally. If timeout, it is probably because chrome
310 // can not handle pre migrated user profile (M21 profile or older). 315 // can not handle pre migrated user profile (M21 profile or older).
311 } 316 }
312 317
313 // Test for http://crbug.com/265689. When hooked up a large external monitor, 318 // Test for http://crbug.com/265689. When hooked up a large external monitor,
314 // the default large resolution wallpaper should load. 319 // the default large resolution wallpaper should load.
315 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 320 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
316 HotPlugInScreenAtGAIALoginScreen) { 321 HotPlugInScreenAtGAIALoginScreen) {
317 UpdateDisplay("800x600"); 322 UpdateDisplay("800x600");
(...skipping 16 matching lines...) Expand all
334 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); 339 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations);
335 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); 340 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation);
336 } 341 }
337 }; 342 };
338 343
339 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But 344 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But
340 // disabled boot and login animation. 345 // disabled boot and login animation.
341 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 346 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
342 PRE_UseMigratedWallpaperInfo) { 347 PRE_UseMigratedWallpaperInfo) {
343 // New user log in, a default wallpaper is loaded. 348 // New user log in, a default wallpaper is loaded.
344 LogIn(kTestUser1); 349 LogIn(kTestUser1, kTestUser1Hash);
345 WaitAsyncWallpaperLoad(); 350 WaitAsyncWallpaperLoad();
346 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user 351 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user
347 // wallpaper info directly to simulate the wallpaper migration. See 352 // wallpaper info directly to simulate the wallpaper migration. See
348 // crosbug.com/38429 for details about why we modify wallpaper info this way. 353 // crosbug.com/38429 for details about why we modify wallpaper info this way.
349 WallpaperInfo info = { 354 WallpaperInfo info = {
350 "123", 355 "123",
351 WALLPAPER_LAYOUT_CENTER_CROPPED, 356 WALLPAPER_LAYOUT_CENTER_CROPPED,
352 User::DEFAULT, 357 User::DEFAULT,
353 base::Time::Now().LocalMidnight() 358 base::Time::Now().LocalMidnight()
354 }; 359 };
355 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); 360 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true);
356 } 361 }
357 362
358 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 363 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
359 UseMigratedWallpaperInfo) { 364 UseMigratedWallpaperInfo) {
360 LogIn(kTestUser1); 365 LogIn(kTestUser1, kTestUser1Hash);
361 WaitAsyncWallpaperLoad(); 366 WaitAsyncWallpaperLoad();
362 // This test should finish normally. If timeout, it is probably because 367 // This test should finish normally. If timeout, it is probably because
363 // migrated wallpaper is somehow not loaded. Bad things can happen if 368 // migrated wallpaper is somehow not loaded. Bad things can happen if
364 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429. 369 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429.
365 } 370 }
366 371
367 // Same test as WallpaperManagerBrowserTest.UsePreMigrationWallpaperInfo. But 372 // Same test as WallpaperManagerBrowserTest.UsePreMigrationWallpaperInfo. But
368 // disabled boot and login animation. 373 // disabled boot and login animation.
369 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 374 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
370 PRE_UsePreMigrationWallpaperInfo) { 375 PRE_UsePreMigrationWallpaperInfo) {
371 // New user log in, a default wallpaper is loaded. 376 // New user log in, a default wallpaper is loaded.
372 LogIn(kTestUser1); 377 LogIn(kTestUser1, kTestUser1Hash);
373 WaitAsyncWallpaperLoad(); 378 WaitAsyncWallpaperLoad();
374 // Old wallpaper migration code doesn't exist in codebase anymore. So if 379 // Old wallpaper migration code doesn't exist in codebase anymore. So if
375 // user's profile is not migrated, it is the same as no wallpaper info. To 380 // user's profile is not migrated, it is the same as no wallpaper info. To
376 // simulate this, we remove user's wallpaper info here. 381 // simulate this, we remove user's wallpaper info here.
377 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); 382 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1);
378 } 383 }
379 384
380 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 385 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
381 UsePreMigrationWallpaperInfo) { 386 UsePreMigrationWallpaperInfo) {
382 LogIn(kTestUser1); 387 LogIn(kTestUser1, kTestUser1Hash);
383 WaitAsyncWallpaperLoad(); 388 WaitAsyncWallpaperLoad();
384 // This test should finish normally. If timeout, it is probably because chrome 389 // This test should finish normally. If timeout, it is probably because chrome
385 // can not handle pre migrated user profile (M21 profile or older). 390 // can not handle pre migrated user profile (M21 profile or older).
386 } 391 }
387 392
388 class WallpaperManagerBrowserTestCrashRestore 393 class WallpaperManagerBrowserTestCrashRestore
389 : public WallpaperManagerBrowserTest { 394 : public WallpaperManagerBrowserTest {
390 public: 395 public:
391 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 396 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
392 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); 397 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations);
393 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); 398 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation);
394 command_line->AppendSwitch(::switches::kMultiProfiles); 399 command_line->AppendSwitch(::switches::kMultiProfiles);
395 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); 400 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1);
396 command_line->AppendSwitchASCII(switches::kLoginProfile, 401 command_line->AppendSwitchASCII(switches::kLoginProfile,
397 CryptohomeClient::GetStubSanitizedUsername(kTestUser1)); 402 CryptohomeClient::GetStubSanitizedUsername(kTestUser1));
398 } 403 }
399 }; 404 };
400 405
401 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, 406 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore,
402 PRE_RestoreWallpaper) { 407 PRE_RestoreWallpaper) {
403 LogIn(kTestUser1); 408 LogIn(kTestUser1, kTestUser1Hash);
404 } 409 }
405 410
406 // Test for crbug.com/270278. It simulates a browser crash and verifies if user 411 // Test for crbug.com/270278. It simulates a browser crash and verifies if user
407 // wallpaper is loaded. 412 // wallpaper is loaded.
408 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, 413 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore,
409 RestoreWallpaper) { 414 RestoreWallpaper) {
410 EXPECT_EQ(1, LoadedWallpapers()); 415 EXPECT_EQ(1, LoadedWallpapers());
411 } 416 }
412 417
413 } // namespace chromeos 418 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.cc ('k') | chrome/browser/chromeos/login/wallpaper_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698