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

Unified Diff: chrome/browser/chromeos/drive/drive_app_registry_unittest.cc

Issue 22297004: drive: Stop making multiple GetAppList() requests from DriveAppRegistry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simplify Created 7 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
« no previous file with comments | « chrome/browser/chromeos/drive/drive_app_registry.cc ('k') | chrome/browser/drive/fake_drive_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/drive_app_registry_unittest.cc
diff --git a/chrome/browser/chromeos/drive/drive_app_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_app_registry_unittest.cc
index 6228f425900929b429873627723c4d0175283bca..eacfae625b7da832653edfd74e289c0b5a833deb 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
« no previous file with comments | « chrome/browser/chromeos/drive/drive_app_registry.cc ('k') | chrome/browser/drive/fake_drive_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698