summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/drive/drive_app_registry_unittest.cc
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-06 05:54:17 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-06 05:54:17 +0000
commita9cf75c69b66886f121252fd28a2823839cbf5d9 (patch)
treef22bda1a4ba6dc00e91643805e59dc37cb00251a /chrome/browser/chromeos/drive/drive_app_registry_unittest.cc
parent483ae57f27312b95af5c1d2d5dd61d3b57758e41 (diff)
downloadchromium_src-a9cf75c69b66886f121252fd28a2823839cbf5d9.zip
chromium_src-a9cf75c69b66886f121252fd28a2823839cbf5d9.tar.gz
chromium_src-a9cf75c69b66886f121252fd28a2823839cbf5d9.tar.bz2
drive: Stop making multiple GetAppList() requests from DriveAppRegistry
Calling DriveAppRegistry::Update() results in being ignored when there is an ongoing one already. Add FakeDriveService::app_list_load_count() BUG=268707 TEST=unit_tests R=hidehiko@chromium.org, kinaba@chromium.org Review URL: https://codereview.chromium.org/22297004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/drive/drive_app_registry_unittest.cc')
-rw-r--r--chrome/browser/chromeos/drive/drive_app_registry_unittest.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/chrome/browser/chromeos/drive/drive_app_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_app_registry_unittest.cc
index 6228f42..eacfae6 100644
--- a/chrome/browser/chromeos/drive/drive_app_registry_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_app_registry_unittest.cc
@@ -30,8 +30,6 @@ class DriveAppRegistryTest : public testing::Test {
base::MessageLoopProxy::current().get()));
web_apps_registry_.reset(new DriveAppRegistry(scheduler_.get()));
- web_apps_registry_->Update();
- base::RunLoop().RunUntilIdle();
}
bool VerifyApp(const ScopedVector<DriveAppInfo>& list,
@@ -54,7 +52,7 @@ class DriveAppRegistryTest : public testing::Test {
}
}
EXPECT_TRUE(found) << "Unable to find app with web_store_id "
- << web_store_id;
+ << web_store_id;
return found;
}
@@ -66,6 +64,9 @@ class DriveAppRegistryTest : public testing::Test {
};
TEST_F(DriveAppRegistryTest, LoadAndFindDriveApps) {
+ web_apps_registry_->Update();
+ base::RunLoop().RunUntilIdle();
+
// Find by primary extension 'exe'.
ScopedVector<DriveAppInfo> ext_results;
base::FilePath ext_file(FILE_PATH_LITERAL("drive/file.exe"));
@@ -91,4 +92,17 @@ TEST_F(DriveAppRegistryTest, LoadAndFindDriveApps) {
"Drive app 1", "", false);
}
+TEST_F(DriveAppRegistryTest, MultipleUpdate) {
+ // Call Update().
+ web_apps_registry_->Update();
+
+ // Call Update() again.
+ // This call should be ignored because there is already an ongoing update.
+ web_apps_registry_->Update();
+
+ // The app list should be loaded only once.
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(1, fake_drive_service_->app_list_load_count());
+}
+
} // namespace drive