| 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 send_tab_insert_text_wait_for_bounds_change(view); | 606 send_tab_insert_text_wait_for_bounds_change(view); |
| 607 } | 607 } |
| 608 | 608 |
| 609 // This test creates a page with multiple child frames and adds an <input> to | 609 // This test creates a page with multiple child frames and adds an <input> to |
| 610 // each frame. Then, sequentially, each <input> is focused by sending a tab key. | 610 // each frame. Then, sequentially, each <input> is focused by sending a tab key. |
| 611 // Then, after |TextInputState.type| for a view is changed to text, the test | 611 // Then, after |TextInputState.type| for a view is changed to text, the test |
| 612 // sends a set composition IPC to the active widget and waits until the widget | 612 // sends a set composition IPC to the active widget and waits until the widget |
| 613 // updates its composition range. | 613 // updates its composition range. |
| 614 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, | 614 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| 615 TrackCompositionRangeForAllFrames) { | 615 TrackCompositionRangeForAllFrames) { |
| 616 // TODO(ekaramd): After IME methods are implemented for WebFrameWidgetImpl, | 616 CreateIframePage("a(b,c(a,b),d)"); |
| 617 // change the page so that it contains child frames as well | 617 std::vector<content::RenderFrameHost*> frames{ |
| 618 // (crbug.com/626746). | 618 GetFrame(IndexVector{}), GetFrame(IndexVector{0}), |
| 619 CreateIframePage("a()"); | 619 GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0}), |
| 620 std::vector<content::RenderFrameHost*> frames{GetFrame(IndexVector{})}; | 620 GetFrame(IndexVector{1, 1}), GetFrame(IndexVector{2})}; |
| 621 std::vector<content::RenderWidgetHostView*> views; | 621 std::vector<content::RenderWidgetHostView*> views; |
| 622 for (auto* frame : frames) | 622 for (auto* frame : frames) |
| 623 views.push_back(frame->GetView()); | 623 views.push_back(frame->GetView()); |
| 624 for (size_t i = 0; i < frames.size(); ++i) | 624 for (size_t i = 0; i < frames.size(); ++i) |
| 625 AddInputFieldToFrame(frames[i], "text", "", true); | 625 AddInputFieldToFrame(frames[i], "text", "text", true); |
| 626 | 626 |
| 627 content::WebContents* web_contents = active_contents(); | 627 content::WebContents* web_contents = active_contents(); |
| 628 | 628 |
| 629 auto send_tab_set_composition_wait_for_bounds_change = | 629 auto send_tab_set_composition_wait_for_bounds_change = [&web_contents]( |
| 630 [&web_contents](content::RenderWidgetHostView* view) { | 630 content::RenderWidgetHostView* view) { |
| 631 ViewTextInputTypeObserver type_observer(web_contents, view, | 631 ViewTextInputTypeObserver type_observer(web_contents, view, |
| 632 ui::TEXT_INPUT_TYPE_TEXT); | 632 ui::TEXT_INPUT_TYPE_TEXT); |
| 633 SimulateKeyPress(web_contents, ui::DomKey::TAB, ui::DomCode::TAB, | 633 SimulateKeyPress(web_contents, ui::DomKey::TAB, ui::DomCode::TAB, |
| 634 ui::VKEY_TAB, false, false, false, false); | 634 ui::VKEY_TAB, false, false, false, false); |
| 635 type_observer.Wait(); | 635 type_observer.Wait(); |
| 636 ViewCompositionRangeChangedObserver range_observer(web_contents, view); | 636 ViewCompositionRangeChangedObserver range_observer(web_contents, view); |
| 637 content::SetCompositionForRenderWidgetHost( | 637 EXPECT_TRUE(content::RequestCompositionInfoFromActiveWidget(web_contents)); |
| 638 view->GetRenderWidgetHost(), base::ASCIIToUTF16("text"), | 638 range_observer.Wait(); |
| 639 {ui::CompositionUnderline()}, gfx::Range::InvalidRange(), 0, 0); | 639 }; |
| 640 range_observer.Wait(); | |
| 641 }; | |
| 642 | 640 |
| 643 for (auto* view : views) | 641 for (auto* view : views) |
| 644 send_tab_set_composition_wait_for_bounds_change(view); | 642 send_tab_set_composition_wait_for_bounds_change(view); |
| 645 } | 643 } |
| 646 | 644 |
| 647 // This test creates a page with multiple child frames and adds an <input> to | 645 // This test creates a page with multiple child frames and adds an <input> to |
| 648 // each frame. Then, sequentially, each <input> is focused by sending a tab key. | 646 // each frame. Then, sequentially, each <input> is focused by sending a tab key. |
| 649 // After focusing each input, a sequence of key presses (character 'E') are sent | 647 // After focusing each input, a sequence of key presses (character 'E') are sent |
| 650 // to the focused widget and then the whole text is selected using Ctrl+A. The | 648 // to the focused widget and then the whole text is selected using Ctrl+A. The |
| 651 // test then verifies that the selection length equals the length of the | 649 // test then verifies that the selection length equals the length of the |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 857 |
| 860 // Set |TextInputState.show_ime_if_needed|. Expect IME. | 858 // Set |TextInputState.show_ime_if_needed|. Expect IME. |
| 861 sender.SetShowImeIfNeeded(true); | 859 sender.SetShowImeIfNeeded(true); |
| 862 EXPECT_TRUE(send_and_check_show_ime()); | 860 EXPECT_TRUE(send_and_check_show_ime()); |
| 863 | 861 |
| 864 // Set |TextInputState.type| to ui::TEXT_INPUT_TYPE_NONE. Expect no IME. | 862 // Set |TextInputState.type| to ui::TEXT_INPUT_TYPE_NONE. Expect no IME. |
| 865 sender.SetType(ui::TEXT_INPUT_TYPE_NONE); | 863 sender.SetType(ui::TEXT_INPUT_TYPE_NONE); |
| 866 EXPECT_FALSE(send_and_check_show_ime()); | 864 EXPECT_FALSE(send_and_check_show_ime()); |
| 867 } | 865 } |
| 868 #endif // USE_AURA | 866 #endif // USE_AURA |
| OLD | NEW |