| 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 17178f19f79779cfb1e757a95447e9db6ce6b59f..34d821002636f9b9c2c225d0428085adf020bafa 100644
|
| --- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
|
| +++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
|
| @@ -312,6 +312,10 @@ class ArcAppModelBuilderTest : public AppListTestBase {
|
|
|
| Profile* profile() { return profile_.get(); }
|
|
|
| + ArcAppTest* arc_test() {
|
| + return &arc_test_;
|
| + }
|
| +
|
| const std::vector<arc::mojom::AppInfo>& fake_apps() const {
|
| return arc_test_.fake_apps();
|
| }
|
| @@ -324,10 +328,6 @@ class ArcAppModelBuilderTest : public AppListTestBase {
|
| return arc_test_.fake_shortcuts();
|
| }
|
|
|
| - arc::FakeArcBridgeService* bridge_service() {
|
| - return arc_test_.bridge_service();
|
| - }
|
| -
|
| arc::FakeAppInstance* app_instance() {
|
| return arc_test_.app_instance();
|
| }
|
| @@ -343,7 +343,7 @@ class ArcAppModelBuilderTest : public AppListTestBase {
|
|
|
| TEST_F(ArcAppModelBuilderTest, ArcPackagePref) {
|
| ValidateHavePackages(std::vector<arc::mojom::ArcPackageInfo>());
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->SendRefreshPackageList(fake_packages());
|
| ValidateHavePackages(fake_packages());
|
|
|
| @@ -367,14 +367,14 @@ TEST_F(ArcAppModelBuilderTest, RefreshAllOnReady) {
|
| // There should already have been one call, when the interface was
|
| // registered.
|
| EXPECT_EQ(1, app_instance()->refresh_app_list_count());
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| EXPECT_EQ(2, app_instance()->refresh_app_list_count());
|
| }
|
|
|
| TEST_F(ArcAppModelBuilderTest, RefreshAllFillsContent) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(fake_apps());
|
| ValidateHaveApps(fake_apps());
|
| @@ -382,7 +382,7 @@ TEST_F(ArcAppModelBuilderTest, RefreshAllFillsContent) {
|
|
|
| TEST_F(ArcAppModelBuilderTest, InstallShortcut) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
|
|
| app_instance()->SendInstallShortcuts(fake_shortcuts());
|
| ValidateHaveShortcuts(fake_shortcuts());
|
| @@ -390,7 +390,7 @@ TEST_F(ArcAppModelBuilderTest, InstallShortcut) {
|
|
|
| TEST_F(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(fake_apps());
|
| ValidateHaveApps(fake_apps());
|
| @@ -405,7 +405,7 @@ TEST_F(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
|
|
|
| TEST_F(ArcAppModelBuilderTest, MultipleRefreshAll) {
|
| ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| // Send info about all fake apps except last.
|
| std::vector<arc::mojom::AppInfo> apps1(fake_apps().begin(),
|
| @@ -440,7 +440,7 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveApps) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| EXPECT_EQ(0u, GetArcItemCount());
|
| EXPECT_EQ(0u, prefs->GetAppIds().size());
|
| @@ -451,14 +451,14 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveApps) {
|
| ValidateAppReadyState(fake_apps(), true);
|
|
|
| // Stopping service does not delete items. It makes them non-ready.
|
| - bridge_service()->SetStopped();
|
| + arc_test()->SetBridgeServiceStopped();
|
| // Ids should be the same.
|
| EXPECT_EQ(ids, prefs->GetAppIds());
|
| ValidateAppReadyState(fake_apps(), false);
|
|
|
| // Setting service ready does not change anything because RefreshAppList is
|
| // not called.
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| // Ids should be the same.
|
| EXPECT_EQ(ids, prefs->GetAppIds());
|
| ValidateAppReadyState(fake_apps(), false);
|
| @@ -473,7 +473,7 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveShortcuts) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| EXPECT_EQ(0u, GetArcItemCount());
|
| EXPECT_EQ(0u, prefs->GetAppIds().size());
|
| @@ -484,14 +484,14 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveShortcuts) {
|
| ValidateShortcutReadyState(fake_shortcuts(), true);
|
|
|
| // Stopping service does not delete items. It makes them non-ready.
|
| - bridge_service()->SetStopped();
|
| + arc_test()->SetBridgeServiceStopped();
|
| // Ids should be the same.
|
| EXPECT_EQ(ids, prefs->GetAppIds());
|
| ValidateShortcutReadyState(fake_shortcuts(), false);
|
|
|
| // Setting service ready does not change anything because RefreshAppList is
|
| // not called.
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| // Ids should be the same.
|
| EXPECT_EQ(ids, prefs->GetAppIds());
|
| ValidateShortcutReadyState(fake_shortcuts(), false);
|
| @@ -508,14 +508,14 @@ TEST_F(ArcAppModelBuilderTest, RestartPreserveApps) {
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| // Start from scratch and fill with apps.
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->SendRefreshAppList(fake_apps());
|
| std::vector<std::string> ids = prefs->GetAppIds();
|
| EXPECT_EQ(fake_apps().size(), ids.size());
|
| ValidateAppReadyState(fake_apps(), true);
|
|
|
| // This recreates model and ARC apps will be read from prefs.
|
| - bridge_service()->SetStopped();
|
| + arc_test()->SetBridgeServiceStopped();
|
| CreateBuilder();
|
| ValidateAppReadyState(fake_apps(), false);
|
| }
|
| @@ -525,14 +525,14 @@ TEST_F(ArcAppModelBuilderTest, RestartPreserveShortcuts) {
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| // Start from scratch and install shortcuts.
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->SendInstallShortcuts(fake_shortcuts());
|
| std::vector<std::string> ids = prefs->GetAppIds();
|
| EXPECT_EQ(fake_apps().size(), ids.size());
|
| ValidateShortcutReadyState(fake_shortcuts(), true);
|
|
|
| // This recreates model and ARC apps and shortcuts will be read from prefs.
|
| - bridge_service()->SetStopped();
|
| + arc_test()->SetBridgeServiceStopped();
|
| CreateBuilder();
|
| ValidateShortcutReadyState(fake_shortcuts(), false);
|
| }
|
| @@ -541,7 +541,7 @@ TEST_F(ArcAppModelBuilderTest, LaunchApps) {
|
| // Disable attempts to dismiss app launcher view.
|
| ChromeAppListItem::OverrideAppListControllerDelegateForTesting(controller());
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(fake_apps());
|
|
|
| @@ -564,7 +564,7 @@ TEST_F(ArcAppModelBuilderTest, LaunchApps) {
|
| EXPECT_TRUE(launch_requests[2]->IsForApp(app_first));
|
|
|
| // Test an attempt to launch of a not-ready app.
|
| - bridge_service()->SetStopped();
|
| + arc_test()->SetBridgeServiceStopped();
|
| item_first = FindArcItem(ArcAppTest::GetAppId(app_first));
|
| ASSERT_NE(nullptr, item_first);
|
| size_t launch_request_count_before = app_instance()->launch_requests().size();
|
| @@ -578,7 +578,7 @@ TEST_F(ArcAppModelBuilderTest, LaunchShortcuts) {
|
| // Disable attempts to dismiss app launcher view.
|
| ChromeAppListItem::OverrideAppListControllerDelegateForTesting(controller());
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendInstallShortcuts(fake_shortcuts());
|
|
|
| @@ -601,7 +601,7 @@ TEST_F(ArcAppModelBuilderTest, LaunchShortcuts) {
|
| EXPECT_EQ(app_first.intent_uri, *launch_intents[2]);
|
|
|
| // Test an attempt to launch of a not-ready shortcut.
|
| - bridge_service()->SetStopped();
|
| + arc_test()->SetBridgeServiceStopped();
|
| item_first = FindArcItem(ArcAppTest::GetAppId(app_first));
|
| ASSERT_NE(nullptr, item_first);
|
| size_t launch_request_count_before = app_instance()->launch_intents().size();
|
| @@ -615,7 +615,7 @@ TEST_F(ArcAppModelBuilderTest, RequestIcons) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(fake_apps());
|
|
|
| @@ -670,7 +670,7 @@ TEST_F(ArcAppModelBuilderTest, RequestShortcutIcons) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| const arc::mojom::ShortcutInfo& shortcut = fake_shortcuts()[0];
|
| app_instance()->SendInstallShortcut(shortcut);
|
|
|
| @@ -727,7 +727,7 @@ TEST_F(ArcAppModelBuilderTest, InstallIcon) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
|
| fake_apps().begin(), fake_apps().begin() + 1));
|
| @@ -767,7 +767,7 @@ TEST_F(ArcAppModelBuilderTest, RemoveAppCleanUpFolder) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
|
| fake_apps().begin(), fake_apps().begin() + 1));
|
| @@ -810,7 +810,7 @@ TEST_F(ArcAppModelBuilderTest, LastLaunchTime) {
|
| // Make sure we are on UI thread.
|
| ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
|
| fake_apps().begin(), fake_apps().begin() + 2));
|
| @@ -858,7 +858,7 @@ TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
|
| ASSERT_NE(nullptr, prefs);
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
| app_instance()->RefreshAppList();
|
| app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
|
| fake_apps().begin(), fake_apps().begin() + 1));
|
| @@ -912,7 +912,7 @@ TEST_F(ArcAppModelBuilderTest, AppLauncher) {
|
| EXPECT_FALSE(launcher1.app_launched());
|
| EXPECT_TRUE(prefs->HasObserver(&launcher1));
|
|
|
| - bridge_service()->SetReady();
|
| + arc_test()->SetBridgeServiceReady();
|
|
|
| ArcAppLauncher launcher3(profile(), id3, true);
|
| EXPECT_FALSE(launcher1.app_launched());
|
|
|