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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc

Issue 2732913005: <webview>: Add test to confirm the TAB key will escape the view. (Closed)
Patch Set: rebase (focus controller change in ToT) Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, 711 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest,
712 Focus_FocusBeforeNavigation) { 712 Focus_FocusBeforeNavigation) {
713 TestHelper("testFocusBeforeNavigation", "web_view/focus", NO_TEST_SERVER); 713 TestHelper("testFocusBeforeNavigation", "web_view/focus", NO_TEST_SERVER);
714 } 714 }
715 715
716 // Tests that setting focus on the <webview> sets focus on the guest. 716 // Tests that setting focus on the <webview> sets focus on the guest.
717 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusEvent) { 717 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusEvent) {
718 TestHelper("testFocusEvent", "web_view/focus", NO_TEST_SERVER); 718 TestHelper("testFocusEvent", "web_view/focus", NO_TEST_SERVER);
719 } 719 }
720 720
721 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusTakeFocus) {
722 TestHelper("testFocusTakeFocus", "web_view/focus", NO_TEST_SERVER);
723
724 // Compute where to click in the window to focus the guest input box.
725 int clickX, clickY;
726 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
727 embedder_web_contents(),
728 "domAutomationController.send(Math.floor(window.clickX));", &clickX));
729 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
730 embedder_web_contents(),
731 "domAutomationController.send(Math.floor(window.clickY));", &clickY));
732
733 ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
734 next_step_listener.set_failure_message("TEST_STEP_FAILED");
735 content::SimulateMouseClickAt(
736 (GetParam() ? guest_web_contents() : embedder_web_contents()), 0,
737 blink::WebMouseEvent::Button::kLeft, gfx::Point(clickX, clickY));
738 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied());
739
740 // TAB back out to the embedder's input.
741 next_step_listener.Reset();
742 content::SimulateKeyPress(embedder_web_contents(), ui::DomKey::TAB,
743 ui::DomCode::TAB, ui::VKEY_TAB, false, false, false,
744 false);
745 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied());
746 }
747
721 // Flaky on Mac and Linux - https://crbug.com/707648 748 // Flaky on Mac and Linux - https://crbug.com/707648
722 #if defined(OS_MACOSX) || defined(OS_LINUX) 749 #if defined(OS_MACOSX) || defined(OS_LINUX)
723 #define MAYBE_Focus_FocusTracksEmbedder DISABLED_Focus_FocusTracksEmbedder 750 #define MAYBE_Focus_FocusTracksEmbedder DISABLED_Focus_FocusTracksEmbedder
724 #else 751 #else
725 #define MAYBE_Focus_FocusTracksEmbedder Focus_FocusTracksEmbedder 752 #define MAYBE_Focus_FocusTracksEmbedder Focus_FocusTracksEmbedder
726 #endif 753 #endif
727 754
728 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, 755 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest,
729 MAYBE_Focus_FocusTracksEmbedder) { 756 MAYBE_Focus_FocusTracksEmbedder) {
730 content::WebContents* embedder_web_contents = NULL; 757 content::WebContents* embedder_web_contents = NULL;
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 // Get the input value from the guest. 1690 // Get the input value from the guest.
1664 value.clear(); 1691 value.clear();
1665 ASSERT_TRUE(ExecuteScriptAndExtractString(guest_web_contents, 1692 ASSERT_TRUE(ExecuteScriptAndExtractString(guest_web_contents,
1666 "window.domAutomationController." 1693 "window.domAutomationController."
1667 "send(document.querySelector('" 1694 "send(document.querySelector('"
1668 "input').value)", 1695 "input').value)",
1669 &value)); 1696 &value));
1670 EXPECT_EQ("A B C D", value); 1697 EXPECT_EQ("A B C D", value);
1671 } 1698 }
1672 #endif // OS_MACOSX 1699 #endif // OS_MACOSX
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698