Keep main loop running until FilesystemCopierAction under test has stopped.
This CL fixes FilesystemCopierActionTest.RunAsRootTerminateEarlyTest
such that it does not prematurely terminate the glib main loop before
FilesystemCopierAction::AsyncReadReadyCallback is invoked upon the
cancellation of the action.
BUG=chromium-os:34448
TEST=Run unit tests repeatedly with glib 2.30 and 2.32.
Change-Id: I26c15811ee41d16df731c4acbe24ed48c8739dde
Reviewed-on: https://gerrit.chromium.org/gerrit/34976
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
diff --git a/filesystem_copier_action.h b/filesystem_copier_action.h
index 9bd9b20..366ae40 100644
--- a/filesystem_copier_action.h
+++ b/filesystem_copier_action.h
@@ -46,6 +46,12 @@
void PerformAction();
void TerminateProcessing();
+ // Used for testing. Return true if Cleanup() has not yet been called due
+ // to a callback upon the completion or cancellation of the copier action.
+ // A test should wait until IsCleanupPending() returns false before
+ // terminating the glib main loop.
+ bool IsCleanupPending() const;
+
// Used for testing, so we can copy from somewhere other than root
void set_copy_source(const std::string& path) { copy_source_ = path; }