| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 for (size_t i = 0; i < views.size(); ++i) { | 683 for (size_t i = 0; i < views.size(); ++i) { |
| 684 // First focus the <input>. | 684 // First focus the <input>. |
| 685 send_tab_and_wait_for_value(values[i]); | 685 send_tab_and_wait_for_value(values[i]); |
| 686 | 686 |
| 687 // Send a sequence of |count| 'E' keys and wait until the view receives a | 687 // Send a sequence of |count| 'E' keys and wait until the view receives a |
| 688 // selection change update for a text of the corresponding size, |count|. | 688 // selection change update for a text of the corresponding size, |count|. |
| 689 send_keys_select_all_wait_for_selection_change(views[i], count++); | 689 send_keys_select_all_wait_for_selection_change(views[i], count++); |
| 690 } | 690 } |
| 691 } | 691 } |
| 692 | 692 |
| 693 // TODO(ekaramad): Enable the following tests on other platforms when the | |
| 694 // corresponding feature is implemented (http://crbug.com/578168). | |
| 695 #if defined(USE_AURA) | |
| 696 // The following test verifies that when the active widget changes value, it is | 693 // The following test verifies that when the active widget changes value, it is |
| 697 // always from nullptr to non-null or vice versa. | 694 // always from nullptr to non-null or vice versa. |
| 698 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, | 695 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| 699 ResetTextInputStateOnActiveWidgetChange) { | 696 ResetTextInputStateOnActiveWidgetChange) { |
| 700 CreateIframePage("a(b,c(a,b),d)"); | 697 CreateIframePage("a(b,c(a,b),d)"); |
| 701 std::vector<content::RenderFrameHost*> frames{ | 698 std::vector<content::RenderFrameHost*> frames{ |
| 702 GetFrame(IndexVector{}), GetFrame(IndexVector{0}), | 699 GetFrame(IndexVector{}), GetFrame(IndexVector{0}), |
| 703 GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0}), | 700 GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0}), |
| 704 GetFrame(IndexVector{1, 1}), GetFrame(IndexVector{2})}; | 701 GetFrame(IndexVector{1, 1}), GetFrame(IndexVector{2})}; |
| 705 std::vector<content::RenderWidgetHostView*> views; | 702 std::vector<content::RenderWidgetHostView*> views; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 recorder.active_views()->at(i + 1U); | 734 recorder.active_views()->at(i + 1U); |
| 738 EXPECT_TRUE((current != nullptr && next == nullptr) || | 735 EXPECT_TRUE((current != nullptr && next == nullptr) || |
| 739 (current == nullptr && next != nullptr)); | 736 (current == nullptr && next != nullptr)); |
| 740 } | 737 } |
| 741 } | 738 } |
| 742 | 739 |
| 743 // TODO(ekaramad): The following tests are specifically written for Aura and are | 740 // TODO(ekaramad): The following tests are specifically written for Aura and are |
| 744 // based on InputMethodObserver. Write similar tests for Mac/Android/Mus | 741 // based on InputMethodObserver. Write similar tests for Mac/Android/Mus |
| 745 // (crbug.com/602723). | 742 // (crbug.com/602723). |
| 746 | 743 |
| 744 #if defined(USE_AURA) |
| 747 // ----------------------------------------------------------------------------- | 745 // ----------------------------------------------------------------------------- |
| 748 // Input Method Observer Tests | 746 // Input Method Observer Tests |
| 749 // | 747 // |
| 750 // The following tests will make use of the InputMethodObserver to verify that | 748 // The following tests will make use of the InputMethodObserver to verify that |
| 751 // OOPIF pages interact properly with the InputMethod through the tab's view. | 749 // OOPIF pages interact properly with the InputMethod through the tab's view. |
| 752 | 750 |
| 753 // TODO(ekaramad): We only have coverage for some aura tests as the whole idea | 751 // TODO(ekaramad): We only have coverage for some aura tests as the whole idea |
| 754 // of ui::TextInputClient/ui::InputMethod/ui::InputMethodObserver seems to be | 752 // of ui::TextInputClient/ui::InputMethod/ui::InputMethodObserver seems to be |
| 755 // only fit to aura (specifically, OS_CHROMEOS). Can we add more tests here for | 753 // only fit to aura (specifically, OS_CHROMEOS). Can we add more tests here for |
| 756 // aura as well as other platforms (https://crbug.com/602723)? | 754 // aura as well as other platforms (https://crbug.com/602723)? |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 | 852 |
| 855 // Set |TextInputState.show_ime_if_needed|. Expect IME. | 853 // Set |TextInputState.show_ime_if_needed|. Expect IME. |
| 856 sender.SetShowImeIfNeeded(true); | 854 sender.SetShowImeIfNeeded(true); |
| 857 EXPECT_TRUE(send_and_check_show_ime()); | 855 EXPECT_TRUE(send_and_check_show_ime()); |
| 858 | 856 |
| 859 // Set |TextInputState.type| to ui::TEXT_INPUT_TYPE_NONE. Expect no IME. | 857 // Set |TextInputState.type| to ui::TEXT_INPUT_TYPE_NONE. Expect no IME. |
| 860 sender.SetType(ui::TEXT_INPUT_TYPE_NONE); | 858 sender.SetType(ui::TEXT_INPUT_TYPE_NONE); |
| 861 EXPECT_FALSE(send_and_check_show_ime()); | 859 EXPECT_FALSE(send_and_check_show_ime()); |
| 862 } | 860 } |
| 863 #endif // USE_AURA | 861 #endif // USE_AURA |
| OLD | NEW |