OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/logging.h" | 5 #include "base/logging.h" |
6 #include "base/metrics/histogram.h" | 6 #include "base/metrics/histogram.h" |
7 #include "base/metrics/histogram_samples.h" | 7 #include "base/metrics/histogram_samples.h" |
8 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.h" |
9 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 9 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
10 #include "chrome/browser/chromeos/input_method/input_method_engine.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 engine_->FocusOut(); | 241 engine_->FocusOut(); |
242 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); | 242 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); |
243 } | 243 } |
244 | 244 |
245 TEST_F(InputMethodEngineTest, TestSwitching_Password_3rd_Party) { | 245 TEST_F(InputMethodEngineTest, TestSwitching_Password_3rd_Party) { |
246 CreateEngine(false); | 246 CreateEngine(false); |
247 // Enable/disable with focus. | 247 // Enable/disable with focus. |
248 FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); | 248 FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); |
249 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); | 249 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); |
250 engine_->Enable(); | 250 engine_->Enable(); |
251 EXPECT_EQ(ACTIVATE, observer_->GetCallsBitmapAndReset()); | 251 EXPECT_EQ(ACTIVATE | ONFOCUS, observer_->GetCallsBitmapAndReset()); |
252 engine_->Disable(); | 252 engine_->Disable(); |
253 EXPECT_EQ(DEACTIVATED, observer_->GetCallsBitmapAndReset()); | 253 EXPECT_EQ(DEACTIVATED, observer_->GetCallsBitmapAndReset()); |
254 // Focus change when enabled. | 254 // Focus change when enabled. |
255 engine_->Enable(); | 255 engine_->Enable(); |
256 EXPECT_EQ(ACTIVATE, observer_->GetCallsBitmapAndReset()); | 256 EXPECT_EQ(ACTIVATE | ONFOCUS, observer_->GetCallsBitmapAndReset()); |
257 engine_->FocusOut(); | 257 engine_->FocusOut(); |
258 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); | 258 EXPECT_EQ(ONBLUR, observer_->GetCallsBitmapAndReset()); |
259 FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); | 259 FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); |
260 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); | 260 EXPECT_EQ(ONFOCUS, observer_->GetCallsBitmapAndReset()); |
261 engine_->Disable(); | 261 engine_->Disable(); |
262 EXPECT_EQ(DEACTIVATED, observer_->GetCallsBitmapAndReset()); | 262 EXPECT_EQ(DEACTIVATED, observer_->GetCallsBitmapAndReset()); |
263 } | 263 } |
264 | 264 |
265 TEST_F(InputMethodEngineTest, TestSwitching_Password_Whitelisted) { | 265 TEST_F(InputMethodEngineTest, TestSwitching_Password_Whitelisted) { |
266 CreateEngine(true); | 266 CreateEngine(true); |
267 // Enable/disable with focus. | 267 // Enable/disable with focus. |
268 FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); | 268 FocusIn(ui::TEXT_INPUT_TYPE_PASSWORD); |
269 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); | 269 EXPECT_EQ(NONE, observer_->GetCallsBitmapAndReset()); |
270 engine_->Enable(); | 270 engine_->Enable(); |
(...skipping 21 matching lines...) Expand all Loading... |
292 engine_->CommitText(1, "入力", &error); | 292 engine_->CommitText(1, "入力", &error); |
293 engine_->CommitText(1, "input入力", &error); | 293 engine_->CommitText(1, "input入力", &error); |
294 ExpectNewSample("InputMethod.Commit.test_engine_id", 1, 3, 3); | 294 ExpectNewSample("InputMethod.Commit.test_engine_id", 1, 3, 3); |
295 ExpectNewSample("InputMethod.CommitCharacter.test_engine_id", 5, 3, 1); | 295 ExpectNewSample("InputMethod.CommitCharacter.test_engine_id", 5, 3, 1); |
296 ExpectNewSample("InputMethod.CommitCharacter.test_engine_id", 2, 3, 1); | 296 ExpectNewSample("InputMethod.CommitCharacter.test_engine_id", 2, 3, 1); |
297 ExpectNewSample("InputMethod.CommitCharacter.test_engine_id", 7, 3, 1); | 297 ExpectNewSample("InputMethod.CommitCharacter.test_engine_id", 7, 3, 1); |
298 } | 298 } |
299 | 299 |
300 } // namespace input_method | 300 } // namespace input_method |
301 } // namespace chromeos | 301 } // namespace chromeos |
OLD | NEW |