| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 SimulateKeyPress(active_contents(), ui::DomKey::TAB, ui::DomCode::TAB, | 559 SimulateKeyPress(active_contents(), ui::DomKey::TAB, ui::DomCode::TAB, |
| 560 ui::VKEY_TAB, false, false, false, false); | 560 ui::VKEY_TAB, false, false, false, false); |
| 561 set_state_observer.Wait(); | 561 set_state_observer.Wait(); |
| 562 | 562 |
| 563 TextInputManagerTypeObserver reset_state_observer(active_contents(), | 563 TextInputManagerTypeObserver reset_state_observer(active_contents(), |
| 564 ui::TEXT_INPUT_TYPE_NONE); | 564 ui::TEXT_INPUT_TYPE_NONE); |
| 565 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 565 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 566 reset_state_observer.Wait(); | 566 reset_state_observer.Wait(); |
| 567 } | 567 } |
| 568 | 568 |
| 569 // TODO(ekaramad): Enable the following tests on other platforms when the | |
| 570 // corresponding feature is implemented (http://crbug.com/578168). | |
| 571 #if defined(USE_AURA) | |
| 572 // This test creates a page with multiple child frames and adds an <input> to | 569 // This test creates a page with multiple child frames and adds an <input> to |
| 573 // each frame. Then, sequentially, each <input> is focused by sending a tab key. | 570 // each frame. Then, sequentially, each <input> is focused by sending a tab key. |
| 574 // Then, after |TextInputState.type| for a view is changed to text, another key | 571 // Then, after |TextInputState.type| for a view is changed to text, another key |
| 575 // is pressed (a character) and then the test verifies that TextInputManager | 572 // is pressed (a character) and then the test verifies that TextInputManager |
| 576 // receives the corresponding update on the change in selection bounds on the | 573 // receives the corresponding update on the change in selection bounds on the |
| 577 // browser side. | 574 // browser side. |
| 578 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, | 575 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| 579 TrackSelectionBoundsForAllFrames) { | 576 TrackSelectionBoundsForAllFrames) { |
| 580 CreateIframePage("a(b,c(a,b),d)"); | 577 CreateIframePage("a(b,c(a,b),d)"); |
| 581 std::vector<content::RenderFrameHost*> frames{ | 578 std::vector<content::RenderFrameHost*> frames{ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 600 ViewSelectionBoundsChangedObserver bounds_observer(web_contents, view); | 597 ViewSelectionBoundsChangedObserver bounds_observer(web_contents, view); |
| 601 SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('E'), | 598 SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('E'), |
| 602 ui::DomCode::US_E, ui::VKEY_E, false, false, false, false); | 599 ui::DomCode::US_E, ui::VKEY_E, false, false, false, false); |
| 603 bounds_observer.Wait(); | 600 bounds_observer.Wait(); |
| 604 }; | 601 }; |
| 605 | 602 |
| 606 for (auto* view : views) | 603 for (auto* view : views) |
| 607 send_tab_insert_text_wait_for_bounds_change(view); | 604 send_tab_insert_text_wait_for_bounds_change(view); |
| 608 } | 605 } |
| 609 | 606 |
| 607 // TODO(ekaramad): Enable the following tests on other platforms when the |
| 608 // corresponding feature is implemented (http://crbug.com/578168). |
| 609 #if defined(USE_AURA) |
| 610 // This test creates a page with multiple child frames and adds an <input> to | 610 // This test creates a page with multiple child frames and adds an <input> to |
| 611 // each frame. Then, sequentially, each <input> is focused by sending a tab key. | 611 // each frame. Then, sequentially, each <input> is focused by sending a tab key. |
| 612 // Then, after |TextInputState.type| for a view is changed to text, the test | 612 // Then, after |TextInputState.type| for a view is changed to text, the test |
| 613 // sends a set composition IPC to the active widget and waits until the widget | 613 // sends a set composition IPC to the active widget and waits until the widget |
| 614 // updates its composition range. | 614 // updates its composition range. |
| 615 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, | 615 IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| 616 TrackCompositionRangeForAllFrames) { | 616 TrackCompositionRangeForAllFrames) { |
| 617 // TODO(ekaramd): After IME methods are implemented for WebFrameWidgetImpl, | 617 // TODO(ekaramd): After IME methods are implemented for WebFrameWidgetImpl, |
| 618 // change the page so that it contains child frames as well | 618 // change the page so that it contains child frames as well |
| 619 // (crbug.com/626746). | 619 // (crbug.com/626746). |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 841 |
| 842 // Set |TextInputState.show_ime_if_needed|. Expect IME. | 842 // Set |TextInputState.show_ime_if_needed|. Expect IME. |
| 843 sender.SetShowImeIfNeeded(true); | 843 sender.SetShowImeIfNeeded(true); |
| 844 EXPECT_TRUE(send_and_check_show_ime()); | 844 EXPECT_TRUE(send_and_check_show_ime()); |
| 845 | 845 |
| 846 // Set |TextInputState.type| to ui::TEXT_INPUT_TYPE_NONE. Expect no IME. | 846 // Set |TextInputState.type| to ui::TEXT_INPUT_TYPE_NONE. Expect no IME. |
| 847 sender.SetType(ui::TEXT_INPUT_TYPE_NONE); | 847 sender.SetType(ui::TEXT_INPUT_TYPE_NONE); |
| 848 EXPECT_FALSE(send_and_check_show_ime()); | 848 EXPECT_FALSE(send_and_check_show_ime()); |
| 849 } | 849 } |
| 850 #endif // USE_AURA | 850 #endif // USE_AURA |
| OLD | NEW |