| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/base/ime/input_method_auralinux.h" | 5 #include "ui/base/ime/input_method_auralinux.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 gfx::Rect cursor_position_; | 136 gfx::Rect cursor_position_; |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(LinuxInputMethodContextForTesting); | 138 DISALLOW_COPY_AND_ASSIGN(LinuxInputMethodContextForTesting); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 class LinuxInputMethodContextFactoryForTesting | 141 class LinuxInputMethodContextFactoryForTesting |
| 142 : public LinuxInputMethodContextFactory { | 142 : public LinuxInputMethodContextFactory { |
| 143 public: | 143 public: |
| 144 LinuxInputMethodContextFactoryForTesting(){}; | 144 LinuxInputMethodContextFactoryForTesting(){}; |
| 145 | 145 |
| 146 scoped_ptr<LinuxInputMethodContext> CreateInputMethodContext( | 146 std::unique_ptr<LinuxInputMethodContext> CreateInputMethodContext( |
| 147 LinuxInputMethodContextDelegate* delegate, | 147 LinuxInputMethodContextDelegate* delegate, |
| 148 bool is_simple) const override { | 148 bool is_simple) const override { |
| 149 return scoped_ptr<ui::LinuxInputMethodContext>( | 149 return std::unique_ptr<ui::LinuxInputMethodContext>( |
| 150 new LinuxInputMethodContextForTesting(delegate, is_simple)); | 150 new LinuxInputMethodContextForTesting(delegate, is_simple)); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 DISALLOW_COPY_AND_ASSIGN(LinuxInputMethodContextFactoryForTesting); | 154 DISALLOW_COPY_AND_ASSIGN(LinuxInputMethodContextFactoryForTesting); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 class InputMethodDelegateForTesting : public internal::InputMethodDelegate { | 157 class InputMethodDelegateForTesting : public internal::InputMethodDelegate { |
| 158 public: | 158 public: |
| 159 InputMethodDelegateForTesting(){}; | 159 InputMethodDelegateForTesting(){}; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 TestResult* test_result_; | 285 TestResult* test_result_; |
| 286 | 286 |
| 287 DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinuxTest); | 287 DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinuxTest); |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 TEST_F(InputMethodAuraLinuxTest, BasicSyncModeTest) { | 290 TEST_F(InputMethodAuraLinuxTest, BasicSyncModeTest) { |
| 291 context_->SetSyncMode(true); | 291 context_->SetSyncMode(true); |
| 292 context_->SetEatKey(true); | 292 context_->SetEatKey(true); |
| 293 context_->AddCommitAction("a"); | 293 context_->AddCommitAction("a"); |
| 294 | 294 |
| 295 scoped_ptr<TextInputClientForTesting> client( | 295 std::unique_ptr<TextInputClientForTesting> client( |
| 296 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 296 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 297 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 297 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 298 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 298 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 299 | 299 |
| 300 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 300 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 301 key_new.set_character(L'a'); | 301 key_new.set_character(L'a'); |
| 302 | 302 |
| 303 KeyEvent key = key_new; | 303 KeyEvent key = key_new; |
| 304 input_method_auralinux_->DispatchKeyEvent(&key); | 304 input_method_auralinux_->DispatchKeyEvent(&key); |
| 305 | 305 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 319 | 319 |
| 320 test_result_->ExpectAction("keydown:65"); | 320 test_result_->ExpectAction("keydown:65"); |
| 321 test_result_->ExpectAction("keypress:97"); | 321 test_result_->ExpectAction("keypress:97"); |
| 322 test_result_->Verify(); | 322 test_result_->Verify(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 TEST_F(InputMethodAuraLinuxTest, BasicAsyncModeTest) { | 325 TEST_F(InputMethodAuraLinuxTest, BasicAsyncModeTest) { |
| 326 context_->SetSyncMode(false); | 326 context_->SetSyncMode(false); |
| 327 context_->SetEatKey(true); | 327 context_->SetEatKey(true); |
| 328 | 328 |
| 329 scoped_ptr<TextInputClientForTesting> client( | 329 std::unique_ptr<TextInputClientForTesting> client( |
| 330 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 330 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 331 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 331 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 332 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 332 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 333 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 333 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 334 key_new.set_character(L'a'); | 334 key_new.set_character(L'a'); |
| 335 KeyEvent key = key_new; | 335 KeyEvent key = key_new; |
| 336 input_method_auralinux_->DispatchKeyEvent(&key); | 336 input_method_auralinux_->DispatchKeyEvent(&key); |
| 337 input_method_auralinux_->OnCommit(base::ASCIIToUTF16("a")); | 337 input_method_auralinux_->OnCommit(base::ASCIIToUTF16("a")); |
| 338 | 338 |
| 339 test_result_->ExpectAction("keydown:229"); | 339 test_result_->ExpectAction("keydown:229"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 352 | 352 |
| 353 test_result_->ExpectAction("keydown:65"); | 353 test_result_->ExpectAction("keydown:65"); |
| 354 test_result_->ExpectAction("keypress:97"); | 354 test_result_->ExpectAction("keypress:97"); |
| 355 test_result_->Verify(); | 355 test_result_->Verify(); |
| 356 } | 356 } |
| 357 | 357 |
| 358 TEST_F(InputMethodAuraLinuxTest, IBusUSTest) { | 358 TEST_F(InputMethodAuraLinuxTest, IBusUSTest) { |
| 359 context_->SetSyncMode(false); | 359 context_->SetSyncMode(false); |
| 360 context_->SetEatKey(true); | 360 context_->SetEatKey(true); |
| 361 | 361 |
| 362 scoped_ptr<TextInputClientForTesting> client( | 362 std::unique_ptr<TextInputClientForTesting> client( |
| 363 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 363 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 364 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 364 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 365 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 365 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 366 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 366 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 367 key_new.set_character(L'a'); | 367 key_new.set_character(L'a'); |
| 368 KeyEvent key = key_new; | 368 KeyEvent key = key_new; |
| 369 input_method_auralinux_->DispatchKeyEvent(&key); | 369 input_method_auralinux_->DispatchKeyEvent(&key); |
| 370 | 370 |
| 371 // IBus mutes the key down. | 371 // IBus mutes the key down. |
| 372 test_result_->Verify(); | 372 test_result_->Verify(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 387 input_method_auralinux_->DispatchKeyEvent(&key_up); | 387 input_method_auralinux_->DispatchKeyEvent(&key_up); |
| 388 | 388 |
| 389 test_result_->ExpectAction("keyup:65"); | 389 test_result_->ExpectAction("keyup:65"); |
| 390 test_result_->Verify(); | 390 test_result_->Verify(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 TEST_F(InputMethodAuraLinuxTest, IBusPinyinTest) { | 393 TEST_F(InputMethodAuraLinuxTest, IBusPinyinTest) { |
| 394 context_->SetSyncMode(false); | 394 context_->SetSyncMode(false); |
| 395 context_->SetEatKey(true); | 395 context_->SetEatKey(true); |
| 396 | 396 |
| 397 scoped_ptr<TextInputClientForTesting> client( | 397 std::unique_ptr<TextInputClientForTesting> client( |
| 398 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 398 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 399 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 399 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 400 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 400 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 401 KeyEvent key(ET_KEY_PRESSED, VKEY_A, 0); | 401 KeyEvent key(ET_KEY_PRESSED, VKEY_A, 0); |
| 402 key.set_character(L'a'); | 402 key.set_character(L'a'); |
| 403 input_method_auralinux_->DispatchKeyEvent(&key); | 403 input_method_auralinux_->DispatchKeyEvent(&key); |
| 404 | 404 |
| 405 // IBus issues a standalone set_composition action. | 405 // IBus issues a standalone set_composition action. |
| 406 input_method_auralinux_->OnPreeditStart(); | 406 input_method_auralinux_->OnPreeditStart(); |
| 407 CompositionText comp; | 407 CompositionText comp; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 425 test_result_->ExpectAction("keydown:229"); | 425 test_result_->ExpectAction("keydown:229"); |
| 426 test_result_->ExpectAction("textinput:A"); | 426 test_result_->ExpectAction("textinput:A"); |
| 427 test_result_->Verify(); | 427 test_result_->Verify(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 // crbug.com/463491 | 430 // crbug.com/463491 |
| 431 TEST_F(InputMethodAuraLinuxTest, DeadKeyTest) { | 431 TEST_F(InputMethodAuraLinuxTest, DeadKeyTest) { |
| 432 context_simple_->SetSyncMode(true); | 432 context_simple_->SetSyncMode(true); |
| 433 context_simple_->SetEatKey(true); | 433 context_simple_->SetEatKey(true); |
| 434 | 434 |
| 435 scoped_ptr<TextInputClientForTesting> client( | 435 std::unique_ptr<TextInputClientForTesting> client( |
| 436 new TextInputClientForTesting(TEXT_INPUT_TYPE_NONE)); | 436 new TextInputClientForTesting(TEXT_INPUT_TYPE_NONE)); |
| 437 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 437 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 438 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 438 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 439 | 439 |
| 440 KeyEvent dead_key(ET_KEY_PRESSED, VKEY_OEM_7, 0); | 440 KeyEvent dead_key(ET_KEY_PRESSED, VKEY_OEM_7, 0); |
| 441 dead_key.set_character(L'\''); | 441 dead_key.set_character(L'\''); |
| 442 input_method_auralinux_->DispatchKeyEvent(&dead_key); | 442 input_method_auralinux_->DispatchKeyEvent(&dead_key); |
| 443 | 443 |
| 444 // The single quote key is muted. | 444 // The single quote key is muted. |
| 445 test_result_->ExpectAction("keydown:222"); | 445 test_result_->ExpectAction("keydown:222"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 456 test_result_->Verify(); | 456 test_result_->Verify(); |
| 457 } | 457 } |
| 458 | 458 |
| 459 TEST_F(InputMethodAuraLinuxTest, MultiCommitsTest) { | 459 TEST_F(InputMethodAuraLinuxTest, MultiCommitsTest) { |
| 460 context_->SetSyncMode(true); | 460 context_->SetSyncMode(true); |
| 461 context_->SetEatKey(true); | 461 context_->SetEatKey(true); |
| 462 context_->AddCommitAction("a"); | 462 context_->AddCommitAction("a"); |
| 463 context_->AddCommitAction("b"); | 463 context_->AddCommitAction("b"); |
| 464 context_->AddCommitAction("c"); | 464 context_->AddCommitAction("c"); |
| 465 | 465 |
| 466 scoped_ptr<TextInputClientForTesting> client( | 466 std::unique_ptr<TextInputClientForTesting> client( |
| 467 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 467 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 468 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 468 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 469 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 469 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 470 | 470 |
| 471 KeyEvent key(ET_KEY_PRESSED, VKEY_A, 0); | 471 KeyEvent key(ET_KEY_PRESSED, VKEY_A, 0); |
| 472 key.set_character(L'a'); | 472 key.set_character(L'a'); |
| 473 input_method_auralinux_->DispatchKeyEvent(&key); | 473 input_method_auralinux_->DispatchKeyEvent(&key); |
| 474 | 474 |
| 475 test_result_->ExpectAction("keydown:229"); | 475 test_result_->ExpectAction("keydown:229"); |
| 476 test_result_->ExpectAction("textinput:abc"); | 476 test_result_->ExpectAction("textinput:abc"); |
| 477 test_result_->Verify(); | 477 test_result_->Verify(); |
| 478 } | 478 } |
| 479 | 479 |
| 480 TEST_F(InputMethodAuraLinuxTest, MixedCompositionAndCommitTest) { | 480 TEST_F(InputMethodAuraLinuxTest, MixedCompositionAndCommitTest) { |
| 481 context_->SetSyncMode(true); | 481 context_->SetSyncMode(true); |
| 482 context_->SetEatKey(true); | 482 context_->SetEatKey(true); |
| 483 context_->AddCommitAction("a"); | 483 context_->AddCommitAction("a"); |
| 484 context_->AddCompositionStartAction(); | 484 context_->AddCompositionStartAction(); |
| 485 context_->AddCompositionUpdateAction("b"); | 485 context_->AddCompositionUpdateAction("b"); |
| 486 context_->AddCommitAction("c"); | 486 context_->AddCommitAction("c"); |
| 487 context_->AddCompositionUpdateAction("d"); | 487 context_->AddCompositionUpdateAction("d"); |
| 488 | 488 |
| 489 scoped_ptr<TextInputClientForTesting> client( | 489 std::unique_ptr<TextInputClientForTesting> client( |
| 490 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 490 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 491 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 491 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 492 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 492 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 493 | 493 |
| 494 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 494 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 495 key_new.set_character(L'a'); | 495 key_new.set_character(L'a'); |
| 496 KeyEvent key = key_new; | 496 KeyEvent key = key_new; |
| 497 input_method_auralinux_->DispatchKeyEvent(&key); | 497 input_method_auralinux_->DispatchKeyEvent(&key); |
| 498 | 498 |
| 499 test_result_->ExpectAction("keydown:229"); | 499 test_result_->ExpectAction("keydown:229"); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 511 test_result_->ExpectAction("textinput:e"); | 511 test_result_->ExpectAction("textinput:e"); |
| 512 test_result_->Verify(); | 512 test_result_->Verify(); |
| 513 } | 513 } |
| 514 | 514 |
| 515 TEST_F(InputMethodAuraLinuxTest, CompositionEndWithoutCommitTest) { | 515 TEST_F(InputMethodAuraLinuxTest, CompositionEndWithoutCommitTest) { |
| 516 context_->SetSyncMode(true); | 516 context_->SetSyncMode(true); |
| 517 context_->SetEatKey(true); | 517 context_->SetEatKey(true); |
| 518 context_->AddCompositionStartAction(); | 518 context_->AddCompositionStartAction(); |
| 519 context_->AddCompositionUpdateAction("a"); | 519 context_->AddCompositionUpdateAction("a"); |
| 520 | 520 |
| 521 scoped_ptr<TextInputClientForTesting> client( | 521 std::unique_ptr<TextInputClientForTesting> client( |
| 522 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 522 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 523 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 523 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 524 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 524 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 525 | 525 |
| 526 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 526 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 527 key_new.set_character(L'a'); | 527 key_new.set_character(L'a'); |
| 528 KeyEvent key = key_new; | 528 KeyEvent key = key_new; |
| 529 input_method_auralinux_->DispatchKeyEvent(&key); | 529 input_method_auralinux_->DispatchKeyEvent(&key); |
| 530 | 530 |
| 531 test_result_->ExpectAction("keydown:229"); | 531 test_result_->ExpectAction("keydown:229"); |
| 532 test_result_->ExpectAction("compositionstart"); | 532 test_result_->ExpectAction("compositionstart"); |
| 533 test_result_->ExpectAction("compositionupdate:a"); | 533 test_result_->ExpectAction("compositionupdate:a"); |
| 534 test_result_->Verify(); | 534 test_result_->Verify(); |
| 535 | 535 |
| 536 context_->AddCompositionEndAction(); | 536 context_->AddCompositionEndAction(); |
| 537 key = key_new; | 537 key = key_new; |
| 538 input_method_auralinux_->DispatchKeyEvent(&key); | 538 input_method_auralinux_->DispatchKeyEvent(&key); |
| 539 | 539 |
| 540 test_result_->ExpectAction("keydown:229"); | 540 test_result_->ExpectAction("keydown:229"); |
| 541 test_result_->ExpectAction("compositionend"); | 541 test_result_->ExpectAction("compositionend"); |
| 542 test_result_->Verify(); | 542 test_result_->Verify(); |
| 543 } | 543 } |
| 544 | 544 |
| 545 TEST_F(InputMethodAuraLinuxTest, CompositionEndWithEmptyCommitTest) { | 545 TEST_F(InputMethodAuraLinuxTest, CompositionEndWithEmptyCommitTest) { |
| 546 context_->SetSyncMode(true); | 546 context_->SetSyncMode(true); |
| 547 context_->SetEatKey(true); | 547 context_->SetEatKey(true); |
| 548 context_->AddCompositionStartAction(); | 548 context_->AddCompositionStartAction(); |
| 549 context_->AddCompositionUpdateAction("a"); | 549 context_->AddCompositionUpdateAction("a"); |
| 550 | 550 |
| 551 scoped_ptr<TextInputClientForTesting> client( | 551 std::unique_ptr<TextInputClientForTesting> client( |
| 552 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 552 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 553 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 553 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 554 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 554 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 555 | 555 |
| 556 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 556 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 557 key_new.set_character(L'a'); | 557 key_new.set_character(L'a'); |
| 558 KeyEvent key = key_new; | 558 KeyEvent key = key_new; |
| 559 input_method_auralinux_->DispatchKeyEvent(&key); | 559 input_method_auralinux_->DispatchKeyEvent(&key); |
| 560 | 560 |
| 561 test_result_->ExpectAction("keydown:229"); | 561 test_result_->ExpectAction("keydown:229"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 572 test_result_->ExpectAction("compositionend"); | 572 test_result_->ExpectAction("compositionend"); |
| 573 test_result_->Verify(); | 573 test_result_->Verify(); |
| 574 } | 574 } |
| 575 | 575 |
| 576 TEST_F(InputMethodAuraLinuxTest, CompositionEndWithCommitTest) { | 576 TEST_F(InputMethodAuraLinuxTest, CompositionEndWithCommitTest) { |
| 577 context_->SetSyncMode(true); | 577 context_->SetSyncMode(true); |
| 578 context_->SetEatKey(true); | 578 context_->SetEatKey(true); |
| 579 context_->AddCompositionStartAction(); | 579 context_->AddCompositionStartAction(); |
| 580 context_->AddCompositionUpdateAction("a"); | 580 context_->AddCompositionUpdateAction("a"); |
| 581 | 581 |
| 582 scoped_ptr<TextInputClientForTesting> client( | 582 std::unique_ptr<TextInputClientForTesting> client( |
| 583 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 583 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 584 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 584 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 585 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 585 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 586 | 586 |
| 587 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 587 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 588 key_new.set_character(L'a'); | 588 key_new.set_character(L'a'); |
| 589 KeyEvent key = key_new; | 589 KeyEvent key = key_new; |
| 590 input_method_auralinux_->DispatchKeyEvent(&key); | 590 input_method_auralinux_->DispatchKeyEvent(&key); |
| 591 | 591 |
| 592 test_result_->ExpectAction("keydown:229"); | 592 test_result_->ExpectAction("keydown:229"); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 607 test_result_->Verify(); | 607 test_result_->Verify(); |
| 608 } | 608 } |
| 609 | 609 |
| 610 TEST_F(InputMethodAuraLinuxTest, CompositionUpdateWithCommitTest) { | 610 TEST_F(InputMethodAuraLinuxTest, CompositionUpdateWithCommitTest) { |
| 611 context_->SetSyncMode(true); | 611 context_->SetSyncMode(true); |
| 612 context_->SetEatKey(true); | 612 context_->SetEatKey(true); |
| 613 context_->AddCompositionStartAction(); | 613 context_->AddCompositionStartAction(); |
| 614 context_->AddCompositionUpdateAction("a"); | 614 context_->AddCompositionUpdateAction("a"); |
| 615 context_->AddCommitAction("b"); | 615 context_->AddCommitAction("b"); |
| 616 | 616 |
| 617 scoped_ptr<TextInputClientForTesting> client( | 617 std::unique_ptr<TextInputClientForTesting> client( |
| 618 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 618 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 619 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 619 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 620 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 620 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 621 | 621 |
| 622 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 622 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 623 key_new.set_character(L'a'); | 623 key_new.set_character(L'a'); |
| 624 KeyEvent key = key_new; | 624 KeyEvent key = key_new; |
| 625 input_method_auralinux_->DispatchKeyEvent(&key); | 625 input_method_auralinux_->DispatchKeyEvent(&key); |
| 626 | 626 |
| 627 test_result_->ExpectAction("keydown:229"); | 627 test_result_->ExpectAction("keydown:229"); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 641 test_result_->ExpectAction("keydown:229"); | 641 test_result_->ExpectAction("keydown:229"); |
| 642 test_result_->ExpectAction("compositionend"); | 642 test_result_->ExpectAction("compositionend"); |
| 643 test_result_->ExpectAction("textinput:c"); | 643 test_result_->ExpectAction("textinput:c"); |
| 644 test_result_->Verify(); | 644 test_result_->Verify(); |
| 645 } | 645 } |
| 646 | 646 |
| 647 TEST_F(InputMethodAuraLinuxTest, MixedAsyncAndSyncTest) { | 647 TEST_F(InputMethodAuraLinuxTest, MixedAsyncAndSyncTest) { |
| 648 context_->SetSyncMode(false); | 648 context_->SetSyncMode(false); |
| 649 context_->SetEatKey(true); | 649 context_->SetEatKey(true); |
| 650 | 650 |
| 651 scoped_ptr<TextInputClientForTesting> client( | 651 std::unique_ptr<TextInputClientForTesting> client( |
| 652 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 652 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 653 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 653 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 654 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 654 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 655 | 655 |
| 656 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 656 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 657 key_new.set_character(L'a'); | 657 key_new.set_character(L'a'); |
| 658 KeyEvent key = key_new; | 658 KeyEvent key = key_new; |
| 659 input_method_auralinux_->DispatchKeyEvent(&key); | 659 input_method_auralinux_->DispatchKeyEvent(&key); |
| 660 CompositionText comp; | 660 CompositionText comp; |
| 661 comp.text = base::ASCIIToUTF16("a"); | 661 comp.text = base::ASCIIToUTF16("a"); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 678 test_result_->ExpectAction("textinput:b"); | 678 test_result_->ExpectAction("textinput:b"); |
| 679 test_result_->Verify(); | 679 test_result_->Verify(); |
| 680 } | 680 } |
| 681 | 681 |
| 682 TEST_F(InputMethodAuraLinuxTest, MixedSyncAndAsyncTest) { | 682 TEST_F(InputMethodAuraLinuxTest, MixedSyncAndAsyncTest) { |
| 683 context_->SetSyncMode(true); | 683 context_->SetSyncMode(true); |
| 684 context_->SetEatKey(true); | 684 context_->SetEatKey(true); |
| 685 context_->AddCompositionStartAction(); | 685 context_->AddCompositionStartAction(); |
| 686 context_->AddCompositionUpdateAction("a"); | 686 context_->AddCompositionUpdateAction("a"); |
| 687 | 687 |
| 688 scoped_ptr<TextInputClientForTesting> client( | 688 std::unique_ptr<TextInputClientForTesting> client( |
| 689 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 689 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 690 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 690 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 691 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 691 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 692 | 692 |
| 693 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 693 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 694 key_new.set_character(L'a'); | 694 key_new.set_character(L'a'); |
| 695 KeyEvent key = key_new; | 695 KeyEvent key = key_new; |
| 696 input_method_auralinux_->DispatchKeyEvent(&key); | 696 input_method_auralinux_->DispatchKeyEvent(&key); |
| 697 | 697 |
| 698 test_result_->ExpectAction("keydown:229"); | 698 test_result_->ExpectAction("keydown:229"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 719 test_result_->ExpectAction("keydown:65"); | 719 test_result_->ExpectAction("keydown:65"); |
| 720 test_result_->ExpectAction("keypress:99"); | 720 test_result_->ExpectAction("keypress:99"); |
| 721 test_result_->Verify(); | 721 test_result_->Verify(); |
| 722 } | 722 } |
| 723 | 723 |
| 724 TEST_F(InputMethodAuraLinuxTest, ReleaseKeyTest) { | 724 TEST_F(InputMethodAuraLinuxTest, ReleaseKeyTest) { |
| 725 context_->SetSyncMode(true); | 725 context_->SetSyncMode(true); |
| 726 context_->SetEatKey(true); | 726 context_->SetEatKey(true); |
| 727 context_->AddCompositionUpdateAction("a"); | 727 context_->AddCompositionUpdateAction("a"); |
| 728 | 728 |
| 729 scoped_ptr<TextInputClientForTesting> client( | 729 std::unique_ptr<TextInputClientForTesting> client( |
| 730 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); | 730 new TextInputClientForTesting(TEXT_INPUT_TYPE_TEXT)); |
| 731 input_method_auralinux_->SetFocusedTextInputClient(client.get()); | 731 input_method_auralinux_->SetFocusedTextInputClient(client.get()); |
| 732 input_method_auralinux_->OnTextInputTypeChanged(client.get()); | 732 input_method_auralinux_->OnTextInputTypeChanged(client.get()); |
| 733 | 733 |
| 734 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); | 734 KeyEvent key_new(ET_KEY_PRESSED, VKEY_A, 0); |
| 735 key_new.set_character(L'A'); | 735 key_new.set_character(L'A'); |
| 736 KeyEvent key = key_new; | 736 KeyEvent key = key_new; |
| 737 input_method_auralinux_->DispatchKeyEvent(&key); | 737 input_method_auralinux_->DispatchKeyEvent(&key); |
| 738 | 738 |
| 739 test_result_->ExpectAction("keydown:229"); | 739 test_result_->ExpectAction("keydown:229"); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 757 input_method_auralinux_->DispatchKeyEvent(&key); | 757 input_method_auralinux_->DispatchKeyEvent(&key); |
| 758 | 758 |
| 759 test_result_->ExpectAction("textinput:c"); | 759 test_result_->ExpectAction("textinput:c"); |
| 760 test_result_->ExpectAction("keydown:65"); | 760 test_result_->ExpectAction("keydown:65"); |
| 761 test_result_->ExpectAction("keypress:65"); | 761 test_result_->ExpectAction("keypress:65"); |
| 762 test_result_->Verify(); | 762 test_result_->Verify(); |
| 763 } | 763 } |
| 764 | 764 |
| 765 } // namespace | 765 } // namespace |
| 766 } // namespace ui | 766 } // namespace ui |
| OLD | NEW |