Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_unittest.cc

Issue 2106663004: arc: Initial implemetation of Chrome sync for Arc packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify target Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..4ef89ee76a81f71aff1b3388b7fc5c747262b2ac 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,8 @@ 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 +326,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 +341,6 @@ class ArcAppModelBuilderTest : public AppListTestBase {
TEST_F(ArcAppModelBuilderTest, ArcPackagePref) {
ValidateHavePackages(std::vector<arc::mojom::ArcPackageInfo>());
- bridge_service()->SetReady();
app_instance()->SendRefreshPackageList(fake_packages());
ValidateHavePackages(fake_packages());
@@ -367,14 +364,12 @@ 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();
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();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(fake_apps());
ValidateHaveApps(fake_apps());
@@ -382,7 +377,6 @@ TEST_F(ArcAppModelBuilderTest, RefreshAllFillsContent) {
TEST_F(ArcAppModelBuilderTest, InstallShortcut) {
ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
- bridge_service()->SetReady();
app_instance()->SendInstallShortcuts(fake_shortcuts());
ValidateHaveShortcuts(fake_shortcuts());
@@ -390,7 +384,6 @@ TEST_F(ArcAppModelBuilderTest, InstallShortcut) {
TEST_F(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(fake_apps());
ValidateHaveApps(fake_apps());
@@ -405,7 +398,6 @@ TEST_F(ArcAppModelBuilderTest, RefreshAllPreservesShortcut) {
TEST_F(ArcAppModelBuilderTest, MultipleRefreshAll) {
ValidateHaveApps(std::vector<arc::mojom::AppInfo>());
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
// Send info about all fake apps except last.
std::vector<arc::mojom::AppInfo> apps1(fake_apps().begin(),
@@ -440,7 +432,6 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveApps) {
ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
ASSERT_NE(nullptr, prefs);
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
EXPECT_EQ(0u, GetArcItemCount());
EXPECT_EQ(0u, prefs->GetAppIds().size());
@@ -451,14 +442,11 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveApps) {
ValidateAppReadyState(fake_apps(), true);
// Stopping service does not delete items. It makes them non-ready.
- bridge_service()->SetStopped();
+ arc_test()->StopArcInstance();
// 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();
// Ids should be the same.
EXPECT_EQ(ids, prefs->GetAppIds());
ValidateAppReadyState(fake_apps(), false);
@@ -473,7 +461,6 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveShortcuts) {
ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
ASSERT_NE(nullptr, prefs);
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
EXPECT_EQ(0u, GetArcItemCount());
EXPECT_EQ(0u, prefs->GetAppIds().size());
@@ -484,14 +471,11 @@ TEST_F(ArcAppModelBuilderTest, StopStartServicePreserveShortcuts) {
ValidateShortcutReadyState(fake_shortcuts(), true);
// Stopping service does not delete items. It makes them non-ready.
- bridge_service()->SetStopped();
+ arc_test()->StopArcInstance();
// 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();
// Ids should be the same.
EXPECT_EQ(ids, prefs->GetAppIds());
ValidateShortcutReadyState(fake_shortcuts(), false);
@@ -508,14 +492,13 @@ TEST_F(ArcAppModelBuilderTest, RestartPreserveApps) {
ASSERT_NE(nullptr, prefs);
// Start from scratch and fill with apps.
- bridge_service()->SetReady();
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()->StopArcInstance();
CreateBuilder();
ValidateAppReadyState(fake_apps(), false);
}
@@ -525,14 +508,13 @@ TEST_F(ArcAppModelBuilderTest, RestartPreserveShortcuts) {
ASSERT_NE(nullptr, prefs);
// Start from scratch and install shortcuts.
- bridge_service()->SetReady();
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()->StopArcInstance();
CreateBuilder();
ValidateShortcutReadyState(fake_shortcuts(), false);
}
@@ -541,7 +523,6 @@ TEST_F(ArcAppModelBuilderTest, LaunchApps) {
// Disable attempts to dismiss app launcher view.
ChromeAppListItem::OverrideAppListControllerDelegateForTesting(controller());
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(fake_apps());
@@ -564,7 +545,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()->StopArcInstance();
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 +559,6 @@ TEST_F(ArcAppModelBuilderTest, LaunchShortcuts) {
// Disable attempts to dismiss app launcher view.
ChromeAppListItem::OverrideAppListControllerDelegateForTesting(controller());
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendInstallShortcuts(fake_shortcuts());
@@ -601,7 +581,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()->StopArcInstance();
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 +595,6 @@ TEST_F(ArcAppModelBuilderTest, RequestIcons) {
// Make sure we are on UI thread.
ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(fake_apps());
@@ -670,7 +649,6 @@ TEST_F(ArcAppModelBuilderTest, RequestShortcutIcons) {
// Make sure we are on UI thread.
ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- bridge_service()->SetReady();
const arc::mojom::ShortcutInfo& shortcut = fake_shortcuts()[0];
app_instance()->SendInstallShortcut(shortcut);
@@ -727,7 +705,6 @@ TEST_F(ArcAppModelBuilderTest, InstallIcon) {
// Make sure we are on UI thread.
ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
fake_apps().begin(), fake_apps().begin() + 1));
@@ -767,7 +744,6 @@ TEST_F(ArcAppModelBuilderTest, RemoveAppCleanUpFolder) {
// Make sure we are on UI thread.
ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
fake_apps().begin(), fake_apps().begin() + 1));
@@ -810,7 +786,6 @@ TEST_F(ArcAppModelBuilderTest, LastLaunchTime) {
// Make sure we are on UI thread.
ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
fake_apps().begin(), fake_apps().begin() + 2));
@@ -858,7 +833,6 @@ TEST_F(ArcAppModelBuilderTest, DISABLED_IconLoader) {
ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_.get());
ASSERT_NE(nullptr, prefs);
- bridge_service()->SetReady();
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
fake_apps().begin(), fake_apps().begin() + 1));
@@ -912,8 +886,6 @@ TEST_F(ArcAppModelBuilderTest, AppLauncher) {
EXPECT_FALSE(launcher1.app_launched());
EXPECT_TRUE(prefs->HasObserver(&launcher1));
- bridge_service()->SetReady();
-
ArcAppLauncher launcher3(profile(), id3, true);
EXPECT_FALSE(launcher1.app_launched());
EXPECT_TRUE(prefs->HasObserver(&launcher1));
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_test.cc ('k') | chrome/browser/ui/app_list/arc/arc_package_syncable_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698