OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 ArcAppIcon::DisableSafeDecodingForTesting(); | 111 ArcAppIcon::DisableSafeDecodingForTesting(); |
112 } | 112 } |
113 | 113 |
114 void TearDown() override { | 114 void TearDown() override { |
115 arc_test_.TearDown(); | 115 arc_test_.TearDown(); |
116 ResetBuilder(); | 116 ResetBuilder(); |
117 } | 117 } |
118 | 118 |
119 protected: | 119 protected: |
120 // Notifies that initial preparation is done, profile is ready and it is time | 120 // Notifies that initial preparation is done, profile is ready and it is time |
121 // to initialize Arc subsystem. | 121 // to initialize ARC subsystem. |
122 virtual void OnBeforeArcTestSetup() {} | 122 virtual void OnBeforeArcTestSetup() {} |
123 | 123 |
124 // Creates a new builder, destroying any existing one. | 124 // Creates a new builder, destroying any existing one. |
125 void CreateBuilder() { | 125 void CreateBuilder() { |
126 ResetBuilder(); // Destroy any existing builder in the correct order. | 126 ResetBuilder(); // Destroy any existing builder in the correct order. |
127 | 127 |
128 model_.reset(new app_list::AppListModel); | 128 model_.reset(new app_list::AppListModel); |
129 controller_.reset(new test::TestAppListControllerDelegate); | 129 controller_.reset(new test::TestAppListControllerDelegate); |
130 builder_.reset(new ArcAppModelBuilder(controller_.get())); | 130 builder_.reset(new ArcAppModelBuilder(controller_.get())); |
131 builder_->InitializeWithProfile(profile_.get(), model_.get()); | 131 builder_->InitializeWithProfile(profile_.get(), model_.get()); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 std::find(ids.begin(), ids.end(), id); | 295 std::find(ids.begin(), ids.end(), id); |
296 ASSERT_NE(it_id, ids.end()); | 296 ASSERT_NE(it_id, ids.end()); |
297 ids.erase(it_id); | 297 ids.erase(it_id); |
298 | 298 |
299 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id); | 299 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id); |
300 ASSERT_NE(nullptr, app_info.get()); | 300 ASSERT_NE(nullptr, app_info.get()); |
301 EXPECT_EQ(ready, app_info->ready); | 301 EXPECT_EQ(ready, app_info->ready); |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 // Validates that provided image is acceptable as Arc app icon. | 305 // Validates that provided image is acceptable as ARC app icon. |
306 void ValidateIcon(const gfx::ImageSkia& image) { | 306 void ValidateIcon(const gfx::ImageSkia& image) { |
307 EXPECT_EQ(app_list::kGridIconDimension, image.width()); | 307 EXPECT_EQ(app_list::kGridIconDimension, image.width()); |
308 EXPECT_EQ(app_list::kGridIconDimension, image.height()); | 308 EXPECT_EQ(app_list::kGridIconDimension, image.height()); |
309 | 309 |
310 const std::vector<ui::ScaleFactor>& scale_factors = | 310 const std::vector<ui::ScaleFactor>& scale_factors = |
311 ui::GetSupportedScaleFactors(); | 311 ui::GetSupportedScaleFactors(); |
312 for (auto& scale_factor : scale_factors) { | 312 for (auto& scale_factor : scale_factors) { |
313 const float scale = ui::GetScaleForScaleFactor(scale_factor); | 313 const float scale = ui::GetScaleForScaleFactor(scale_factor); |
314 EXPECT_TRUE(image.HasRepresentation(scale)); | 314 EXPECT_TRUE(image.HasRepresentation(scale)); |
315 const gfx::ImageSkiaRep& representation = image.GetRepresentation(scale); | 315 const gfx::ImageSkiaRep& representation = image.GetRepresentation(scale); |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get()); | 1359 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get()); |
1360 ASSERT_TRUE(prefs); | 1360 ASSERT_TRUE(prefs); |
1361 | 1361 |
1362 // There is no default app for managed users except Play Store | 1362 // There is no default app for managed users except Play Store |
1363 for (const auto& app : fake_default_apps()) { | 1363 for (const auto& app : fake_default_apps()) { |
1364 const std::string app_id = ArcAppTest::GetAppId(app); | 1364 const std::string app_id = ArcAppTest::GetAppId(app); |
1365 EXPECT_FALSE(prefs->IsRegistered(app_id)); | 1365 EXPECT_FALSE(prefs->IsRegistered(app_id)); |
1366 EXPECT_FALSE(prefs->GetApp(app_id)); | 1366 EXPECT_FALSE(prefs->GetApp(app_id)); |
1367 } | 1367 } |
1368 } | 1368 } |
OLD | NEW |