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

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

Issue 2452983002: ChromeOS: This CL moves chromeos/login/user_names* to user_mananger. (Closed)
Patch Set: Removed unused #includes Created 4 years, 1 month 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 #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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/common/wallpaper/wallpaper_controller.h" 9 #include "ash/common/wallpaper/wallpaper_controller.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
24 #include "base/time/time.h" 24 #include "base/time/time.h"
25 #include "base/values.h" 25 #include "base/values.h"
26 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u tils.h" 26 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u tils.h"
27 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
28 #include "chrome/test/base/in_process_browser_test.h" 28 #include "chrome/test/base/in_process_browser_test.h"
29 #include "chrome/test/base/testing_browser_process.h" 29 #include "chrome/test/base/testing_browser_process.h"
30 #include "chromeos/chromeos_switches.h" 30 #include "chromeos/chromeos_switches.h"
31 #include "chromeos/login/user_names.h"
32 #include "components/prefs/scoped_user_pref_update.h" 31 #include "components/prefs/scoped_user_pref_update.h"
33 #include "components/signin/core/account_id/account_id.h" 32 #include "components/signin/core/account_id/account_id.h"
34 #include "components/user_manager/user.h" 33 #include "components/user_manager/user.h"
35 #include "components/user_manager/user_manager.h" 34 #include "components/user_manager/user_manager.h"
35 #include "components/user_manager/user_names.h"
36 #include "components/wallpaper/wallpaper_files_id.h" 36 #include "components/wallpaper/wallpaper_files_id.h"
37 #include "content/public/test/test_utils.h" 37 #include "content/public/test/test_utils.h"
38 #include "ui/aura/env.h" 38 #include "ui/aura/env.h"
39 #include "ui/gfx/geometry/point.h" 39 #include "ui/gfx/geometry/point.h"
40 #include "ui/gfx/geometry/rect.h" 40 #include "ui/gfx/geometry/rect.h"
41 #include "ui/gfx/image/image_skia.h" 41 #include "ui/gfx/image/image_skia.h"
42 42
43 using wallpaper::WallpaperInfo; 43 using wallpaper::WallpaperInfo;
44 using wallpaper::WALLPAPER_LAYOUT_CENTER; 44 using wallpaper::WALLPAPER_LAYOUT_CENTER;
45 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; 45 using wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // This test should finish normally. If timeout, it is probably because chrome 360 // This test should finish normally. If timeout, it is probably because chrome
361 // can not handle pre migrated user profile (M21 profile or older). 361 // can not handle pre migrated user profile (M21 profile or older).
362 } 362 }
363 363
364 // Test for http://crbug.com/265689. When hooked up a large external monitor, 364 // Test for http://crbug.com/265689. When hooked up a large external monitor,
365 // the default large resolution wallpaper should load. 365 // the default large resolution wallpaper should load.
366 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 366 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
367 HotPlugInScreenAtGAIALoginScreen) { 367 HotPlugInScreenAtGAIALoginScreen) {
368 UpdateDisplay("800x600"); 368 UpdateDisplay("800x600");
369 // Set initial wallpaper to the default wallpaper. 369 // Set initial wallpaper to the default wallpaper.
370 WallpaperManager::Get()->SetDefaultWallpaperNow(login::StubAccountId()); 370 WallpaperManager::Get()->SetDefaultWallpaperNow(
371 user_manager::StubAccountId());
371 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 372 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
372 373
373 // Hook up a 2000x2000 display. The large resolution custom wallpaper should 374 // Hook up a 2000x2000 display. The large resolution custom wallpaper should
374 // be loaded. 375 // be loaded.
375 UpdateDisplay("800x600,2000x2000"); 376 UpdateDisplay("800x600,2000x2000");
376 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 377 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
377 } 378 }
378 379
379 class WallpaperManagerBrowserTestNoAnimation 380 class WallpaperManagerBrowserTestNoAnimation
380 : public WallpaperManagerBrowserTest { 381 : public WallpaperManagerBrowserTest {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 760 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
760 controller_->GetWallpaper(), 761 controller_->GetWallpaper(),
761 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor)); 762 wallpaper_manager_test_utils::kLargeDefaultWallpaperColor));
762 } 763 }
763 764
764 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallGuestWallpaper) { 765 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallGuestWallpaper) {
765 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) 766 if (!ash::test::AshTestHelper::SupportsMultipleDisplays())
766 return; 767 return;
767 CreateCmdlineWallpapers(); 768 CreateCmdlineWallpapers();
768 user_manager::UserManager::Get()->UserLoggedIn( 769 user_manager::UserManager::Get()->UserLoggedIn(
769 chromeos::login::GuestAccountId(), chromeos::login::kGuestUserName, 770 user_manager::GuestAccountId(), user_manager::kGuestUserName, false);
770 false);
771 UpdateDisplay("800x600"); 771 UpdateDisplay("800x600");
772 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); 772 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
773 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 773 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
774 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 774 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
775 controller_->GetWallpaper(), 775 controller_->GetWallpaper(),
776 wallpaper_manager_test_utils::kSmallGuestWallpaperColor)); 776 wallpaper_manager_test_utils::kSmallGuestWallpaperColor));
777 } 777 }
778 778
779 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, LargeGuestWallpaper) { 779 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, LargeGuestWallpaper) {
780 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) 780 if (!ash::test::AshTestHelper::SupportsMultipleDisplays())
781 return; 781 return;
782 782
783 CreateCmdlineWallpapers(); 783 CreateCmdlineWallpapers();
784 user_manager::UserManager::Get()->UserLoggedIn( 784 user_manager::UserManager::Get()->UserLoggedIn(
785 chromeos::login::GuestAccountId(), chromeos::login::kGuestUserName, 785 user_manager::GuestAccountId(), user_manager::kGuestUserName, false);
786 false);
787 UpdateDisplay("1600x1200"); 786 UpdateDisplay("1600x1200");
788 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); 787 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
789 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 788 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
790 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 789 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
791 controller_->GetWallpaper(), 790 controller_->GetWallpaper(),
792 wallpaper_manager_test_utils::kLargeGuestWallpaperColor)); 791 wallpaper_manager_test_utils::kLargeGuestWallpaperColor));
793 } 792 }
794 793
795 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallChildWallpaper) { 794 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, SmallChildWallpaper) {
796 if (!ash::test::AshTestHelper::SupportsMultipleDisplays()) 795 if (!ash::test::AshTestHelper::SupportsMultipleDisplays())
(...skipping 20 matching lines...) Expand all
817 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 816 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
818 controller_->GetWallpaper(), 817 controller_->GetWallpaper(),
819 wallpaper_manager_test_utils::kLargeChildWallpaperColor)); 818 wallpaper_manager_test_utils::kLargeChildWallpaperColor));
820 } 819 }
821 820
822 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, 821 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest,
823 SwitchBetweenDefaultAndCustom) { 822 SwitchBetweenDefaultAndCustom) {
824 // Start loading the default wallpaper. 823 // Start loading the default wallpaper.
825 UpdateDisplay("640x480"); 824 UpdateDisplay("640x480");
826 CreateCmdlineWallpapers(); 825 CreateCmdlineWallpapers();
827 user_manager::UserManager::Get()->UserLoggedIn( 826 user_manager::UserManager::Get()->UserLoggedIn(user_manager::StubAccountId(),
828 chromeos::login::StubAccountId(), "test_hash", false); 827 "test_hash", false);
829 828
830 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); 829 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
831 830
832 // Custom wallpaper should be applied immediately, canceling the default 831 // Custom wallpaper should be applied immediately, canceling the default
833 // wallpaper load task. 832 // wallpaper load task.
834 gfx::ImageSkia image = wallpaper_manager_test_utils::CreateTestImage( 833 gfx::ImageSkia image = wallpaper_manager_test_utils::CreateTestImage(
835 640, 480, wallpaper_manager_test_utils::kCustomWallpaperColor); 834 640, 480, wallpaper_manager_test_utils::kCustomWallpaperColor);
836 WallpaperManager::Get()->SetCustomWallpaper( 835 WallpaperManager::Get()->SetCustomWallpaper(
837 chromeos::login::StubAccountId(), 836 user_manager::StubAccountId(),
838 wallpaper::WallpaperFilesId::FromString("test_hash"), "test-nofile.jpeg", 837 wallpaper::WallpaperFilesId::FromString("test_hash"), "test-nofile.jpeg",
839 WALLPAPER_LAYOUT_STRETCH, user_manager::User::CUSTOMIZED, image, true); 838 WALLPAPER_LAYOUT_STRETCH, user_manager::User::CUSTOMIZED, image, true);
840 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 839 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
841 840
842 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 841 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
843 controller_->GetWallpaper(), 842 controller_->GetWallpaper(),
844 wallpaper_manager_test_utils::kCustomWallpaperColor)); 843 wallpaper_manager_test_utils::kCustomWallpaperColor));
845 844
846 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId()); 845 WallpaperManager::Get()->SetDefaultWallpaperNow(EmptyAccountId());
847 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished(); 846 wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
848 847
849 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( 848 EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
850 controller_->GetWallpaper(), 849 controller_->GetWallpaper(),
851 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor)); 850 wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
852 } 851 }
853 852
854 } // namespace chromeos 853 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698