OLD | NEW |
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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 public: | 40 public: |
41 WallpaperManagerCacheTest() | 41 WallpaperManagerCacheTest() |
42 : fake_user_manager_(new FakeChromeUserManager()), | 42 : fake_user_manager_(new FakeChromeUserManager()), |
43 scoped_user_manager_(fake_user_manager_) {} | 43 scoped_user_manager_(fake_user_manager_) {} |
44 | 44 |
45 protected: | 45 protected: |
46 ~WallpaperManagerCacheTest() override {} | 46 ~WallpaperManagerCacheTest() override {} |
47 | 47 |
48 FakeChromeUserManager* fake_user_manager() { return fake_user_manager_; } | 48 FakeChromeUserManager* fake_user_manager() { return fake_user_manager_; } |
49 | 49 |
50 void SetUp() override { test::AshTestBase::SetUp(); } | 50 void SetUp() override { |
| 51 test::AshTestBase::SetUp(); |
| 52 WallpaperManager::Initialize(); |
| 53 } |
| 54 |
| 55 void TearDown() override { |
| 56 WallpaperManager::Shutdown(); |
| 57 test::AshTestBase::TearDown(); |
| 58 } |
51 | 59 |
52 // Creates a test image of size 1x1. | 60 // Creates a test image of size 1x1. |
53 gfx::ImageSkia CreateTestImage(SkColor color) { | 61 gfx::ImageSkia CreateTestImage(SkColor color) { |
54 SkBitmap bitmap; | 62 SkBitmap bitmap; |
55 bitmap.allocN32Pixels(1, 1); | 63 bitmap.allocN32Pixels(1, 1); |
56 bitmap.eraseColor(color); | 64 bitmap.eraseColor(color); |
57 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 65 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
58 } | 66 } |
59 | 67 |
60 private: | 68 private: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 EXPECT_TRUE(test_api->GetPathFromCache(test_user_2, &path)); | 109 EXPECT_TRUE(test_api->GetPathFromCache(test_user_2, &path)); |
102 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_2_wallpaper)); | 110 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(test_user_2_wallpaper)); |
103 EXPECT_EQ(path, path2); | 111 EXPECT_EQ(path, path2); |
104 | 112 |
105 // Not logged in user's wallpaper cache should be cleared. | 113 // Not logged in user's wallpaper cache should be cleared. |
106 EXPECT_FALSE(test_api->GetWallpaperFromCache(test_user_3, &cached_wallpaper)); | 114 EXPECT_FALSE(test_api->GetWallpaperFromCache(test_user_3, &cached_wallpaper)); |
107 EXPECT_FALSE(test_api->GetPathFromCache(test_user_3, &path)); | 115 EXPECT_FALSE(test_api->GetPathFromCache(test_user_3, &path)); |
108 } | 116 } |
109 | 117 |
110 } // namespace chromeos | 118 } // namespace chromeos |
OLD | NEW |