OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 #include "ui/base/win/mock_tsf_bridge.h" |
| 6 |
| 7 #include "ui/base/ime/text_input_client.h" |
| 8 #include "base/logging.h" |
| 9 |
| 10 namespace ui { |
| 11 |
| 12 MockTsfBridge::MockTsfBridge() |
| 13 : shutdown_call_count_(0), |
| 14 enable_ime_call_count_(0), |
| 15 disalbe_ime_call_count_(0), |
| 16 cancel_composition_call_count_(0), |
| 17 associate_focus_call_count_(0), |
| 18 set_focused_client_call_count_(0), |
| 19 remove_focused_client_call_count_(0), |
| 20 text_input_client_(NULL), |
| 21 focused_window_(NULL), |
| 22 latest_text_input_type_(TEXT_INPUT_TYPE_NONE) { |
| 23 } |
| 24 |
| 25 MockTsfBridge::~MockTsfBridge() { |
| 26 } |
| 27 |
| 28 void MockTsfBridge::Shutdown() { |
| 29 shutdown_call_count_++; |
| 30 } |
| 31 |
| 32 bool MockTsfBridge::CancelComposition() { |
| 33 ++cancel_composition_call_count_; |
| 34 return true; |
| 35 } |
| 36 |
| 37 void MockTsfBridge::OnTextInputTypeChanged(TextInputClient* client) { |
| 38 latest_text_input_type_ = client->GetTextInputType(); |
| 39 } |
| 40 |
| 41 void MockTsfBridge::SetFocusedClient(HWND focused_window, |
| 42 TextInputClient* client) { |
| 43 ++set_focused_client_call_count_; |
| 44 focused_window_ = focused_window; |
| 45 text_input_client_ = client; |
| 46 } |
| 47 |
| 48 void MockTsfBridge::RemoveFocusedClient(TextInputClient* client) { |
| 49 ++remove_focused_client_call_count_; |
| 50 DCHECK_EQ(client, text_input_client_); |
| 51 text_input_client_ = NULL; |
| 52 focused_window_ = NULL; |
| 53 } |
| 54 |
| 55 void MockTsfBridge::Reset() { |
| 56 shutdown_call_count_ = 0; |
| 57 enable_ime_call_count_ = 0; |
| 58 disalbe_ime_call_count_ = 0; |
| 59 cancel_composition_call_count_ = 0; |
| 60 associate_focus_call_count_ = 0; |
| 61 set_focused_client_call_count_ = 0; |
| 62 remove_focused_client_call_count_ = 0; |
| 63 text_input_client_ = NULL; |
| 64 focused_window_ = NULL; |
| 65 latest_text_input_type_ = TEXT_INPUT_TYPE_NONE; |
| 66 } |
| 67 |
| 68 } // namespace ui |
OLD | NEW |