1 // Copyright 2018 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 CHROME_BROWSER_CHROMEOS_ARC_INPUT_METHOD_MANAGER_TEST_INPUT_METHOD_MANAGER_BRIDGE_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_INPUT_METHOD_MANAGER_TEST_INPUT_METHOD_MANAGER_BRIDGE_H_
7 
8 #include <string>
9 #include <tuple>
10 #include <vector>
11 
12 #include "base/macros.h"
13 #include "chrome/browser/chromeos/arc/input_method_manager/arc_input_method_manager_bridge.h"
14 #include "components/arc/mojom/input_method_manager.mojom-forward.h"
15 #include "mojo/public/cpp/bindings/pending_remote.h"
16 
17 namespace arc {
18 
19 class TestInputMethodManagerBridge : public ArcInputMethodManagerBridge {
20  public:
21   TestInputMethodManagerBridge();
22   ~TestInputMethodManagerBridge() override;
23 
24   // ArcInputMethodManagerBridge overrides:
25   void SendEnableIme(const std::string& ime_id,
26                      bool enable,
27                      EnableImeCallback callback) override;
28   void SendSwitchImeTo(const std::string& ime_id,
29                        SwitchImeToCallback callback) override;
30   void SendFocus(mojo::PendingRemote<mojom::InputConnection> connection,
31                  mojom::TextInputStatePtr state) override;
32   void SendUpdateTextInputState(mojom::TextInputStatePtr state) override;
33   void SendShowVirtualKeyboard() override;
34   void SendHideVirtualKeyboard() override;
35 
36   std::vector<std::tuple<std::string, bool>> enable_ime_calls_;
37   std::vector<std::string> switch_ime_to_calls_;
38   int focus_calls_count_ = 0;
39   int update_text_input_state_calls_count_ = 0;
40   mojom::TextInputStatePtr last_text_input_state_ = nullptr;
41   int show_virtual_keyboard_calls_count_ = 0;
42 
43  private:
44   DISALLOW_COPY_AND_ASSIGN(TestInputMethodManagerBridge);
45 };
46 
47 }  // namespace arc
48 
49 #endif  // CHROME_BROWSER_CHROMEOS_ARC_INPUT_METHOD_MANAGER_TEST_INPUT_METHOD_MANAGER_BRIDGE_H_
50