| 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 16e72bf11b4f123970c4be0bcdb0ebea3bca37c2..d4cb8d2b6d103e9cac5877c85f8b235306dbaa15 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
|
| @@ -38,11 +38,6 @@
|
| #include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h"
|
| #endif
|
|
|
| -// TODO(ekaramad): The following tests should be active on all platforms. After
|
| -// fixing https://crbug.com/578168, this test file should be built for android
|
| -// as well and most of the following tests should be enabled for all platforms
|
| -//(https://crbug.com/602723).
|
| -
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // TextInputManager and IME Tests
|
| //
|
| @@ -643,6 +638,57 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
|
| reset_state_observer.Wait();
|
| }
|
|
|
| +// 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,
|
| + ResetTextInputStateOnActiveWidgetChange) {
|
| + 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());
|
| + std::vector<std::string> values{"a", "ab", "ac", "aca", "acb", "acd"};
|
| + for (size_t i = 0; i < frames.size(); ++i)
|
| + AddInputFieldToFrame(frames[i], "text", values[i], true);
|
| +
|
| + content::WebContents* web_contents = active_contents();
|
| +
|
| + auto send_tab_and_wait_for_value =
|
| + [&web_contents](const std::string& expected_value) {
|
| + TextInputManagerValueObserver observer(web_contents, expected_value);
|
| + SimulateKeyPress(web_contents, ui::DomKey::TAB, ui::DomCode::TAB,
|
| + ui::VKEY_TAB, false, false, false, false);
|
| + observer.Wait();
|
| + };
|
| +
|
| + // Record all active view changes.
|
| + RecordActiveViewsObserver recorder(web_contents);
|
| + for (auto value : values)
|
| + send_tab_and_wait_for_value(value);
|
| +
|
| + // We have covered a total of 6 views, so there should at least be 11 entries
|
| + // recorded (at least one null between two views).
|
| + size_t record_count = recorder.active_views()->size();
|
| + EXPECT_GT(record_count, 10U);
|
| +
|
| + // Verify we do not have subsequent nullptr or non-nullptrs.
|
| + for (size_t i = 0; i < record_count - 1U; ++i) {
|
| + const content::RenderWidgetHostView* current =
|
| + recorder.active_views()->at(i);
|
| + const content::RenderWidgetHostView* next =
|
| + recorder.active_views()->at(i + 1U);
|
| + EXPECT_TRUE((current != nullptr && next == nullptr) ||
|
| + (current == nullptr && next != nullptr));
|
| + }
|
| +}
|
| +
|
| +// TODO(ekaramad): Some of the following tests should be active on Android as
|
| +// well. Enable them when the corresponding feature is implemented for Android
|
| +// (https://crbug.com/602723).
|
| +#if !defined(OS_ANDROID)
|
| // 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, the test
|
| @@ -801,57 +847,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
|
| }
|
| }
|
|
|
| -// 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,
|
| - ResetTextInputStateOnActiveWidgetChange) {
|
| - 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());
|
| - std::vector<std::string> values{"a", "ab", "ac", "aca", "acb", "acd"};
|
| - for (size_t i = 0; i < frames.size(); ++i)
|
| - AddInputFieldToFrame(frames[i], "text", values[i], true);
|
| -
|
| - content::WebContents* web_contents = active_contents();
|
| -
|
| - auto send_tab_and_wait_for_value =
|
| - [&web_contents](const std::string& expected_value) {
|
| - TextInputManagerValueObserver observer(web_contents, expected_value);
|
| - SimulateKeyPress(web_contents, ui::DomKey::TAB, ui::DomCode::TAB,
|
| - ui::VKEY_TAB, false, false, false, false);
|
| - observer.Wait();
|
| - };
|
| -
|
| - // Record all active view changes.
|
| - RecordActiveViewsObserver recorder(web_contents);
|
| - for (auto value : values)
|
| - send_tab_and_wait_for_value(value);
|
| -
|
| - // We have covered a total of 6 views, so there should at least be 11 entries
|
| - // recorded (at least one null between two views).
|
| - size_t record_count = recorder.active_views()->size();
|
| - EXPECT_GT(record_count, 10U);
|
| -
|
| - // Verify we do not have subsequent nullptr or non-nullptrs.
|
| - for (size_t i = 0; i < record_count - 1U; ++i) {
|
| - const content::RenderWidgetHostView* current =
|
| - recorder.active_views()->at(i);
|
| - const content::RenderWidgetHostView* next =
|
| - recorder.active_views()->at(i + 1U);
|
| - EXPECT_TRUE((current != nullptr && next == nullptr) ||
|
| - (current == nullptr && next != nullptr));
|
| - }
|
| -}
|
|
|
| // TODO(ekaramad): The following tests are specifically written for Aura and are
|
| // based on InputMethodObserver. Write similar tests for Mac/Android/Mus
|
| // (crbug.com/602723).
|
| -
|
| #if defined(USE_AURA)
|
| // -----------------------------------------------------------------------------
|
| // Input Method Observer Tests
|
| @@ -1228,4 +1227,5 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessTextInputManagerTest,
|
| // For the cleanup of the original WebContents in tab index 0.
|
| content::SetBrowserClientForTesting(old_browser_client);
|
| }
|
| -#endif
|
| +#endif // defined(MAC_OSX)
|
| +#endif // !defined(OS_ANDROID)
|
|
|