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

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

Issue 221873005: Some cleanup of WallpaperManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 8 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
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 wallpaper_path, 136 wallpaper_path,
137 reinterpret_cast<const char*>(image_data->front()), 137 reinterpret_cast<const char*>(image_data->front()),
138 image_data->size()); 138 image_data->size());
139 EXPECT_EQ(static_cast<int>(image_data->size()), written); 139 EXPECT_EQ(static_cast<int>(image_data->size()), written);
140 } 140 }
141 141
142 int LoadedWallpapers() { 142 int LoadedWallpapers() {
143 return WallpaperManager::Get()->loaded_wallpapers(); 143 return WallpaperManager::Get()->loaded_wallpapers();
144 } 144 }
145 145
146 void ClearDisposableWallpaperCache() {
147 WallpaperManager::Get()->ClearDisposableWallpaperCache();
148 }
149
146 DesktopBackgroundController* controller_; 150 DesktopBackgroundController* controller_;
147 PrefService* local_state_; 151 PrefService* local_state_;
148 152
149 private: 153 private:
150 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBrowserTest); 154 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBrowserTest);
151 }; 155 };
152 156
153 // Tests that the appropriate custom wallpaper (large vs. small) is loaded 157 // Tests that the appropriate custom wallpaper (large vs. small) is loaded
154 // depending on the desktop resolution. 158 // depending on the desktop resolution.
155 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest, 159 IN_PROC_BROWSER_TEST_P(WallpaperManagerBrowserTest,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // Loads the same wallpaper before the initial one finished. It should be 241 // Loads the same wallpaper before the initial one finished. It should be
238 // prevented. 242 // prevented.
239 wallpaper_manager->SetUserWallpaperNow(kTestUser1); 243 wallpaper_manager->SetUserWallpaperNow(kTestUser1);
240 WaitAsyncWallpaperLoadFinished(); 244 WaitAsyncWallpaperLoadFinished();
241 EXPECT_EQ(1, LoadedWallpapers()); 245 EXPECT_EQ(1, LoadedWallpapers());
242 // Loads the same wallpaper after the initial one finished. It should be 246 // Loads the same wallpaper after the initial one finished. It should be
243 // prevented. 247 // prevented.
244 wallpaper_manager->SetUserWallpaperNow(kTestUser1); 248 wallpaper_manager->SetUserWallpaperNow(kTestUser1);
245 WaitAsyncWallpaperLoadFinished(); 249 WaitAsyncWallpaperLoadFinished();
246 EXPECT_EQ(1, LoadedWallpapers()); 250 EXPECT_EQ(1, LoadedWallpapers());
247 wallpaper_manager->ClearDisposableWallpaperCache(); 251 ClearDisposableWallpaperCache();
248 252
249 // Change wallpaper to a custom wallpaper. 253 // Change wallpaper to a custom wallpaper.
250 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); 254 std::string id = base::Int64ToString(base::Time::Now().ToInternalValue());
251 base::FilePath small_wallpaper_path = GetCustomWallpaperPath( 255 base::FilePath small_wallpaper_path = GetCustomWallpaperPath(
252 kSmallWallpaperSubDir, 256 kSmallWallpaperSubDir,
253 kTestUser1Hash, 257 kTestUser1Hash,
254 id); 258 id);
255 SaveUserWallpaperData(small_wallpaper_path, 259 SaveUserWallpaperData(small_wallpaper_path,
256 kSmallWallpaperResourceId); 260 kSmallWallpaperResourceId);
257 261
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 568
565 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestCrashRestoreInstantiation, 569 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestCrashRestoreInstantiation,
566 WallpaperManagerBrowserTestCrashRestore, 570 WallpaperManagerBrowserTestCrashRestore,
567 testing::Bool()); 571 testing::Bool());
568 572
569 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestCacheUpdateInstantiation, 573 INSTANTIATE_TEST_CASE_P(WallpaperManagerBrowserTestCacheUpdateInstantiation,
570 WallpaperManagerBrowserTestCacheUpdate, 574 WallpaperManagerBrowserTestCacheUpdate,
571 testing::Bool()); 575 testing::Bool());
572 576
573 } // namespace chromeos 577 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698