OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_TEST_TEST_FILEAPI_OPERATION_WAITER_H_ |
| 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" |
| 11 #include "base/run_loop.h" |
| 12 #include "storage/browser/fileapi/file_observers.h" |
| 13 |
| 14 namespace storage { |
| 15 class FileSystemContext; |
| 16 class FileSystemURL; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 // Installs a temporary storage::FileUpdateObserver for use in browser tests |
| 22 // that need to wait for a specific fileapi operation to complete. |
| 23 class TestFileapiOperationWaiter : public storage::FileUpdateObserver { |
| 24 public: |
| 25 explicit TestFileapiOperationWaiter(storage::FileSystemContext* context); |
| 26 ~TestFileapiOperationWaiter() override; |
| 27 |
| 28 // Returns true if OnStartUpdate has occurred. |
| 29 bool did_start_update() { return did_start_update_; } |
| 30 |
| 31 // Wait for the next OnEndUpdate event. |
| 32 void WaitForEndUpdate(); |
| 33 |
| 34 // FileUpdateObserver overrides. |
| 35 void OnStartUpdate(const storage::FileSystemURL& url) override; |
| 36 void OnUpdate(const storage::FileSystemURL& url, int64_t delta) override; |
| 37 void OnEndUpdate(const storage::FileSystemURL& url) override; |
| 38 |
| 39 private: |
| 40 bool did_start_update_ = false; |
| 41 base::RunLoop run_loop_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(TestFileapiOperationWaiter); |
| 44 }; |
| 45 |
| 46 } // namespace content |
| 47 |
| 48 #endif // CONTENT_PUBLIC_TEST_TEST_FILEAPI_OPERATION_WAITER_H_ |
OLD | NEW |