OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "chrome/browser/profiles/profile_manager.h" | 6 #include "chrome/browser/profiles/profile_manager.h" |
7 #include "chrome/browser/ui/input_method/input_method_engine.h" | 7 #include "chrome/browser/ui/input_method/input_method_engine.h" |
8 #include "chrome/browser/ui/input_method/input_method_engine_base.h" | 8 #include "chrome/browser/ui/input_method/input_method_engine_base.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "content/public/test/test_utils.h" | 10 #include "content/public/test/test_utils.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const std::string& text, | 100 const std::string& text, |
101 int cursor_pos, | 101 int cursor_pos, |
102 int anchor_pos, | 102 int anchor_pos, |
103 int offset) override { | 103 int offset) override { |
104 calls_bitmap_ |= ONSURROUNDINGTEXTCHANGED; | 104 calls_bitmap_ |= ONSURROUNDINGTEXTCHANGED; |
105 surrounding_info_.text = text; | 105 surrounding_info_.text = text; |
106 surrounding_info_.focus = cursor_pos; | 106 surrounding_info_.focus = cursor_pos; |
107 surrounding_info_.anchor = anchor_pos; | 107 surrounding_info_.anchor = anchor_pos; |
108 surrounding_info_.offset = offset; | 108 surrounding_info_.offset = offset; |
109 } | 109 } |
| 110 void OnRequestEngineSwitch() override {} |
110 | 111 |
111 // Returns and resets the bitmap |calls_bitmap_|. | 112 // Returns and resets the bitmap |calls_bitmap_|. |
112 unsigned char GetCallsBitmapAndReset() { | 113 unsigned char GetCallsBitmapAndReset() { |
113 unsigned char ret = calls_bitmap_; | 114 unsigned char ret = calls_bitmap_; |
114 calls_bitmap_ = NONE; | 115 calls_bitmap_ = NONE; |
115 return ret; | 116 return ret; |
116 } | 117 } |
117 | 118 |
118 const InputMethodEngineBase::KeyboardEvent& GetKeyEvent() { | 119 const InputMethodEngineBase::KeyboardEvent& GetKeyEvent() { |
119 return key_event_; | 120 return key_event_; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 0 /*focused position*/, 1 /*anchor position*/, | 252 0 /*focused position*/, 1 /*anchor position*/, |
252 0 /*offset position*/); | 253 0 /*offset position*/); |
253 EXPECT_EQ(ONSURROUNDINGTEXTCHANGED, observer_->GetCallsBitmapAndReset()); | 254 EXPECT_EQ(ONSURROUNDINGTEXTCHANGED, observer_->GetCallsBitmapAndReset()); |
254 EXPECT_EQ("text", observer_->GetSurroundingInfo().text); | 255 EXPECT_EQ("text", observer_->GetSurroundingInfo().text); |
255 EXPECT_EQ(0, observer_->GetSurroundingInfo().focus); | 256 EXPECT_EQ(0, observer_->GetSurroundingInfo().focus); |
256 EXPECT_EQ(1, observer_->GetSurroundingInfo().anchor); | 257 EXPECT_EQ(1, observer_->GetSurroundingInfo().anchor); |
257 EXPECT_EQ(0, observer_->GetSurroundingInfo().offset); | 258 EXPECT_EQ(0, observer_->GetSurroundingInfo().offset); |
258 } | 259 } |
259 | 260 |
260 } // namespace input_method | 261 } // namespace input_method |
OLD | NEW |