mock_input_channel.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 ASH_SERVICES_IME_MOCK_INPUT_CHANNEL_H_
  5. #define ASH_SERVICES_IME_MOCK_INPUT_CHANNEL_H_
  6. #include "ash/services/ime/public/mojom/input_engine.mojom.h"
  7. #include "ash/services/ime/public/mojom/input_method.mojom.h"
  8. #include "ash/services/ime/public/mojom/input_method_host.mojom.h"
  9. #include "mojo/public/cpp/bindings/pending_remote.h"
  10. #include "mojo/public/cpp/bindings/receiver.h"
  11. #include "testing/gmock/include/gmock/gmock.h"
  12. namespace ash {
  13. namespace ime {
  14. // A mock receiver InputChannel.
  15. class MockInputChannel : public mojom::InputChannel {
  16. public:
  17. MockInputChannel();
  18. ~MockInputChannel() override;
  19. MockInputChannel(const MockInputChannel&) = delete;
  20. MockInputChannel& operator=(const MockInputChannel&) = delete;
  21. mojo::PendingRemote<mojom::InputChannel> CreatePendingRemote();
  22. bool IsBound() const;
  23. void FlushForTesting();
  24. // mojom::InputChannel:
  25. void ProcessMessage(const std::vector<uint8_t>& message,
  26. ProcessMessageCallback callback) override;
  27. private:
  28. mojo::Receiver<mojom::InputChannel> receiver_;
  29. };
  30. } // namespace ime
  31. } // namespace ash
  32. #endif // ASH_SERVICES_IME_MOCK_INPUT_CHANNEL_H_