Chromium Code Reviews| Index: chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc |
| diff --git a/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc b/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc |
| index 8950f6056b3ee81d32bb519614442893a0688a86..9c816a1094db46cd3122d9197d79c9da181ca5d6 100644 |
| --- a/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc |
| +++ b/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc |
| @@ -602,53 +602,11 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| send_tab_set_composition_wait_for_bounds_change(view); |
| } |
| -// TODO(ekaramad): Enable the following tests on other platforms when the |
| -// corresponding feature is implemented (http://crbug.com/578168). |
| -#if defined(USE_AURA) |
| -// This test creates a page with multiple child frames and adds an <input> to |
| -// each frame. Then, sequentially, each <input> is focused by sending a tab key. |
| -// Then, after |TextInputState.type| for a view is changed to text, another key |
| -// is pressed (a character) and then the test verifies that TextInputManager |
| -// receives the corresponding update on the change in selection bounds on the |
| -// browser side. |
| -IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| - TrackSelectionBoundsForAllFrames) { |
| - CreateIframePage("a(b,c(a,b),d)"); |
| - std::vector<content::RenderFrameHost*> frames{ |
| - GetFrame(IndexVector{}), GetFrame(IndexVector{0}), |
| - GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0}), |
| - GetFrame(IndexVector{1, 1}), GetFrame(IndexVector{2})}; |
| - std::vector<content::RenderWidgetHostView*> views; |
| - for (auto* frame : frames) |
| - views.push_back(frame->GetView()); |
| - for (size_t i = 0; i < frames.size(); ++i) |
| - AddInputFieldToFrame(frames[i], "text", "", true); |
| - |
| - content::WebContents* web_contents = active_contents(); |
| - |
| - auto send_tab_insert_text_wait_for_bounds_change = [&web_contents]( |
| - content::RenderWidgetHostView* view) { |
|
EhsanK
2016/08/17 21:36:00
This test is just copied over (actually not copied
|
| - ViewTextInputTypeObserver type_observer(web_contents, view, |
| - ui::TEXT_INPUT_TYPE_TEXT); |
| - SimulateKeyPress(web_contents, ui::DomKey::TAB, ui::DomCode::TAB, |
| - ui::VKEY_TAB, false, false, false, false); |
| - type_observer.Wait(); |
| - ViewSelectionBoundsChangedObserver bounds_observer(web_contents, view); |
| - SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('E'), |
| - ui::DomCode::US_E, ui::VKEY_E, false, false, false, false); |
| - bounds_observer.Wait(); |
| - }; |
| - |
| - for (auto* view : views) |
| - send_tab_insert_text_wait_for_bounds_change(view); |
| -} |
| - |
| // This test creates a page with multiple child frames and adds an <input> to |
| // each frame. Then, sequentially, each <input> is focused by sending a tab key. |
| // After focusing each input, a sequence of key presses (character 'E') are sent |
| -// to the focused widget and then the whole text is selected using Ctrl+A. The |
| -// test then verifies that the selection length equals the length of the |
| -// sequence of 'E's. |
| +// to the focused widget. The test then verifies that the selection length |
| +// equals the length of the sequence of 'E's. |
| IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| TrackTextSelectionForAllFrames) { |
| CreateIframePage("a(b,c(a,b),d)"); |
| @@ -680,9 +638,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| ui::DomCode::US_E, ui::VKEY_E, false, false, false, |
| false); |
| } |
| - // Send Ctrl+A to select the whole text. |
| - SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('a'), |
| - ui::DomCode::US_A, ui::VKEY_A, true, false, false, false); |
|
EhsanK
2016/08/17 21:36:00
This was removed since it was not needed nor corre
|
| observer.Wait(); |
| }; |
| @@ -697,6 +652,47 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| } |
| } |
| +// TODO(ekaramad): Enable the following tests on other platforms when the |
|
sky
2016/08/17 20:42:52
Is there a compelling reason to move the test here
EhsanK
2016/08/17 21:36:00
Sorry for the ugly diff. Hmmm...actually, the inte
sky
2016/08/17 23:32:47
Any chance you could add ifdefs instead? Again, it
EhsanK
2016/08/18 14:43:29
Done (assuming that I understood the suggestion co
|
| +// corresponding feature is implemented (http://crbug.com/578168). |
| +#if defined(USE_AURA) |
| +// This test creates a page with multiple child frames and adds an <input> to |
| +// each frame. Then, sequentially, each <input> is focused by sending a tab key. |
| +// Then, after |TextInputState.type| for a view is changed to text, another key |
| +// is pressed (a character) and then the test verifies that TextInputManager |
| +// receives the corresponding update on the change in selection bounds on the |
| +// browser side. |
| +IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |
| + TrackSelectionBoundsForAllFrames) { |
| + CreateIframePage("a(b,c(a,b),d)"); |
| + std::vector<content::RenderFrameHost*> frames{ |
| + GetFrame(IndexVector{}), GetFrame(IndexVector{0}), |
| + GetFrame(IndexVector{1}), GetFrame(IndexVector{1, 0}), |
| + GetFrame(IndexVector{1, 1}), GetFrame(IndexVector{2})}; |
| + std::vector<content::RenderWidgetHostView*> views; |
| + for (auto* frame : frames) |
| + views.push_back(frame->GetView()); |
| + for (size_t i = 0; i < frames.size(); ++i) |
| + AddInputFieldToFrame(frames[i], "text", "", true); |
| + |
| + content::WebContents* web_contents = active_contents(); |
| + |
| + auto send_tab_insert_text_wait_for_bounds_change = [&web_contents]( |
| + content::RenderWidgetHostView* view) { |
| + ViewTextInputTypeObserver type_observer(web_contents, view, |
| + ui::TEXT_INPUT_TYPE_TEXT); |
| + SimulateKeyPress(web_contents, ui::DomKey::TAB, ui::DomCode::TAB, |
| + ui::VKEY_TAB, false, false, false, false); |
| + type_observer.Wait(); |
| + ViewSelectionBoundsChangedObserver bounds_observer(web_contents, view); |
| + SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('E'), |
| + ui::DomCode::US_E, ui::VKEY_E, false, false, false, false); |
| + bounds_observer.Wait(); |
| + }; |
| + |
| + for (auto* view : views) |
| + send_tab_insert_text_wait_for_bounds_change(view); |
| +} |
| + |
| // The following test verifies that when the active widget changes value, it is |
| // always from nullptr to non-null or vice versa. |
| IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest, |