| Index: chrome/browser/ui/app_list/arc/arc_app_unittest.cc
|
| diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
|
| index 2df2baa61e072e9f1899223fb0f3d9a3af8c3fe6..4602f00a8199add590594eccc5cba508afb27e67 100644
|
| --- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
|
| +++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
|
| @@ -93,7 +93,8 @@ void WaitForIconReady(ArcAppListPrefs* prefs,
|
|
|
| } // namespace
|
|
|
| -class ArcAppModelBuilderTest : public AppListTestBase {
|
| +class ArcAppModelBuilderTest : public AppListTestBase,
|
| + public ::testing::WithParamInterface<bool> {
|
| public:
|
| ArcAppModelBuilderTest() = default;
|
| ~ArcAppModelBuilderTest() override {
|
| @@ -102,6 +103,7 @@ class ArcAppModelBuilderTest : public AppListTestBase {
|
| }
|
|
|
| void SetUp() override {
|
| + ArcAppTest::Init(/* is_persistent_arc */ GetParam());
|
| AppListTestBase::SetUp();
|
| OnBeforeArcTestSetup();
|
| arc_test_.SetUp(profile_.get());
|
| @@ -335,6 +337,10 @@ class ArcAppModelBuilderTest : public AppListTestBase {
|
|
|
| ArcAppTest* arc_test() { return &arc_test_; }
|
|
|
| + bool IsPersistentArc() {
|
| + return arc_test()->arc_session_manager()->IsPersistentArc();
|
| + }
|
| +
|
| const std::vector<arc::mojom::AppInfo>& fake_apps() const {
|
| return arc_test_.fake_apps();
|
| }
|
| @@ -452,7 +458,7 @@ class ArcAppModelBuilderRecreate : public ArcAppModelBuilderTest {
|
| DISALLOW_COPY_AND_ASSIGN(ArcAppModelBuilderRecreate);
|
| };
|
|
|
| -TEST_F(ArcAppModelBuilderTest, ArcPackagePref) {
|
| +TEST_P(ArcAppModelBuilderTest, ArcPackagePref) {
|
| ValidateHavePackages(std::vector<arc::mojom::ArcPackageInfo>());
|
| app_instance()->SendRefreshPackageList(fake_packages());
|
| ValidateHavePackages(fake_packages());
|
| @@ -473,7 +479,7 @@ TEST_F(ArcAppModelBuilderTest, ArcPackagePref) {
|
| ValidateHavePackages(fake_packages());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RefreshAllOnReady) {
|
| +TEST_P(ArcAppModelBuilderTest, RefreshAllOnReady) {
|
| // There should already have been one call, when the interface was
|
| // registered.
|
| EXPECT_EQ(1, app_instance()->refresh_app_list_count());
|
| @@ -481,21 +487,21 @@ TEST_F(ArcAppModelBuilderTest, RefreshAllOnReady) {
|
| EXPECT_EQ(2, app_instance()->refresh_app_list_count());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RefreshAllFillsContent) {
|
| +TEST_P(ArcAppModelBuilderTest, RefreshAllFillsContent) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(fake_apps());
|
| ValidateHaveApps(fake_apps());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, InstallShortcut) {
|
| +TEST_P(ArcAppModelBuilderTest, InstallShortcut) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
|
|
| app_instance()->SendInstallShortcuts(fake_shortcuts());
|
| ValidateHaveShortcuts(fake_shortcuts());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
|
| +TEST_P(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(fake_apps());
|
| @@ -509,7 +515,7 @@ TEST_F(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
|
| ValidateHaveAppsAndShortcuts(fake_apps(), fake_shortcuts());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, MultipleRefreshAll) {
|
| +TEST_P(ArcAppModelBuilderTest, MultipleRefreshAll) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
| app_instance()->RefreshAppList();
|
| // Send info about all fake apps except last.
|
| @@ -541,7 +547,7 @@ TEST_F(ArcAppModelBuilderTest, MultipleRefreshAll) {
|
| ValidateHaveApps(no_apps);
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveApps) {
|
| +TEST_P(ArcAppModelBuilderTest, StopStartServicePreserveApps) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -570,7 +576,7 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveApps) {
|
| ValidateAppReadyState(fake_apps(), true);
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveShortcuts) {
|
| +TEST_P(ArcAppModelBuilderTest, StopStartServicePreserveShortcuts) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -600,7 +606,7 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveShortcuts) {
|
| ValidateShortcutReadyState(fake_shortcuts(), true);
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RestartPreserveApps) {
|
| +TEST_P(ArcAppModelBuilderTest, RestartPreserveApps) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -616,7 +622,7 @@ TEST_F(ArcAppModelBuilderTest, RestartPreserveApps) {
|
| ValidateAppReadyState(fake_apps(), false);
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RestartPreserveShortcuts) {
|
| +TEST_P(ArcAppModelBuilderTest, RestartPreserveShortcuts) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -632,7 +638,7 @@ TEST_F(ArcAppModelBuilderTest, RestartPreserveShortcuts) {
|
| ValidateShortcutReadyState(fake_shortcuts(), false);
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, LaunchApps) {
|
| +TEST_P(ArcAppModelBuilderTest, LaunchApps) {
|
| // Disable attempts to dismiss app launcher view.
|
| ChromeAppListItem::OverrideAppListControllerDelegateForTesting(controller());
|
|
|
| @@ -668,7 +674,7 @@ TEST_F(ArcAppModelBuilderTest, LaunchApps) {
|
| app_instance()->launch_requests().size());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, LaunchShortcuts) {
|
| +TEST_P(ArcAppModelBuilderTest, LaunchShortcuts) {
|
| // Disable attempts to dismiss app launcher view.
|
| ChromeAppListItem::OverrideAppListControllerDelegateForTesting(controller());
|
|
|
| @@ -704,7 +710,7 @@ TEST_F(ArcAppModelBuilderTest, LaunchShortcuts) {
|
| app_instance()->launch_intents().size());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RequestIcons) {
|
| +TEST_P(ArcAppModelBuilderTest, RequestIcons) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| @@ -759,7 +765,7 @@ TEST_F(ArcAppModelBuilderTest, RequestIcons) {
|
| }
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RequestShortcutIcons) {
|
| +TEST_P(ArcAppModelBuilderTest, RequestShortcutIcons) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| @@ -812,7 +818,7 @@ TEST_F(ArcAppModelBuilderTest, RequestShortcutIcons) {
|
| }
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, InstallIcon) {
|
| +TEST_P(ArcAppModelBuilderTest, InstallIcon) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| @@ -851,7 +857,7 @@ TEST_F(ArcAppModelBuilderTest, InstallIcon) {
|
| ASSERT_EQ(icon_data, png_data);
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, RemoveAppCleanUpFolder) {
|
| +TEST_P(ArcAppModelBuilderTest, RemoveAppCleanUpFolder) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| @@ -893,7 +899,7 @@ TEST_F(ArcAppModelBuilderTest, RemoveAppCleanUpFolder) {
|
| EXPECT_FALSE(base::PathExists(app_path));
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, LastLaunchTime) {
|
| +TEST_P(ArcAppModelBuilderTest, LastLaunchTime) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| @@ -937,7 +943,7 @@ TEST_F(ArcAppModelBuilderTest, LastLaunchTime) {
|
| }
|
|
|
| // Validate that arc model contains expected elements on restart.
|
| -TEST_F(ArcAppModelBuilderRecreate, AppModelRestart) {
|
| +TEST_P(ArcAppModelBuilderRecreate, AppModelRestart) {
|
| // No apps on initial start.
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
|
|
| @@ -970,7 +976,7 @@ TEST_F(ArcAppModelBuilderRecreate, AppModelRestart) {
|
| EXPECT_EQ(fake_apps().size(), GetArcItemCount());
|
| }
|
|
|
| -TEST_F(ArcPlayStoreAppTest, PlayStore) {
|
| +TEST_P(ArcPlayStoreAppTest, PlayStore) {
|
| // Make sure PlayStore is available.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| @@ -997,6 +1003,10 @@ TEST_F(ArcPlayStoreAppTest, PlayStore) {
|
| ASSERT_TRUE(app_info);
|
| EXPECT_TRUE(app_info->ready);
|
|
|
| + // TODO(victorhsieh): Opt-out on Persistent ARC is special. Skip until
|
| + // implemented.
|
| + if (IsPersistentArc())
|
| + return;
|
| arc_test()->arc_session_manager()->SetArcPlayStoreEnabled(false);
|
|
|
| app_info = prefs->GetApp(arc::kPlayStoreAppId);
|
| @@ -1008,7 +1018,7 @@ TEST_F(ArcPlayStoreAppTest, PlayStore) {
|
| }
|
|
|
| // Test that icon is correctly extracted for shelf group.
|
| -TEST_F(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
|
| +TEST_P(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
|
| const arc::mojom::AppInfo& app = fake_apps()[0];
|
| const std::string app_id = ArcAppTest::GetAppId(app);
|
|
|
| @@ -1075,7 +1085,7 @@ TEST_F(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
|
| }
|
|
|
| // TODO(crbug.com/628425) -- reenable once this test is less flaky.
|
| -TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) {
|
| +TEST_P(ArcAppModelBuilderTest, DISABLED_IconLoader) {
|
| const arc::mojom::AppInfo& app = fake_apps()[0];
|
| const std::string app_id = ArcAppTest::GetAppId(app);
|
|
|
| @@ -1117,7 +1127,7 @@ TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) {
|
| ValidateIcon(delegate.image());
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, AppLauncher) {
|
| +TEST_P(ArcAppModelBuilderTest, AppLauncher) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -1162,7 +1172,7 @@ TEST_F(ArcAppModelBuilderTest, AppLauncher) {
|
| }
|
|
|
| // Validates an app that have no launchable flag.
|
| -TEST_F(ArcAppModelBuilderTest, NonLaunchableApp) {
|
| +TEST_P(ArcAppModelBuilderTest, NonLaunchableApp) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -1184,7 +1194,7 @@ TEST_F(ArcAppModelBuilderTest, NonLaunchableApp) {
|
| EXPECT_TRUE(prefs->IsRegistered(app_id));
|
| }
|
|
|
| -TEST_F(ArcAppModelBuilderTest, ArcAppsOnPackageUpdated) {
|
| +TEST_P(ArcAppModelBuilderTest, ArcAppsOnPackageUpdated) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -1217,7 +1227,7 @@ TEST_F(ArcAppModelBuilderTest, ArcAppsOnPackageUpdated) {
|
| EXPECT_EQ(now_time, app_info_after->last_launch_time);
|
| }
|
|
|
| -TEST_F(ArcDefaulAppTest, DefaultApps) {
|
| +TEST_P(ArcDefaulAppTest, DefaultApps) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -1263,6 +1273,10 @@ TEST_F(ArcDefaulAppTest, DefaultApps) {
|
| ValidateHaveApps(all_apps);
|
|
|
| // OptOut and default apps should exist minus first.
|
| + // TODO(victorhsieh): Opt-out on Persistent ARC is special. Skip until
|
| + // implemented.
|
| + if (IsPersistentArc())
|
| + return;
|
| arc_test()->arc_session_manager()->SetArcPlayStoreEnabled(false);
|
| all_apps = fake_default_apps();
|
| all_apps.erase(all_apps.begin());
|
| @@ -1279,7 +1293,6 @@ TEST_F(ArcDefaulAppTest, DefaultApps) {
|
| // Prefs are changed.
|
| prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
| -
|
| ValidateHaveApps(all_apps);
|
|
|
| // Install deleted default app again.
|
| @@ -1296,7 +1309,7 @@ TEST_F(ArcDefaulAppTest, DefaultApps) {
|
| }
|
| }
|
|
|
| -TEST_F(ArcDefaulAppTest, DefaultAppsNotAvailable) {
|
| +TEST_P(ArcDefaulAppTest, DefaultAppsNotAvailable) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -1315,7 +1328,7 @@ TEST_F(ArcDefaulAppTest, DefaultAppsNotAvailable) {
|
| ValidateHaveApps(empty_app_list);
|
| }
|
|
|
| -TEST_F(ArcDefaulAppTest, DefaultAppsInstallation) {
|
| +TEST_P(ArcDefaulAppTest, DefaultAppsInstallation) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| @@ -1355,7 +1368,7 @@ TEST_F(ArcDefaulAppTest, DefaultAppsInstallation) {
|
| ValidateHaveApps(available_apps);
|
| }
|
|
|
| -TEST_F(ArcDefaulAppForManagedUserTest, DefaultAppsForManagedUser) {
|
| +TEST_P(ArcDefaulAppForManagedUserTest, DefaultAppsForManagedUser) {
|
| const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_TRUE(prefs);
|
|
|
| @@ -1366,3 +1379,15 @@ TEST_F(ArcDefaulAppForManagedUserTest, DefaultAppsForManagedUser) {
|
| EXPECT_FALSE(prefs->GetApp(app_id));
|
| }
|
| }
|
| +
|
| +INSTANTIATE_TEST_CASE_P(,
|
| + ArcAppModelBuilderTest,
|
| + ::testing::Values(false, true));
|
| +INSTANTIATE_TEST_CASE_P(, ArcDefaulAppTest, ::testing::Values(false, true));
|
| +INSTANTIATE_TEST_CASE_P(,
|
| + ArcDefaulAppForManagedUserTest,
|
| + ::testing::Values(false, true));
|
| +INSTANTIATE_TEST_CASE_P(, ArcPlayStoreAppTest, ::testing::Values(false, true));
|
| +INSTANTIATE_TEST_CASE_P(,
|
| + ArcAppModelBuilderRecreate,
|
| + ::testing::Values(false, true));
|
|
|