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

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

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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 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 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
6 6
7 #include "ash/desktop_background/desktop_background_controller.h" 7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/desktop_background/desktop_background_controller_observer.h" 8 #include "ash/desktop_background/desktop_background_controller_observer.h"
9 #include "ash/desktop_background/desktop_background_controller_test_api.h" 9 #include "ash/desktop_background/desktop_background_controller_test_api.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 username_hash, 103 username_hash,
104 id); 104 id);
105 if (!base::DirectoryExists(wallpaper_path.DirName())) 105 if (!base::DirectoryExists(wallpaper_path.DirName()))
106 base::CreateDirectory(wallpaper_path.DirName()); 106 base::CreateDirectory(wallpaper_path.DirName());
107 107
108 return wallpaper_path; 108 return wallpaper_path;
109 } 109 }
110 110
111 // Logs in |username|. 111 // Logs in |username|.
112 void LogIn(const std::string& username, const std::string& username_hash) { 112 void LogIn(const std::string& username, const std::string& username_hash) {
113 UserManager::Get()->UserLoggedIn(username, username_hash, false); 113 GetUserManager()->UserLoggedIn(username, username_hash, false);
114 WaitAsyncWallpaperLoadStarted(); 114 WaitAsyncWallpaperLoadStarted();
115 } 115 }
116 116
117 int LoadedWallpapers() { 117 int LoadedWallpapers() {
118 return WallpaperManager::Get()->loaded_wallpapers(); 118 return WallpaperManager::Get()->loaded_wallpapers();
119 } 119 }
120 120
121 void ClearDisposableWallpaperCache() { 121 void ClearDisposableWallpaperCache() {
122 WallpaperManager::Get()->ClearDisposableWallpaperCache(); 122 WallpaperManager::Get()->ClearDisposableWallpaperCache();
123 } 123 }
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 740 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
741 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 741 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
742 controller_->GetWallpaper(), 742 controller_->GetWallpaper(),
743 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); 743 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor));
744 } 744 }
745 745
746 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallGuestWallpaper) { 746 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallGuestWallpaper) {
747 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) 747 if (!ash::test::AshTestHelper::SupportsMultipleDisplays())
748 return; 748 return;
749 CreateCmdlineWallpapers(); 749 CreateCmdlineWallpapers();
750 UserManager::Get()->UserLoggedIn( 750 GetUserManager()->UserLoggedIn(
751 UserManager::kGuestUserName, UserManager::kGuestUserName, false); 751 UserManager::kGuestUserName, UserManager::kGuestUserName, false);
752 UpdateDisplay("800x600"); 752 UpdateDisplay("800x600");
753 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 753 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string());
754 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 754 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
755 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 755 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
756 controller_->GetWallpaper(), 756 controller_->GetWallpaper(),
757 wallpaper_manager_test_utils::kSmallGuestWallpaperColor)); 757 wallpaper_manager_test_utils::kSmallGuestWallpaperColor));
758 } 758 }
759 759
760 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, LargeGuestWallpaper) { 760 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, LargeGuestWallpaper) {
761 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) 761 if (!ash::test::AshTestHelper::SupportsMultipleDisplays())
762 return; 762 return;
763 763
764 CreateCmdlineWallpapers(); 764 CreateCmdlineWallpapers();
765 UserManager::Get()->UserLoggedIn( 765 GetUserManager()->UserLoggedIn(
766 UserManager::kGuestUserName, UserManager::kGuestUserName, false); 766 UserManager::kGuestUserName, UserManager::kGuestUserName, false);
767 UpdateDisplay("1600x1200"); 767 UpdateDisplay("1600x1200");
768 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 768 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string());
769 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 769 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
770 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 770 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
771 controller_->GetWallpaper(), 771 controller_->GetWallpaper(),
772 wallpaper_manager_test_utils::kLargeGuestWallpaperColor)); 772 wallpaper_manager_test_utils::kLargeGuestWallpaperColor));
773 } 773 }
774 774
775 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 775 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
776 SwitchBetweenDefaultAndCustom) { 776 SwitchBetweenDefaultAndCustom) {
777 // Start loading the default wallpaper. 777 // Start loading the default wallpaper.
778 UpdateDisplay("640x480"); 778 UpdateDisplay("640x480");
779 CreateCmdlineWallpapers(); 779 CreateCmdlineWallpapers();
780 UserManager::Get()->UserLoggedIn(UserManager::kStubUser, "test_hash", false); 780 GetUserManager()->UserLoggedIn(UserManager::kStubUser, "test_hash", false);
781 781
782 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 782 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string());
783 783
784 // Custom wallpaper should be applied immediately, canceling the default 784 // Custom wallpaper should be applied immediately, canceling the default
785 // wallpaper load task. 785 // wallpaper load task.
786 gfx::ImageSkia image = wallpaper_manager_test_utils::CreateTestImage( 786 gfx::ImageSkia image = wallpaper_manager_test_utils::CreateTestImage(
787 640, 480, wallpaper_manager_test_utils::kCustomWallpaperColor); 787 640, 480, wallpaper_manager_test_utils::kCustomWallpaperColor);
788 WallpaperManager::Get()->SetCustomWallpaper(UserManager::kStubUser, 788 WallpaperManager::Get()->SetCustomWallpaper(UserManager::kStubUser,
789 "test_hash", 789 "test_hash",
790 "test-nofile.jpeg", 790 "test-nofile.jpeg",
791 WALLPAPER_LAYOUT_STRETCH, 791 WALLPAPER_LAYOUT_STRETCH,
792 User::CUSTOMIZED, 792 User::CUSTOMIZED,
793 image, 793 image,
794 true); 794 true);
795 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 795 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
796 796
797 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 797 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
798 controller_->GetWallpaper(), 798 controller_->GetWallpaper(),
799 wallpaper_manager_test_utils::kCustomWallpaperColor)); 799 wallpaper_manager_test_utils::kCustomWallpaperColor));
800 800
801 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string()); 801 WallpaperManager::Get()->SetDefaultWallpaperNow(std::string());
802 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 802 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
803 803
804 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 804 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
805 controller_->GetWallpaper(), 805 controller_->GetWallpaper(),
806 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 806 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
807 } 807 }
808 808
809 } // namespace chromeos 809 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698