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

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

Issue 294033002: Multi-profile flag cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Return --test-type flag back to profile_manager_unittest.cc 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 | 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 <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"
29 #include "chrome/test/base/testing_browser_process.h" 28 #include "chrome/test/base/testing_browser_process.h"
30 #include "chromeos/chromeos_switches.h" 29 #include "chromeos/chromeos_switches.h"
31 #include "chromeos/settings/cros_settings_names.h" 30 #include "chromeos/settings/cros_settings_names.h"
32 #include "chromeos/settings/cros_settings_provider.h" 31 #include "chromeos/settings/cros_settings_provider.h"
33 #include "grit/ash_resources.h" 32 #include "grit/ash_resources.h"
34 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
35 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/image/image.h" 35 #include "ui/gfx/image/image.h"
37 36
38 using namespace ash; 37 using namespace ash;
39 38
40 namespace chromeos { 39 namespace chromeos {
41 40
42 class WallpaperManagerCacheTest : public test::AshTestBase { 41 class WallpaperManagerCacheTest : public test::AshTestBase {
43 public: 42 public:
44 WallpaperManagerCacheTest() 43 WallpaperManagerCacheTest()
45 : fake_user_manager_(new FakeUserManager()), 44 : fake_user_manager_(new FakeUserManager()),
46 scoped_user_manager_(fake_user_manager_) { 45 scoped_user_manager_(fake_user_manager_) {
47 } 46 }
48 47
49 protected: 48 protected:
50 virtual ~WallpaperManagerCacheTest() {} 49 virtual ~WallpaperManagerCacheTest() {}
51 50
52 FakeUserManager* fake_user_manager() { return fake_user_manager_; } 51 FakeUserManager* fake_user_manager() { return fake_user_manager_; }
53 52
54 virtual void SetUp() OVERRIDE { 53 virtual void SetUp() OVERRIDE {
55 CommandLine::ForCurrentProcess()->AppendSwitch(::switches::kMultiProfiles);
56 test::AshTestBase::SetUp(); 54 test::AshTestBase::SetUp();
57 } 55 }
58 56
59 // Creates a test image of size 1x1. 57 // Creates a test image of size 1x1.
60 gfx::ImageSkia CreateTestImage(SkColor color) { 58 gfx::ImageSkia CreateTestImage(SkColor color) {
61 SkBitmap bitmap; 59 SkBitmap bitmap;
62 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); 60 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
63 bitmap.allocPixels(); 61 bitmap.allocPixels();
64 bitmap.eraseColor(color); 62 bitmap.eraseColor(color);
65 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 63 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. 98 // Logged in users' wallpaper cache should be kept.
101 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_1_wallpaper)); 99 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_1_wallpaper));
102 EXPECT_TRUE(test_api->GetWallpaperFromCache(test_user_2, &cached_wallpaper)); 100 EXPECT_TRUE(test_api->GetWallpaperFromCache(test_user_2, &cached_wallpaper));
103 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_2_wallpaper)); 101 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_2_wallpaper));
104 102
105 // Not logged in user's wallpaper cache should be cleared. 103 // Not logged in user's wallpaper cache should be cleared.
106 EXPECT_FALSE(test_api->GetWallpaperFromCache(test_user_3, &cached_wallpaper)); 104 EXPECT_FALSE(test_api->GetWallpaperFromCache(test_user_3, &cached_wallpaper));
107 } 105 }
108 106
109 } // namespace chromeos 107 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698