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

Unified Diff: chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc

Issue 11299284: Revert 170507 - Add public accounts to UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc
===================================================================
--- chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc (revision 170577)
+++ chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc (working copy)
@@ -16,7 +16,6 @@
#include "base/values.h"
#include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
#include "chrome/browser/chromeos/login/user.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/test/base/testing_browser_process.h"
#include "ui/aura/env.h"
@@ -28,6 +27,8 @@
namespace {
+const char kTestUser1[] = "test-user@example.com";
+
#if defined(GOOGLE_CHROME_BUILD)
int kExpectedSmallWallpaperWidth = ash::kSmallWallpaperMaxWidth;
int kExpectedSmallWallpaperHeight = ash::kSmallWallpaperMaxHeight;
@@ -82,6 +83,13 @@
MessageLoop::current()->Quit();
}
+ // Sets |username| wallpaper.
+ void SetUserWallpaper(const std::string& username) {
+ ListPrefUpdate users_pref(local_state_, "LoggedInUsers");
+ users_pref->AppendIfNotPresent(new base::StringValue(username));
+ WallpaperManager::Get()->SetUserWallpaper(username);
+ }
+
protected:
// Saves bitmap |resource_id| to disk.
void SaveUserWallpaperData(const std::string& username,
@@ -121,9 +129,9 @@
User::DEFAULT,
base::Time::Now().LocalMidnight()
};
- wallpaper_manager->SetUserWallpaperInfo(UserManager::kStubUser, info, true);
+ wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ SetUserWallpaper(kTestUser1);
WaitAsyncWallpaperLoad();
gfx::ImageSkia wallpaper = controller_->GetWallpaper();
@@ -157,30 +165,31 @@
LoadCustomLargeWallpaperForLargeExternalScreen) {
WallpaperManager* wallpaper_manager = WallpaperManager::Get();
FilePath small_wallpaper_path =
- wallpaper_manager->GetWallpaperPathForUser(UserManager::kStubUser, true);
+ wallpaper_manager->GetWallpaperPathForUser(kTestUser1, true);
FilePath large_wallpaper_path =
- wallpaper_manager->GetWallpaperPathForUser(UserManager::kStubUser, false);
+ wallpaper_manager->GetWallpaperPathForUser(kTestUser1, false);
// Saves the small/large resolution wallpapers to small/large custom
// wallpaper paths.
- SaveUserWallpaperData(UserManager::kStubUser,
+ SaveUserWallpaperData(kTestUser1,
small_wallpaper_path,
ash::kDefaultSmallWallpaper.idr);
- SaveUserWallpaperData(UserManager::kStubUser,
+ SaveUserWallpaperData(kTestUser1,
large_wallpaper_path,
ash::kDefaultLargeWallpaper.idr);
- // Saves wallpaper info to local state for user |UserManager::kStubUser|.
+ // Saves wallpaper info to local state for user |kTestUser1|.
WallpaperInfo info = {
"DUMMY",
WALLPAPER_LAYOUT_CENTER_CROPPED,
User::CUSTOMIZED,
base::Time::Now().LocalMidnight()
};
- wallpaper_manager->SetUserWallpaperInfo(UserManager::kStubUser, info, true);
+ wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
- // Set the wallpaper for |UserManager::kStubUser|.
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ // Add user |kTestUser1|.
+
+ SetUserWallpaper(kTestUser1);
WaitAsyncWallpaperLoad();
gfx::ImageSkia wallpaper = controller_->GetWallpaper();
@@ -215,46 +224,46 @@
PreventReloadingSameWallpaper) {
WallpaperManager* wallpaper_manager = WallpaperManager::Get();
FilePath small_wallpaper_path =
- wallpaper_manager->GetWallpaperPathForUser(UserManager::kStubUser, true);
+ wallpaper_manager->GetWallpaperPathForUser(kTestUser1, true);
- SaveUserWallpaperData(UserManager::kStubUser,
+ SaveUserWallpaperData(kTestUser1,
small_wallpaper_path,
ash::kDefaultSmallWallpaper.idr);
- // Saves wallpaper info to local state for user |UserManager::kStubUser|.
+ // Saves wallpaper info to local state for user |kTestUser1|.
WallpaperInfo info = {
"DUMMY",
WALLPAPER_LAYOUT_CENTER_CROPPED,
User::CUSTOMIZED,
base::Time::Now().LocalMidnight()
};
- wallpaper_manager->SetUserWallpaperInfo(UserManager::kStubUser, info, true);
+ wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ SetUserWallpaper(kTestUser1);
EXPECT_EQ(1, LoadedWallpapers());
// Loads the same wallpaper before the initial one finished. It should be
// prevented.
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ SetUserWallpaper(kTestUser1);
EXPECT_EQ(1, LoadedWallpapers());
WaitAsyncWallpaperLoad();
// Loads the same wallpaper after the initial one finished. It should be
// prevented.
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ SetUserWallpaper(kTestUser1);
EXPECT_EQ(1, LoadedWallpapers());
wallpaper_manager->ClearWallpaperCache();
- // Tests default wallpaper for user |UserManager::kStubUser|.
+ // Tests default wallpaper for user |kTestUser1|.
info.file = "";
info.type = User::DEFAULT;
- wallpaper_manager->SetUserWallpaperInfo(UserManager::kStubUser, info, true);
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ wallpaper_manager->SetUserWallpaperInfo(kTestUser1, info, true);
+ SetUserWallpaper(kTestUser1);
EXPECT_EQ(2, LoadedWallpapers());
// Loads the same wallpaper before the initial one finished. It should be
// prevented.
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ SetUserWallpaper(kTestUser1);
EXPECT_EQ(2, LoadedWallpapers());
WaitAsyncWallpaperLoad();
- wallpaper_manager->SetUserWallpaper(UserManager::kStubUser);
+ SetUserWallpaper(kTestUser1);
EXPECT_EQ(2, LoadedWallpapers());
}
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_unittest.cc ('k') | chrome/browser/chromeos/settings/device_settings_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698