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

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: rebase Created 7 years, 3 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
161 // Saves wallpaper info to local state for user |kTestUser1|. 164 // Saves wallpaper info to local state for user |kTestUser1|.
162 WallpaperInfo info = { 165 WallpaperInfo info = {
163 id, 166 std::string(kTestUser1Hash) + "/" + id,
Nikita (slow) 2013/09/25 14:47:11 nit: Please use platform specific path separator c
bshe 2013/09/26 16:49:57 Will switch to base::FilePath::kSeperators[0] if m
164 WALLPAPER_LAYOUT_CENTER_CROPPED, 167 WALLPAPER_LAYOUT_CENTER_CROPPED,
165 User::CUSTOMIZED, 168 User::CUSTOMIZED,
166 base::Time::Now().LocalMidnight() 169 base::Time::Now().LocalMidnight()
167 }; 170 };
168 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true); 171 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
169 172
170 // Set the wallpaper for |kTestUser1|. 173 // Set the wallpaper for |kTestUser1|.
171 wallpaper_manager->SetUserWallpaper(kTestUser1); 174 wallpaper_manager->SetUserWallpaper(kTestUser1);
172 WaitAsyncWallpaperLoad(); 175 WaitAsyncWallpaperLoad();
173 gfx::ImageSkia wallpaper = controller_->GetWallpaper(); 176 gfx::ImageSkia wallpaper = controller_->GetWallpaper();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 EXPECT_EQ(kLargeWallpaperHeight, wallpaper.height()); 212 EXPECT_EQ(kLargeWallpaperHeight, wallpaper.height());
210 } 213 }
211 214
212 // If chrome tries to reload the same wallpaper twice, the latter request should 215 // If chrome tries to reload the same wallpaper twice, the latter request should
213 // be prevented. Otherwise, there are some strange animation issues as 216 // be prevented. Otherwise, there are some strange animation issues as
214 // described in crbug.com/158383. 217 // described in crbug.com/158383.
215 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 218 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
216 PreventReloadingSameWallpaper) { 219 PreventReloadingSameWallpaper) {
217 WallpaperManager* wallpaper_manager = WallpaperManager::Get(); 220 WallpaperManager* wallpaper_manager = WallpaperManager::Get();
218 // New user log in, a default wallpaper is loaded. 221 // New user log in, a default wallpaper is loaded.
219 LogIn(kTestUser1); 222 LogIn(kTestUser1, kTestUser1Hash);
220 EXPECT_EQ(1, LoadedWallpapers()); 223 EXPECT_EQ(1, LoadedWallpapers());
221 // Loads the same wallpaper before the initial one finished. It should be 224 // Loads the same wallpaper before the initial one finished. It should be
222 // prevented. 225 // prevented.
223 wallpaper_manager->SetUserWallpaper(kTestUser1); 226 wallpaper_manager->SetUserWallpaper(kTestUser1);
224 EXPECT_EQ(1, LoadedWallpapers()); 227 EXPECT_EQ(1, LoadedWallpapers());
225 WaitAsyncWallpaperLoad(); 228 WaitAsyncWallpaperLoad();
226 // Loads the same wallpaper after the initial one finished. It should be 229 // Loads the same wallpaper after the initial one finished. It should be
227 // prevented. 230 // prevented.
228 wallpaper_manager->SetUserWallpaper(kTestUser1); 231 wallpaper_manager->SetUserWallpaper(kTestUser1);
229 EXPECT_EQ(1, LoadedWallpapers()); 232 EXPECT_EQ(1, LoadedWallpapers());
230 wallpaper_manager->ClearWallpaperCache(); 233 wallpaper_manager->ClearWallpaperCache();
231 234
232 // Change wallpaper to a custom wallpaper. 235 // Change wallpaper to a custom wallpaper.
233 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); 236 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue());
234 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( 237 base::FilePath small_wallpaper_path = GetCustomWallpaperPath(
235 kSmallWallpaperSubDir, 238 kSmallWallpaperSubDir,
236 kTestUser1, 239 kTestUser1Hash,
237 id); 240 id);
238 SaveUserWallpaperData(kTestUser1, 241 SaveUserWallpaperData(kTestUser1,
239 small_wallpaper_path, 242 small_wallpaper_path,
240 kSmallWallpaperResourceId); 243 kSmallWallpaperResourceId);
241 244
242 // Saves wallpaper info to local state for user |kTestUser1|. 245 // Saves wallpaper info to local state for user |kTestUser1|.
243 WallpaperInfo info = { 246 WallpaperInfo info = {
244 id, 247 std::string(kTestUser1Hash) + "/" + id,
Nikita (slow) 2013/09/25 14:47:11 nit: Same here.
bshe 2013/09/26 16:49:57 same. On 2013/09/25 14:47:11, Nikita Kostylev wro
245 WALLPAPER_LAYOUT_CENTER_CROPPED, 248 WALLPAPER_LAYOUT_CENTER_CROPPED,
246 User::CUSTOMIZED, 249 User::CUSTOMIZED,
247 base::Time::Now().LocalMidnight() 250 base::Time::Now().LocalMidnight()
248 }; 251 };
249 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true); 252 wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
250 253
251 wallpaper_manager->SetUserWallpaper(kTestUser1); 254 wallpaper_manager->SetUserWallpaper(kTestUser1);
252 EXPECT_EQ(2, LoadedWallpapers()); 255 EXPECT_EQ(2, LoadedWallpapers());
253 // Loads the same wallpaper before the initial one finished. It should be 256 // Loads the same wallpaper before the initial one finished. It should be
254 // prevented. 257 // prevented.
255 wallpaper_manager->SetUserWallpaper(kTestUser1); 258 wallpaper_manager->SetUserWallpaper(kTestUser1);
256 EXPECT_EQ(2, LoadedWallpapers()); 259 EXPECT_EQ(2, LoadedWallpapers());
257 WaitAsyncWallpaperLoad(); 260 WaitAsyncWallpaperLoad();
258 wallpaper_manager->SetUserWallpaper(kTestUser1); 261 wallpaper_manager->SetUserWallpaper(kTestUser1);
259 EXPECT_EQ(2, LoadedWallpapers()); 262 EXPECT_EQ(2, LoadedWallpapers());
260 } 263 }
261 264
262 // Some users have old user profiles which may have legacy wallpapers. And these 265 // Some users have old user profiles which may have legacy wallpapers. And these
263 // lagacy wallpapers should migrate to new wallpaper picker version seamlessly. 266 // lagacy wallpapers should migrate to new wallpaper picker version seamlessly.
264 // This tests make sure we compatible with migrated old wallpapers. 267 // This tests make sure we compatible with migrated old wallpapers.
265 // crosbug.com/38429 268 // crosbug.com/38429
266 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 269 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
267 PRE_UseMigratedWallpaperInfo) { 270 PRE_UseMigratedWallpaperInfo) {
268 // New user log in, a default wallpaper is loaded. 271 // New user log in, a default wallpaper is loaded.
269 LogIn(kTestUser1); 272 LogIn(kTestUser1, kTestUser1Hash);
270 WaitAsyncWallpaperLoad(); 273 WaitAsyncWallpaperLoad();
271 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user 274 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user
272 // wallpaper info directly to simulate the wallpaper migration. See 275 // wallpaper info directly to simulate the wallpaper migration. See
273 // crosbug.com/38429 for details about why we modify wallpaper info this way. 276 // crosbug.com/38429 for details about why we modify wallpaper info this way.
274 WallpaperInfo info = { 277 WallpaperInfo info = {
275 "123", 278 "123",
276 WALLPAPER_LAYOUT_CENTER_CROPPED, 279 WALLPAPER_LAYOUT_CENTER_CROPPED,
277 User::DEFAULT, 280 User::DEFAULT,
278 base::Time::Now().LocalMidnight() 281 base::Time::Now().LocalMidnight()
279 }; 282 };
280 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); 283 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true);
281 } 284 }
282 285
283 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 286 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
284 UseMigratedWallpaperInfo) { 287 UseMigratedWallpaperInfo) {
285 LogIn(kTestUser1); 288 LogIn(kTestUser1, kTestUser1Hash);
286 WaitAsyncWallpaperLoad(); 289 WaitAsyncWallpaperLoad();
287 // This test should finish normally. If timeout, it is probably because 290 // This test should finish normally. If timeout, it is probably because
288 // migrated wallpaper is somehow not loaded. Bad things can happen if 291 // 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. 292 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429.
290 } 293 }
291 294
292 // Some users have old user profiles which may never get a chance to migrate. 295 // Some users have old user profiles which may never get a chance to migrate.
293 // This tests make sure we compatible with these profiles. 296 // This tests make sure we compatible with these profiles.
294 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 297 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
295 PRE_UsePreMigrationWallpaperInfo) { 298 PRE_UsePreMigrationWallpaperInfo) {
296 // New user log in, a default wallpaper is loaded. 299 // New user log in, a default wallpaper is loaded.
297 LogIn(kTestUser1); 300 LogIn(kTestUser1, kTestUser1Hash);
298 WaitAsyncWallpaperLoad(); 301 WaitAsyncWallpaperLoad();
299 // Old wallpaper migration code doesn't exist in codebase anymore. So if 302 // 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 303 // 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. 304 // simulate this, we remove user's wallpaper info here.
302 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); 305 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1);
303 } 306 }
304 307
305 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 308 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
306 UsePreMigrationWallpaperInfo) { 309 UsePreMigrationWallpaperInfo) {
307 LogIn(kTestUser1); 310 LogIn(kTestUser1, kTestUser1Hash);
308 WaitAsyncWallpaperLoad(); 311 WaitAsyncWallpaperLoad();
309 // This test should finish normally. If timeout, it is probably because chrome 312 // This test should finish normally. If timeout, it is probably because chrome
310 // can not handle pre migrated user profile (M21 profile or older). 313 // can not handle pre migrated user profile (M21 profile or older).
311 } 314 }
312 315
313 // Test for http://crbug.com/265689. When hooked up a large external monitor, 316 // Test for http://crbug.com/265689. When hooked up a large external monitor,
314 // the default large resolution wallpaper should load. 317 // the default large resolution wallpaper should load.
315 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 318 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
316 HotPlugInScreenAtGAIALoginScreen) { 319 HotPlugInScreenAtGAIALoginScreen) {
317 UpdateDisplay("800x600"); 320 UpdateDisplay("800x600");
(...skipping 16 matching lines...) Expand all
334 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); 337 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations);
335 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); 338 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation);
336 } 339 }
337 }; 340 };
338 341
339 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But 342 // Same test as WallpaperManagerBrowserTest.UseMigratedWallpaperInfo. But
340 // disabled boot and login animation. 343 // disabled boot and login animation.
341 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 344 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
342 PRE_UseMigratedWallpaperInfo) { 345 PRE_UseMigratedWallpaperInfo) {
343 // New user log in, a default wallpaper is loaded. 346 // New user log in, a default wallpaper is loaded.
344 LogIn(kTestUser1); 347 LogIn(kTestUser1, kTestUser1Hash);
345 WaitAsyncWallpaperLoad(); 348 WaitAsyncWallpaperLoad();
346 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user 349 // Old wallpaper migration code doesn't exist in codebase anymore. Modify user
347 // wallpaper info directly to simulate the wallpaper migration. See 350 // wallpaper info directly to simulate the wallpaper migration. See
348 // crosbug.com/38429 for details about why we modify wallpaper info this way. 351 // crosbug.com/38429 for details about why we modify wallpaper info this way.
349 WallpaperInfo info = { 352 WallpaperInfo info = {
350 "123", 353 "123",
351 WALLPAPER_LAYOUT_CENTER_CROPPED, 354 WALLPAPER_LAYOUT_CENTER_CROPPED,
352 User::DEFAULT, 355 User::DEFAULT,
353 base::Time::Now().LocalMidnight() 356 base::Time::Now().LocalMidnight()
354 }; 357 };
355 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true); 358 WallpaperManager::Get()->SetUserWallpaperInfo(kTestUser1, info, true);
356 } 359 }
357 360
358 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 361 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
359 UseMigratedWallpaperInfo) { 362 UseMigratedWallpaperInfo) {
360 LogIn(kTestUser1); 363 LogIn(kTestUser1, kTestUser1Hash);
361 WaitAsyncWallpaperLoad(); 364 WaitAsyncWallpaperLoad();
362 // This test should finish normally. If timeout, it is probably because 365 // This test should finish normally. If timeout, it is probably because
363 // migrated wallpaper is somehow not loaded. Bad things can happen if 366 // 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. 367 // wallpaper is not loaded at login screen. One example is: crosbug.com/38429.
365 } 368 }
366 369
367 // Same test as WallpaperManagerBrowserTest.UsePreMigrationWallpaperInfo. But 370 // Same test as WallpaperManagerBrowserTest.UsePreMigrationWallpaperInfo. But
368 // disabled boot and login animation. 371 // disabled boot and login animation.
369 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 372 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
370 PRE_UsePreMigrationWallpaperInfo) { 373 PRE_UsePreMigrationWallpaperInfo) {
371 // New user log in, a default wallpaper is loaded. 374 // New user log in, a default wallpaper is loaded.
372 LogIn(kTestUser1); 375 LogIn(kTestUser1, kTestUser1Hash);
373 WaitAsyncWallpaperLoad(); 376 WaitAsyncWallpaperLoad();
374 // Old wallpaper migration code doesn't exist in codebase anymore. So if 377 // 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 378 // 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. 379 // simulate this, we remove user's wallpaper info here.
377 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1); 380 WallpaperManager::Get()->RemoveUserWallpaperInfo(kTestUser1);
378 } 381 }
379 382
380 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation, 383 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestNoAnimation,
381 UsePreMigrationWallpaperInfo) { 384 UsePreMigrationWallpaperInfo) {
382 LogIn(kTestUser1); 385 LogIn(kTestUser1, kTestUser1Hash);
383 WaitAsyncWallpaperLoad(); 386 WaitAsyncWallpaperLoad();
384 // This test should finish normally. If timeout, it is probably because chrome 387 // This test should finish normally. If timeout, it is probably because chrome
385 // can not handle pre migrated user profile (M21 profile or older). 388 // can not handle pre migrated user profile (M21 profile or older).
386 } 389 }
387 390
388 class WallpaperManagerBrowserTestCrashRestore 391 class WallpaperManagerBrowserTestCrashRestore
389 : public WallpaperManagerBrowserTest { 392 : public WallpaperManagerBrowserTest {
390 public: 393 public:
391 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 394 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
392 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations); 395 command_line->AppendSwitch(chromeos::switches::kDisableLoginAnimations);
393 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation); 396 command_line->AppendSwitch(chromeos::switches::kDisableBootAnimation);
394 command_line->AppendSwitch(::switches::kMultiProfiles); 397 command_line->AppendSwitch(::switches::kMultiProfiles);
395 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1); 398 command_line->AppendSwitchASCII(switches::kLoginUser, kTestUser1);
396 command_line->AppendSwitchASCII(switches::kLoginProfile, 399 command_line->AppendSwitchASCII(switches::kLoginProfile,
397 CryptohomeClient::GetStubSanitizedUsername(kTestUser1)); 400 CryptohomeClient::GetStubSanitizedUsername(kTestUser1));
398 } 401 }
399 }; 402 };
400 403
401 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, 404 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore,
402 PRE_RestoreWallpaper) { 405 PRE_RestoreWallpaper) {
403 LogIn(kTestUser1); 406 LogIn(kTestUser1, kTestUser1Hash);
404 } 407 }
405 408
406 // Test for crbug.com/270278. It simulates a browser crash and verifies if user 409 // Test for crbug.com/270278. It simulates a browser crash and verifies if user
407 // wallpaper is loaded. 410 // wallpaper is loaded.
408 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, 411 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore,
409 RestoreWallpaper) { 412 RestoreWallpaper) {
410 EXPECT_EQ(1, LoadedWallpapers()); 413 EXPECT_EQ(1, LoadedWallpapers());
411 } 414 }
412 415
413 } // namespace chromeos 416 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698