blob: 909124e0c02ffb852c0ec18c1460354e21754248 [file] [log] [blame]
Blake O'Hare5501e5a2017-10-05 06:43:251// Copyright 2017 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
Shu Chen3c379ddb2018-08-17 01:51:595#ifndef CHROME_BROWSER_UI_ASH_TEST_IME_CONTROLLER_H_
6#define CHROME_BROWSER_UI_ASH_TEST_IME_CONTROLLER_H_
Blake O'Hare5501e5a2017-10-05 06:43:257
8#include <memory>
9#include <string>
10#include <utility>
Lei Zhangd89b6cc92021-06-29 02:07:3011#include <vector>
Blake O'Hare5501e5a2017-10-05 06:43:2512
Darren Shen7b132782019-12-10 04:36:0613#include "ash/public/cpp/ime_controller.h"
14#include "ash/public/cpp/ime_info.h"
Blake O'Hare5501e5a2017-10-05 06:43:2515
Darren Shen7b132782019-12-10 04:36:0616// Class that resets the ImeController instance to nullptr and then restores it
17// when it is destroyed.
18class ImeControllerResetterForTest {
19 public:
20 ImeControllerResetterForTest();
21 ~ImeControllerResetterForTest();
22
23 private:
24 ash::ImeController* const instance_;
25};
26
27class TestImeController : private ImeControllerResetterForTest,
28 public ash::ImeController {
Blake O'Hare5501e5a2017-10-05 06:43:2529 public:
30 TestImeController();
31 ~TestImeController() override;
32
Darren Shen7b132782019-12-10 04:36:0633 // ash::ImeController:
34 void SetClient(ash::ImeControllerClient* client) override;
Blake O'Hare5501e5a2017-10-05 06:43:2535 void RefreshIme(const std::string& current_ime_id,
Darren Shen7b132782019-12-10 04:36:0636 std::vector<ash::ImeInfo> available_imes,
37 std::vector<ash::ImeMenuItem> menu_items) override;
Blake O'Hare5501e5a2017-10-05 06:43:2538 void SetImesManagedByPolicy(bool managed) override;
39 void ShowImeMenuOnShelf(bool show) override;
Darren Shen9f636612018-03-08 00:02:3940 void UpdateCapsLockState(bool enabled) override;
Darren Shen29b26a42018-03-18 22:36:1241 void OnKeyboardLayoutNameChanged(const std::string& layout_name) override;
Blake O'Hare5501e5a2017-10-05 06:43:2542 void SetExtraInputOptionsEnabledState(bool is_extra_input_options_enabled,
43 bool is_emoji_enabled,
44 bool is_handwriting_enabled,
45 bool is_voice_enabled) override;
Shu Chen3cb6c3f2018-08-15 04:18:4746 void ShowModeIndicator(const gfx::Rect& anchor_bounds,
Jan Wilken Dörrie3f97e292021-03-11 18:07:1447 const std::u16string& text) override;
Blake O'Hare5501e5a2017-10-05 06:43:2548
49 // The most recent values received via mojo.
50 std::string current_ime_id_;
Darren Shen7b132782019-12-10 04:36:0651 std::vector<ash::ImeInfo> available_imes_;
52 std::vector<ash::ImeMenuItem> menu_items_;
Blake O'Hare5501e5a2017-10-05 06:43:2553 bool managed_by_policy_ = false;
54 bool show_ime_menu_on_shelf_ = false;
Shu Chen3cb6c3f2018-08-15 04:18:4755 bool show_mode_indicator_ = false;
Blake O'Hare5501e5a2017-10-05 06:43:2556 bool is_caps_lock_enabled_ = false;
Darren Shen29b26a42018-03-18 22:36:1257 std::string keyboard_layout_name_;
Blake O'Hare5501e5a2017-10-05 06:43:2558 bool is_extra_input_options_enabled_ = false;
59 bool is_emoji_enabled_ = false;
60 bool is_handwriting_enabled_ = false;
61 bool is_voice_enabled_ = false;
62
63 private:
Blake O'Hare5501e5a2017-10-05 06:43:2564 DISALLOW_COPY_AND_ASSIGN(TestImeController);
65};
66
Shu Chen3c379ddb2018-08-17 01:51:5967#endif // CHROME_BROWSER_UI_ASH_TEST_IME_CONTROLLER_H_