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

Unified Diff: content/public/test/test_fileapi_operation_waiter.h

Issue 2398463004: browser_test that creates filesystem resources in extension origin (Closed)
Patch Set: Rebase & apply alex's fixes. Created 4 years 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 | « content/public/test/browser_test_utils.cc ('k') | content/public/test/test_fileapi_operation_waiter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_fileapi_operation_waiter.h
diff --git a/content/public/test/test_fileapi_operation_waiter.h b/content/public/test/test_fileapi_operation_waiter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1918cdecb0d85be564ab7e60d653e846bc1addc
--- /dev/null
+++ b/content/public/test/test_fileapi_operation_waiter.h
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_TEST_TEST_FILEAPI_OPERATION_WAITER_H_
+
+#include <stdint.h>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/run_loop.h"
+#include "storage/browser/fileapi/file_observers.h"
+
+namespace storage {
+class FileSystemContext;
+class FileSystemURL;
+}
+
+namespace content {
+
+// Installs a temporary storage::FileUpdateObserver for use in browser tests
+// that need to wait for a specific fileapi operation to complete.
+class TestFileapiOperationWaiter : public storage::FileUpdateObserver {
+ public:
+ explicit TestFileapiOperationWaiter(storage::FileSystemContext* context);
+ ~TestFileapiOperationWaiter() override;
+
+ // Returns true if OnStartUpdate has occurred.
+ bool did_start_update() { return did_start_update_; }
+
+ // Wait for the next OnEndUpdate event.
+ void WaitForEndUpdate();
+
+ // FileUpdateObserver overrides.
+ void OnStartUpdate(const storage::FileSystemURL& url) override;
+ void OnUpdate(const storage::FileSystemURL& url, int64_t delta) override;
+ void OnEndUpdate(const storage::FileSystemURL& url) override;
+
+ private:
+ bool did_start_update_ = false;
+ base::RunLoop run_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestFileapiOperationWaiter);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_TEST_TEST_FILEAPI_OPERATION_WAITER_H_
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | content/public/test/test_fileapi_operation_waiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698