test_api_stubs.h 1.0 KB

12345678910111213141516171819202122232425262728
  1. // Copyright 2020 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_STORAGE_TEST_API_STUBS_H_
  5. #define COMPONENTS_SERVICES_STORAGE_TEST_API_STUBS_H_
  6. #include "base/callback_forward.h"
  7. #include "base/component_export.h"
  8. #include "mojo/public/cpp/system/message_pipe.h"
  9. namespace storage {
  10. // Allows test environments to inject an actual implementation of the TestApi
  11. // Mojo interface. This uses a raw message pipe to avoid production code
  12. // depending on any test API interface definitions.
  13. using TestApiBinderForTesting =
  14. base::RepeatingCallback<void(mojo::ScopedMessagePipeHandle)>;
  15. COMPONENT_EXPORT(STORAGE_SERVICE_TEST_API_STUBS)
  16. void SetTestApiBinderForTesting(TestApiBinderForTesting binder);
  17. COMPONENT_EXPORT(STORAGE_SERVICE_TEST_API_STUBS)
  18. const TestApiBinderForTesting& GetTestApiBinderForTesting();
  19. } // namespace storage
  20. #endif // COMPONENTS_SERVICES_STORAGE_TEST_API_STUBS_H_