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