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

Unified Diff: chrome/browser/sync_file_system/drive_backend/task_dependency_manager_unittest.cc

Issue 212203003: [SyncFS] Add exclusive task support for TaskDependencyManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/sync_file_system/drive_backend/task_dependency_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_backend/task_dependency_manager_unittest.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/task_dependency_manager_unittest.cc b/chrome/browser/sync_file_system/drive_backend/task_dependency_manager_unittest.cc
index 6fe5317c10f019813c126165570893154691a690..488793258f59b37725838e1eb2ac66d697fac64e 100644
--- a/chrome/browser/sync_file_system/drive_backend/task_dependency_manager_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend/task_dependency_manager_unittest.cc
@@ -36,6 +36,18 @@ void ErasePath(TaskDependencyManager* manager,
return manager->Erase(blocker);
}
+bool InsertExclusiveTask(TaskDependencyManager* manager) {
+ BlockingFactor blocker;
+ blocker.exclusive = true;
+ return manager->Insert(blocker);
+}
+
+void EraseExclusiveTask(TaskDependencyManager* manager) {
+ BlockingFactor blocker;
+ blocker.exclusive = true;
+ manager->Erase(blocker);
+}
+
} // namespace
TEST(TaskDependencyManagerTest, BasicTest) {
@@ -79,5 +91,20 @@ TEST(TaskDependencyManagerTest, BlocksAncestorAndDescendant) {
ErasePath(&manager, "app_id", FPL("/ancestor/parent/self/child/descendant"));
}
+TEST(TaskDependencyManagerTest, ExclusiveTask) {
+ TaskDependencyManager manager;
+
+ EXPECT_TRUE(InsertPath(&manager, "app_id", FPL("/foo/bar")));
+ EXPECT_FALSE(InsertExclusiveTask(&manager));
+ ErasePath(&manager, "app_id", FPL("/foo/bar"));
+
+ EXPECT_TRUE(InsertExclusiveTask(&manager));
+ EXPECT_FALSE(InsertPath(&manager, "app_id", FPL("/foo/bar")));
+ EraseExclusiveTask(&manager);
+
+ EXPECT_TRUE(InsertPath(&manager, "app_id", FPL("/foo/bar")));
+ ErasePath(&manager, "app_id", FPL("/foo/bar"));
+}
+
} // namespace drive_backend
} // namespace sync_file_system
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/task_dependency_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698