| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/stl_util.h" |
| 18 #include "base/task_runner_util.h" | 19 #include "base/task_runner_util.h" |
| 19 #include "base/values.h" | 20 #include "base/values.h" |
| 20 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 21 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 21 #include "chrome/browser/chromeos/arc/arc_util.h" | 22 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 22 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
| 23 #include "chrome/browser/extensions/extension_service_test_base.h" | 24 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 24 #include "chrome/browser/policy/profile_policy_connector.h" | 25 #include "chrome/browser/policy/profile_policy_connector.h" |
| 25 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 26 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 26 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h" | 27 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h" |
| 27 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" | 28 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const std::vector<arc::mojom::AppInfo> apps, | 272 const std::vector<arc::mojom::AppInfo> apps, |
| 272 const std::vector<arc::mojom::ShortcutInfo> shortcuts) { | 273 const std::vector<arc::mojom::ShortcutInfo> shortcuts) { |
| 273 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get()); | 274 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get()); |
| 274 ASSERT_NE(nullptr, prefs); | 275 ASSERT_NE(nullptr, prefs); |
| 275 const std::vector<std::string> ids = prefs->GetAppIds(); | 276 const std::vector<std::string> ids = prefs->GetAppIds(); |
| 276 ASSERT_EQ(apps.size() + shortcuts.size(), ids.size()); | 277 ASSERT_EQ(apps.size() + shortcuts.size(), ids.size()); |
| 277 ASSERT_EQ(apps.size() + shortcuts.size(), GetArcItemCount()); | 278 ASSERT_EQ(apps.size() + shortcuts.size(), GetArcItemCount()); |
| 278 // In principle, order of items is not defined. | 279 // In principle, order of items is not defined. |
| 279 for (const auto& app : apps) { | 280 for (const auto& app : apps) { |
| 280 const std::string id = ArcAppTest::GetAppId(app); | 281 const std::string id = ArcAppTest::GetAppId(app); |
| 281 EXPECT_NE(std::find(ids.begin(), ids.end(), id), ids.end()); | 282 EXPECT_TRUE(base::ContainsValue(ids, id)); |
| 282 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id); | 283 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id); |
| 283 ASSERT_NE(nullptr, app_info.get()); | 284 ASSERT_NE(nullptr, app_info.get()); |
| 284 EXPECT_EQ(app.name, app_info->name); | 285 EXPECT_EQ(app.name, app_info->name); |
| 285 EXPECT_EQ(app.package_name, app_info->package_name); | 286 EXPECT_EQ(app.package_name, app_info->package_name); |
| 286 EXPECT_EQ(app.activity, app_info->activity); | 287 EXPECT_EQ(app.activity, app_info->activity); |
| 287 | 288 |
| 288 const ArcAppItem* app_item = FindArcItem(id); | 289 const ArcAppItem* app_item = FindArcItem(id); |
| 289 ASSERT_NE(nullptr, app_item); | 290 ASSERT_NE(nullptr, app_item); |
| 290 EXPECT_EQ(app.name, app_item->GetDisplayName()); | 291 EXPECT_EQ(app.name, app_item->GetDisplayName()); |
| 291 } | 292 } |
| 292 | 293 |
| 293 for (auto& shortcut : shortcuts) { | 294 for (auto& shortcut : shortcuts) { |
| 294 const std::string id = ArcAppTest::GetAppId(shortcut); | 295 const std::string id = ArcAppTest::GetAppId(shortcut); |
| 295 EXPECT_NE(std::find(ids.begin(), ids.end(), id), ids.end()); | 296 EXPECT_TRUE(base::ContainsValue(ids, id)); |
| 296 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id); | 297 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id); |
| 297 ASSERT_NE(nullptr, app_info.get()); | 298 ASSERT_NE(nullptr, app_info.get()); |
| 298 EXPECT_EQ(shortcut.name, app_info->name); | 299 EXPECT_EQ(shortcut.name, app_info->name); |
| 299 EXPECT_EQ(shortcut.package_name, app_info->package_name); | 300 EXPECT_EQ(shortcut.package_name, app_info->package_name); |
| 300 EXPECT_EQ(shortcut.intent_uri, app_info->intent_uri); | 301 EXPECT_EQ(shortcut.intent_uri, app_info->intent_uri); |
| 301 | 302 |
| 302 const ArcAppItem* app_item = FindArcItem(id); | 303 const ArcAppItem* app_item = FindArcItem(id); |
| 303 ASSERT_NE(nullptr, app_item); | 304 ASSERT_NE(nullptr, app_item); |
| 304 EXPECT_EQ(shortcut.name, app_item->GetDisplayName()); | 305 EXPECT_EQ(shortcut.name, app_item->GetDisplayName()); |
| 305 } | 306 } |
| (...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 ::testing::ValuesIn(kUnmanagedArcStates)); | 1818 ::testing::ValuesIn(kUnmanagedArcStates)); |
| 1818 INSTANTIATE_TEST_CASE_P(, | 1819 INSTANTIATE_TEST_CASE_P(, |
| 1819 ArcDefaulAppForManagedUserTest, | 1820 ArcDefaulAppForManagedUserTest, |
| 1820 ::testing::ValuesIn(kManagedArcStates)); | 1821 ::testing::ValuesIn(kManagedArcStates)); |
| 1821 INSTANTIATE_TEST_CASE_P(, | 1822 INSTANTIATE_TEST_CASE_P(, |
| 1822 ArcPlayStoreAppTest, | 1823 ArcPlayStoreAppTest, |
| 1823 ::testing::ValuesIn(kUnmanagedArcStates)); | 1824 ::testing::ValuesIn(kUnmanagedArcStates)); |
| 1824 INSTANTIATE_TEST_CASE_P(, | 1825 INSTANTIATE_TEST_CASE_P(, |
| 1825 ArcAppModelBuilderRecreate, | 1826 ArcAppModelBuilderRecreate, |
| 1826 ::testing::ValuesIn(kUnmanagedArcStates)); | 1827 ::testing::ValuesIn(kUnmanagedArcStates)); |
| OLD | NEW |