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 <string> | 5 #include <string> |
6 | 6 |
7 #include "ui/app_list/folder_image.h" | 7 #include "ui/app_list/folder_image.h" |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(TestFolderImageObserver); | 50 DISALLOW_COPY_AND_ASSIGN(TestFolderImageObserver); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 class FolderImageTest : public testing::Test { | 55 class FolderImageTest : public testing::Test { |
56 public: | 56 public: |
57 FolderImageTest() : folder_image_(app_list_model_.top_level_item_list()) {} | 57 FolderImageTest() : folder_image_(app_list_model_.top_level_item_list()) {} |
58 | 58 |
59 ~FolderImageTest() {} | 59 ~FolderImageTest() override {} |
60 | 60 |
61 void SetUp() { | 61 void SetUp() override { |
62 // Populate the AppListModel with three items (to test that the FolderImage | 62 // Populate the AppListModel with three items (to test that the FolderImage |
63 // correctly supports having fewer than four icons). | 63 // correctly supports having fewer than four icons). |
64 AddAppWithColoredIcon("app1", SK_ColorRED); | 64 AddAppWithColoredIcon("app1", SK_ColorRED); |
65 AddAppWithColoredIcon("app2", SK_ColorGREEN); | 65 AddAppWithColoredIcon("app2", SK_ColorGREEN); |
66 AddAppWithColoredIcon("app3", SK_ColorBLUE); | 66 AddAppWithColoredIcon("app3", SK_ColorBLUE); |
67 | 67 |
68 observer_.Reset(); | 68 observer_.Reset(); |
69 folder_image_.AddObserver(&observer_); | 69 folder_image_.AddObserver(&observer_); |
70 } | 70 } |
71 | 71 |
72 void TearDown() { folder_image_.RemoveObserver(&observer_); } | 72 void TearDown() override { folder_image_.RemoveObserver(&observer_); } |
73 | 73 |
74 protected: | 74 protected: |
75 void AddAppWithColoredIcon(const std::string& id, SkColor icon_color) { | 75 void AddAppWithColoredIcon(const std::string& id, SkColor icon_color) { |
76 scoped_ptr<AppListItem> item(new AppListItem(id)); | 76 scoped_ptr<AppListItem> item(new AppListItem(id)); |
77 item->SetIcon(CreateSquareBitmapWithColor(kListIconSize, icon_color), | 77 item->SetIcon(CreateSquareBitmapWithColor(kListIconSize, icon_color), |
78 false); | 78 false); |
79 app_list_model_.AddItem(item.Pass()); | 79 app_list_model_.AddItem(item.Pass()); |
80 } | 80 } |
81 | 81 |
82 AppListModel app_list_model_; | 82 AppListModel app_list_model_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 // Change an item's icon. Ensure that the observer fired and the icon changed. | 140 // Change an item's icon. Ensure that the observer fired and the icon changed. |
141 app_list_model_.FindItem("app2")->SetIcon( | 141 app_list_model_.FindItem("app2")->SetIcon( |
142 CreateSquareBitmapWithColor(kListIconSize, SK_ColorMAGENTA), false); | 142 CreateSquareBitmapWithColor(kListIconSize, SK_ColorMAGENTA), false); |
143 EXPECT_TRUE(observer_.updated()); | 143 EXPECT_TRUE(observer_.updated()); |
144 observer_.Reset(); | 144 observer_.Reset(); |
145 EXPECT_FALSE(ImagesAreEqual(icon1, folder_image_.icon())); | 145 EXPECT_FALSE(ImagesAreEqual(icon1, folder_image_.icon())); |
146 } | 146 } |
147 | 147 |
148 } // namespace app_list | 148 } // namespace app_list |
OLD | NEW |