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

Side by Side Diff: chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc

Issue 1497973002: This CL replaces e-mail with AccountId in wallpaper manager code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years 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
OLDNEW
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 5
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/shell.h" 9 #include "ash/shell.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 : finished_(false), 60 : finished_(false),
61 wallpaper_manager_(wallpaper_manager) { 61 wallpaper_manager_(wallpaper_manager) {
62 DCHECK(wallpaper_manager_); 62 DCHECK(wallpaper_manager_);
63 wallpaper_manager_->AddObserver(this); 63 wallpaper_manager_->AddObserver(this);
64 } 64 }
65 65
66 ~TestWallpaperObserver() override { 66 ~TestWallpaperObserver() override {
67 wallpaper_manager_->RemoveObserver(this); 67 wallpaper_manager_->RemoveObserver(this);
68 } 68 }
69 69
70 void OnWallpaperAnimationFinished(const std::string&) override { 70 void OnWallpaperAnimationFinished(const AccountId&) override {
71 finished_ = true; 71 finished_ = true;
72 base::MessageLoop::current()->QuitWhenIdle(); 72 base::MessageLoop::current()->QuitWhenIdle();
73 } 73 }
74 74
75 void WaitForWallpaperAnimationFinished() { 75 void WaitForWallpaperAnimationFinished() {
76 while (!finished_) 76 while (!finished_)
77 base::RunLoop().Run(); 77 base::RunLoop().Run();
78 } 78 }
79 79
80 private: 80 private:
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // wallpaper images. 253 // wallpaper images.
254 scoped_ptr<base::ScopedTempDir> cmdline_wallpaper_dir_; 254 scoped_ptr<base::ScopedTempDir> cmdline_wallpaper_dir_;
255 255
256 private: 256 private:
257 DISALLOW_COPY_AND_ASSIGN(CustomizationWallpaperDownloaderBrowserTest); 257 DISALLOW_COPY_AND_ASSIGN(CustomizationWallpaperDownloaderBrowserTest);
258 }; 258 };
259 259
260 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest, 260 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
261 OEMWallpaperIsPresent) { 261 OEMWallpaperIsPresent) {
262 CreateCmdlineWallpapers(); 262 CreateCmdlineWallpapers();
263 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 263 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
264 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 264 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
265 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 265 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
266 controller_->GetWallpaper(), 266 controller_->GetWallpaper(),
267 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 267 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
268 268
269 WallpaperImageFetcherFactory url_factory( 269 WallpaperImageFetcherFactory url_factory(
270 GURL(kOEMWallpaperURL), 270 GURL(kOEMWallpaperURL),
271 wallpaper_manager_test_utils::kWallpaperSize, 271 wallpaper_manager_test_utils::kWallpaperSize,
272 wallpaper_manager_test_utils::kWallpaperSize, 272 wallpaper_manager_test_utils::kWallpaperSize,
273 wallpaper_manager_test_utils::kCustomWallpaperColor, 273 wallpaper_manager_test_utils::kCustomWallpaperColor,
274 0 /* require_retries */); 274 0 /* require_retries */);
275 275
276 TestWallpaperObserver observer(WallpaperManager::Get()); 276 TestWallpaperObserver observer(WallpaperManager::Get());
277 chromeos::ServicesCustomizationDocument* customization = 277 chromeos::ServicesCustomizationDocument* customization =
278 chromeos::ServicesCustomizationDocument::GetInstance(); 278 chromeos::ServicesCustomizationDocument::GetInstance();
279 EXPECT_TRUE( 279 EXPECT_TRUE(
280 customization->LoadManifestFromString(std::string(kServicesManifest))); 280 customization->LoadManifestFromString(std::string(kServicesManifest)));
281 281
282 observer.WaitForWallpaperAnimationFinished(); 282 observer.WaitForWallpaperAnimationFinished();
283 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 283 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
284 controller_->GetWallpaper(), 284 controller_->GetWallpaper(),
285 wallpaper_manager_test_utils::kCustomWallpaperColor)); 285 wallpaper_manager_test_utils::kCustomWallpaperColor));
286 EXPECT_EQ(1U, url_factory.num_attempts()); 286 EXPECT_EQ(1U, url_factory.num_attempts());
287 } 287 }
288 288
289 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest, 289 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
290 OEMWallpaperRetryFetch) { 290 OEMWallpaperRetryFetch) {
291 CreateCmdlineWallpapers(); 291 CreateCmdlineWallpapers();
292 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 292 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
293 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 293 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
294 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 294 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
295 controller_->GetWallpaper(), 295 controller_->GetWallpaper(),
296 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 296 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
297 297
298 WallpaperImageFetcherFactory url_factory( 298 WallpaperImageFetcherFactory url_factory(
299 GURL(kOEMWallpaperURL), 299 GURL(kOEMWallpaperURL),
300 wallpaper_manager_test_utils::kWallpaperSize, 300 wallpaper_manager_test_utils::kWallpaperSize,
301 wallpaper_manager_test_utils::kWallpaperSize, 301 wallpaper_manager_test_utils::kWallpaperSize,
302 wallpaper_manager_test_utils::kCustomWallpaperColor, 302 wallpaper_manager_test_utils::kCustomWallpaperColor,
303 1 /* require_retries */); 303 1 /* require_retries */);
304 304
305 TestWallpaperObserver observer(WallpaperManager::Get()); 305 TestWallpaperObserver observer(WallpaperManager::Get());
306 chromeos::ServicesCustomizationDocument* customization = 306 chromeos::ServicesCustomizationDocument* customization =
307 chromeos::ServicesCustomizationDocument::GetInstance(); 307 chromeos::ServicesCustomizationDocument::GetInstance();
308 EXPECT_TRUE( 308 EXPECT_TRUE(
309 customization->LoadManifestFromString(std::string(kServicesManifest))); 309 customization->LoadManifestFromString(std::string(kServicesManifest)));
310 310
311 observer.WaitForWallpaperAnimationFinished(); 311 observer.WaitForWallpaperAnimationFinished();
312 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 312 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
313 controller_->GetWallpaper(), 313 controller_->GetWallpaper(),
314 wallpaper_manager_test_utils::kCustomWallpaperColor)); 314 wallpaper_manager_test_utils::kCustomWallpaperColor));
315 315
316 EXPECT_EQ(2U, url_factory.num_attempts()); 316 EXPECT_EQ(2U, url_factory.num_attempts());
317 } 317 }
318 318
319 } // namespace chromeos 319 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc ('k') | chrome/browser/chromeos/extensions/wallpaper_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698