Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc

Issue 1889313002: Revert of Browser Side Text Input State Tracking for OOPIF (Manual). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/text_input_state/background.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
index 2d9079183e2dffcbee97cfa0170622eba1a755c3..dc903ea558ab1c9795256f42be6f6345f56cb6fe 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -51,42 +51,6 @@ using guest_view::GuestViewManager;
using guest_view::TestGuestViewManager;
using guest_view::TestGuestViewManagerFactory;
-namespace {
-// A helper class which polls the text input state of the given WebContents.
-class TextInputStateHelper {
- public:
- using Predicate =
- base::Callback<bool(const content::TextInputStateTestExport&)>;
-
- static void WaitForDesiredState(content::WebContents* web_contents,
- const Predicate& predicate) {
- content::TextInputStateTestExport state =
- content::TextInputStateTestExport::FromWebContents(web_contents);
- while (!predicate.Run(state)) {
- scoped_refptr<content::MessageLoopRunner> loop =
- new content::MessageLoopRunner();
- content::BrowserThread::PostDelayedTask(
- content::BrowserThread::UI, FROM_HERE, loop->QuitClosure(),
- base::TimeDelta::FromMilliseconds(100LL));
- loop->Run();
- state = content::TextInputStateTestExport::FromWebContents(web_contents);
- }
- }
-
- static bool IsStateOfGivenType(
- ui::TextInputType type,
- const content::TextInputStateTestExport& state) {
- return type == state.type();
- }
-
- static bool HasGivenValue(const std::string& value,
- const content::TextInputStateTestExport& state) {
- return value == state.value();
- }
-};
-
-} // namespace
-
class WebViewInteractiveTestBase : public extensions::PlatformAppBrowserTest {
public:
WebViewInteractiveTestBase()
@@ -547,9 +511,6 @@ class WebViewPopupInteractiveTest : public WebViewInteractiveTestBase {};
class WebViewContextMenuInteractiveTest : public WebViewInteractiveTestBase {};
class WebViewPointerLockInteractiveTest : public WebViewInteractiveTestBase {};
class WebViewDragDropInteractiveTest : public WebViewInteractiveTestBase {};
-// TODO(ekaramad): The following tests fail of OOPIF due to focus issues.
-// see crbug.com/61060.
-class WebViewTextInputStateInteractiveTest : public WebViewInteractiveTest {};
INSTANTIATE_TEST_CASE_P(WebViewInteractiveTests,
WebViewInteractiveTest,
@@ -559,10 +520,6 @@ INSTANTIATE_TEST_CASE_P(WebViewInteractiveTests,
WebViewNewWindowInteractiveTest,
testing::Bool());
-INSTANTIATE_TEST_CASE_P(WebViewInteractiveTests,
- WebViewTextInputStateInteractiveTest,
- testing::Values(false));
-
// ui_test_utils::SendMouseMoveSync doesn't seem to work on OS_MACOSX, and
// likely won't work on many other platforms as well, so for now this test
// is for Windows and Linux only. As of Sept 17th, 2013 this test is disabled
@@ -1375,110 +1332,3 @@ IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, FocusAndVisibility) {
SendMessageToEmbedder("verify");
EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied());
}
-
-// TODO(crbug.com/602954) Test is flaky.
-#if defined(OS_WIN) || defined(OS_MACOSX)
-#define MAYBE_TopLevelWebContentsTracksCorrectly \
- DISABLED_TopLevelWebContentsTracksCorrectly
-#else
-#define MAYBE_TopLevelWebContentsTracksCorrectly \
- TopLevelWebContentsTracksCorrectly
-#endif
-IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
- MAYBE_TopLevelWebContentsTracksCorrectly) {
- SetupTest("web_view/text_input_state",
- "/extensions/platform_apps/web_view/text_input_state/guest.html");
-
- auto press_tab_to_focus = [](WebViewTextInputStateInteractiveTest* test,
- const std::string& message) {
- ExtensionTestMessageListener listener(message, false);
- test->SendKeyPressToPlatformApp(ui::VKEY_TAB);
- listener.WaitUntilSatisfied();
- };
-
- auto get_type_checker = [](ui::TextInputType target) {
- return base::Bind(&TextInputStateHelper::IsStateOfGivenType, target);
- };
-
- // Press the tab key. The <input> in the embedder should get focused.
- // Top level state type should be number.
- press_tab_to_focus(this, "EMBEDDER-FOCUSED-1");
- TextInputStateHelper::WaitForDesiredState(
- embedder_web_contents(), get_type_checker(ui::TEXT_INPUT_TYPE_NUMBER));
-
- // Press the tab key again and the <input> inside <webview> gets focused. The
- // input type should text now.
- press_tab_to_focus(this, "GUEST-FOCUSED");
- TextInputStateHelper::WaitForDesiredState(
- embedder_web_contents(), get_type_checker(ui::TEXT_INPUT_TYPE_TEXT));
-
- // Press the tab key one more time to get back to embedder's second <input>.
- // The value should be "last one".
- press_tab_to_focus(this, "EMBEDDER-FOCUSED-2");
- TextInputStateHelper::WaitForDesiredState(
- embedder_web_contents(),
- base::Bind(&TextInputStateHelper::HasGivenValue, "last one"));
-}
-
-IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
- CrashingWebViewResetsState) {
- SetupTest("web_view/text_input_state",
- "/extensions/platform_apps/web_view/text_input_state/guest.html");
-
- // Press tab key twice to end up in the <input> of the <webview>.
- ExtensionTestMessageListener listener("GUEST-FOCUSED", false);
- for (size_t i = 0; i < 2; ++i)
- SendKeyPressToPlatformApp(ui::VKEY_TAB);
-
- listener.WaitUntilSatisfied();
-
- // Now wait for a text input state change.
- TextInputStateHelper::WaitForDesiredState(
- embedder_web_contents(),
- base::Bind(&TextInputStateHelper::HasGivenValue, "guest"));
-
- // Now crash the <webview>.
- guest_web_contents()->GetRenderProcessHost()->Shutdown(false, 0);
-
- // Wait for the outer WebContentsImpl |text_input_state_->type| to be reset to
- // none.
- TextInputStateHelper::WaitForDesiredState(
- embedder_web_contents(),
- base::Bind(&TextInputStateHelper::IsStateOfGivenType,
- ui::TEXT_INPUT_TYPE_NONE));
-}
-
-// This test creates a <webview> with a text input field inside, gives focus to
-// the input field, and then detaches the <webview>. It monitors the embedder
-// WebContents text input state to make sure it tracks the state properly.
-IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
- OuterWebContentsResetsStateAfterDetach) {
- SetupTest("web_view/text_input_state",
- "/extensions/platform_apps/web_view/text_input_state/guest.html");
-
- // Press tab key twice to end up in the <input> of the <webview>.
- ExtensionTestMessageListener listener("GUEST-FOCUSED", false);
- for (size_t i = 0; i < 2; ++i)
- SendKeyPressToPlatformApp(ui::VKEY_TAB);
-
- listener.WaitUntilSatisfied();
-
- // Now wait for a text input state change.
- TextInputStateHelper::WaitForDesiredState(
- embedder_web_contents(),
- base::Bind(&TextInputStateHelper::HasGivenValue, "guest"));
-
- // Now detach the <webview>.
- ExtensionTestMessageListener detach_listener("detached", false);
- detach_listener.set_failure_message("failed-to-detach");
- EXPECT_TRUE(
- content::ExecuteScript(embedder_web_contents(), "detachWebView();"));
- detach_listener.WaitUntilSatisfied();
-
- // Wait for the outer WebContentsImpl |text_input_state_->type| to be reset to
- // none.
- TextInputStateHelper::WaitForDesiredState(
- embedder_web_contents(),
- base::Bind(&TextInputStateHelper::IsStateOfGivenType,
- ui::TEXT_INPUT_TYPE_NONE));
-}
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/text_input_state/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698