directory_test_helper.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2019 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. #ifndef COMPONENTS_SERVICES_FILESYSTEM_DIRECTORY_TEST_HELPER_H_
  5. #define COMPONENTS_SERVICES_FILESYSTEM_DIRECTORY_TEST_HELPER_H_
  6. #include "base/threading/sequence_bound.h"
  7. #include "components/services/filesystem/public/mojom/directory.mojom.h"
  8. #include "mojo/public/cpp/bindings/remote.h"
  9. namespace filesystem {
  10. // Helper class for tests which want to use a remote DirectoryImpl. This binds
  11. // DirectoryImpl instances for temporary directories on a background thread
  12. // which supports blocking operations.
  13. class DirectoryTestHelper {
  14. public:
  15. DirectoryTestHelper();
  16. DirectoryTestHelper(const DirectoryTestHelper&) = delete;
  17. DirectoryTestHelper& operator=(const DirectoryTestHelper&) = delete;
  18. ~DirectoryTestHelper();
  19. mojo::Remote<mojom::Directory> CreateTempDir();
  20. private:
  21. class BlockingState;
  22. base::SequenceBound<BlockingState> blocking_state_;
  23. };
  24. } // namespace filesystem
  25. #endif // COMPONENTS_SERVICES_FILESYSTEM_DIRECTORY_TEST_HELPER_H_