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

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

Issue 287083003: Multi-profile flag cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Created 6 years, 7 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 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 <cstdlib> 5 #include <cstdlib>
6 #include <cstring> 6 #include <cstring>
7 7
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/shell.h" 10 #include "ash/shell.h"
11 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
12 #include "ash/test/display_manager_test_api.h" 12 #include "ash/test/display_manager_test_api.h"
13 #include "ash/test/test_user_wallpaper_delegate.h" 13 #include "ash/test/test_user_wallpaper_delegate.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/files/scoped_temp_dir.h" 17 #include "base/files/scoped_temp_dir.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #include "base/prefs/testing_pref_service.h" 20 #include "base/prefs/testing_pref_service.h"
21 #include "chrome/browser/chromeos/login/startup_utils.h" 21 #include "chrome/browser/chromeos/login/startup_utils.h"
22 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" 22 #include "chrome/browser/chromeos/login/users/fake_user_manager.h"
23 #include "chrome/browser/chromeos/login/users/user_manager_impl.h" 23 #include "chrome/browser/chromeos/login/users/user_manager_impl.h"
24 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 24 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
25 #include "chrome/browser/chromeos/settings/cros_settings.h" 25 #include "chrome/browser/chromeos/settings/cros_settings.h"
26 #include "chrome/browser/chromeos/settings/device_settings_service.h" 26 #include "chrome/browser/chromeos/settings/device_settings_service.h"
27 #include "chrome/browser/prefs/browser_prefs.h" 27 #include "chrome/browser/prefs/browser_prefs.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
Nikita (slow) 2014/05/19 14:27:15 nit: not used
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/settings/cros_settings_names.h" 31 #include "chromeos/settings/cros_settings_names.h"
32 #include "chromeos/settings/cros_settings_provider.h" 32 #include "chromeos/settings/cros_settings_provider.h"
33 #include "grit/ash_resources.h" 33 #include "grit/ash_resources.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/image/image.h" 36 #include "ui/gfx/image/image.h"
37 37
38 using namespace ash; 38 using namespace ash;
39 39
40 namespace chromeos { 40 namespace chromeos {
41 41
42 class WallpaperManagerCacheTest : public test::AshTestBase { 42 class WallpaperManagerCacheTest : public test::AshTestBase {
43 public: 43 public:
44 WallpaperManagerCacheTest() 44 WallpaperManagerCacheTest()
45 : fake_user_manager_(new FakeUserManager()), 45 : fake_user_manager_(new FakeUserManager()),
46 scoped_user_manager_(fake_user_manager_) { 46 scoped_user_manager_(fake_user_manager_) {
47 } 47 }
48 48
49 protected: 49 protected:
50 virtual ~WallpaperManagerCacheTest() {} 50 virtual ~WallpaperManagerCacheTest() {}
51 51
52 FakeUserManager* fake_user_manager() { return fake_user_manager_; } 52 FakeUserManager* fake_user_manager() { return fake_user_manager_; }
53 53
54 virtual void SetUp() OVERRIDE { 54 virtual void SetUp() OVERRIDE {
55 CommandLine::ForCurrentProcess()->AppendSwitch(::switches::kMultiProfiles);
56 test::AshTestBase::SetUp(); 55 test::AshTestBase::SetUp();
57 } 56 }
58 57
59 // Creates a test image of size 1x1. 58 // Creates a test image of size 1x1.
60 gfx::ImageSkia CreateTestImage(SkColor color) { 59 gfx::ImageSkia CreateTestImage(SkColor color) {
61 SkBitmap bitmap; 60 SkBitmap bitmap;
62 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); 61 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
63 bitmap.allocPixels(); 62 bitmap.allocPixels();
64 bitmap.eraseColor(color); 63 bitmap.eraseColor(color);
65 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 64 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Logged in users' wallpaper cache should be kept. 99 // Logged in users' wallpaper cache should be kept.
101 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_1_wallpaper)); 100 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_1_wallpaper));
102 EXPECT_TRUE(test_api->GetWallpaperFromCache(test_user_2, &cached_wallpaper)); 101 EXPECT_TRUE(test_api->GetWallpaperFromCache(test_user_2, &cached_wallpaper));
103 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_2_wallpaper)); 102 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_2_wallpaper));
104 103
105 // Not logged in user's wallpaper cache should be cleared. 104 // Not logged in user's wallpaper cache should be cleared.
106 EXPECT_FALSE(test_api->GetWallpaperFromCache(test_user_3, &cached_wallpaper)); 105 EXPECT_FALSE(test_api->GetWallpaperFromCache(test_user_3, &cached_wallpaper));
107 } 106 }
108 107
109 } // namespace chromeos 108 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698