test_component_controller.h 1018 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2021 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 BASE_FUCHSIA_TEST_COMPONENT_CONTROLLER_H_
  5. #define BASE_FUCHSIA_TEST_COMPONENT_CONTROLLER_H_
  6. #include <fuchsia/sys/cpp/fidl.h>
  7. #include "base/base_export.h"
  8. namespace base {
  9. // fuchsia.sys.ComponentController that requests the component to teardown
  10. // gracefully, and waits for it to do so, when destroyed.
  11. class BASE_EXPORT TestComponentController {
  12. public:
  13. TestComponentController();
  14. ~TestComponentController();
  15. TestComponentController(TestComponentController&&);
  16. TestComponentController& operator=(TestComponentController&&);
  17. explicit operator bool() const { return ptr_.is_bound(); }
  18. ::fuchsia::sys::ComponentControllerPtr& ptr() { return ptr_; }
  19. void KillAndRunUntilDisconnect();
  20. private:
  21. ::fuchsia::sys::ComponentControllerPtr ptr_;
  22. };
  23. } // namespace base
  24. #endif // BASE_FUCHSIA_TEST_COMPONENT_CONTROLLER_H_