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

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

Issue 1483083003: Set the window state consistently Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « ash/wm/window_util_unittest.cc ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void OnWallpaperAnimationFinished(const std::string&) override { 70 void OnWallpaperAnimationFinished(const std::string&) 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 static void WaitForWallpaperAnimated() {
81 TestWallpaperObserver observer(WallpaperManager::Get());
82 observer.WaitForWallpaperAnimationFinished();
83 }
84
80 private: 85 private:
81 bool finished_; 86 bool finished_;
82 WallpaperManager* wallpaper_manager_; 87 WallpaperManager* wallpaper_manager_;
83 88
84 DISALLOW_COPY_AND_ASSIGN(TestWallpaperObserver); 89 DISALLOW_COPY_AND_ASSIGN(TestWallpaperObserver);
85 }; 90 };
86 91
87 } // namespace 92 } // namespace
88 93
89 // This is helper class for net::FakeURLFetcherFactory. 94 // This is helper class for net::FakeURLFetcherFactory.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // wallpaper images. 258 // wallpaper images.
254 scoped_ptr<base::ScopedTempDir> cmdline_wallpaper_dir_; 259 scoped_ptr<base::ScopedTempDir> cmdline_wallpaper_dir_;
255 260
256 private: 261 private:
257 DISALLOW_COPY_AND_ASSIGN(CustomizationWallpaperDownloaderBrowserTest); 262 DISALLOW_COPY_AND_ASSIGN(CustomizationWallpaperDownloaderBrowserTest);
258 }; 263 };
259 264
260 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest, 265 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
261 OEMWallpaperIsPresent) { 266 OEMWallpaperIsPresent) {
262 CreateCmdlineWallpapers(); 267 CreateCmdlineWallpapers();
268 TestWallpaperObserver::WaitForWallpaperAnimated();
269
263 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 270 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string());
264 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 271 TestWallpaperObserver::WaitForWallpaperAnimated();
265 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 272 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
266 controller_->GetWallpaper(), 273 controller_->GetWallpaper(),
267 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 274 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
268 275
269 WallpaperImageFetcherFactory url_factory( 276 WallpaperImageFetcherFactory url_factory(
270 GURL(kOEMWallpaperURL), 277 GURL(kOEMWallpaperURL),
271 wallpaper_manager_test_utils::kWallpaperSize, 278 wallpaper_manager_test_utils::kWallpaperSize,
272 wallpaper_manager_test_utils::kWallpaperSize, 279 wallpaper_manager_test_utils::kWallpaperSize,
273 wallpaper_manager_test_utils::kCustomWallpaperColor, 280 wallpaper_manager_test_utils::kCustomWallpaperColor,
274 0 /* require_retries */); 281 0 /* require_retries */);
275 282
276 TestWallpaperObserver observer(WallpaperManager::Get()); 283 TestWallpaperObserver observer(WallpaperManager::Get());
277 chromeos::ServicesCustomizationDocument* customization = 284 chromeos::ServicesCustomizationDocument* customization =
278 chromeos::ServicesCustomizationDocument::GetInstance(); 285 chromeos::ServicesCustomizationDocument::GetInstance();
279 EXPECT_TRUE( 286 EXPECT_TRUE(
280 customization->LoadManifestFromString(std::string(kServicesManifest))); 287 customization->LoadManifestFromString(std::string(kServicesManifest)));
281 288
282 observer.WaitForWallpaperAnimationFinished(); 289 observer.WaitForWallpaperAnimationFinished();
283 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 290 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
284 controller_->GetWallpaper(), 291 controller_->GetWallpaper(),
285 wallpaper_manager_test_utils::kCustomWallpaperColor)); 292 wallpaper_manager_test_utils::kCustomWallpaperColor));
286 EXPECT_EQ(1U, url_factory.num_attempts()); 293 EXPECT_EQ(1U, url_factory.num_attempts());
287 } 294 }
288 295
289 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest, 296 IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
290 OEMWallpaperRetryFetch) { 297 OEMWallpaperRetryFetch) {
291 CreateCmdlineWallpapers(); 298 CreateCmdlineWallpapers();
299 TestWallpaperObserver::WaitForWallpaperAnimated();
300
301 TestWallpaperObserver observer2(WallpaperManager::Get());
292 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 302 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string());
293 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 303 TestWallpaperObserver::WaitForWallpaperAnimated();
294 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 304 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
295 controller_->GetWallpaper(), 305 controller_->GetWallpaper(),
296 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 306 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
297 307
298 WallpaperImageFetcherFactory url_factory( 308 WallpaperImageFetcherFactory url_factory(
299 GURL(kOEMWallpaperURL), 309 GURL(kOEMWallpaperURL),
300 wallpaper_manager_test_utils::kWallpaperSize, 310 wallpaper_manager_test_utils::kWallpaperSize,
301 wallpaper_manager_test_utils::kWallpaperSize, 311 wallpaper_manager_test_utils::kWallpaperSize,
302 wallpaper_manager_test_utils::kCustomWallpaperColor, 312 wallpaper_manager_test_utils::kCustomWallpaperColor,
303 1 /* require_retries */); 313 1 /* require_retries */);
304 314
305 TestWallpaperObserver observer(WallpaperManager::Get());
306 chromeos::ServicesCustomizationDocument* customization = 315 chromeos::ServicesCustomizationDocument* customization =
307 chromeos::ServicesCustomizationDocument::GetInstance(); 316 chromeos::ServicesCustomizationDocument::GetInstance();
308 EXPECT_TRUE( 317 EXPECT_TRUE(
309 customization->LoadManifestFromString(std::string(kServicesManifest))); 318 customization->LoadManifestFromString(std::string(kServicesManifest)));
310 319
311 observer.WaitForWallpaperAnimationFinished(); 320 TestWallpaperObserver::WaitForWallpaperAnimated();
312 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 321 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
313 controller_->GetWallpaper(), 322 controller_->GetWallpaper(),
314 wallpaper_manager_test_utils::kCustomWallpaperColor)); 323 wallpaper_manager_test_utils::kCustomWallpaperColor));
315 324
316 EXPECT_EQ(2U, url_factory.num_attempts()); 325 EXPECT_EQ(2U, url_factory.num_attempts());
317 } 326 }
318 327
319 } // namespace chromeos 328 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/wm/window_util_unittest.cc ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698