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

Unified Diff: chrome/browser/extensions/web_view_interactive_browsertest.cc

Issue 15149006: <webview>: Plumb edit commands (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed fprintf Created 7 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 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/edit_commands_no_menu/embedder.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/web_view_interactive_browsertest.cc
diff --git a/chrome/browser/extensions/web_view_interactive_browsertest.cc b/chrome/browser/extensions/web_view_interactive_browsertest.cc
index bffd0eec037fbeefed4f8f159a0c99f1e695ff6f..315d923ac3413fd2dde336d4979d01e49774e4d1 100644
--- a/chrome/browser/extensions/web_view_interactive_browsertest.cc
+++ b/chrome/browser/extensions/web_view_interactive_browsertest.cc
@@ -73,6 +73,18 @@ class WebViewInteractiveTest
#endif
}
+ void SendStartOfLineKeyPressToPlatformApp() {
+#if defined(OS_MACOSX)
+ // Send Cmd+Left on MacOSX.
+ ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
+ GetPlatformAppWindow(), ui::VKEY_LEFT, false, false, false, true));
+#else
+ // Send Ctrl+Left on Windows and Linux/ChromeOS.
+ ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
+ GetPlatformAppWindow(), ui::VKEY_LEFT, true, false, false, false));
+#endif
+ }
+
void SendMouseEvent(ui_controls::MouseButton button,
ui_controls::MouseButtonState state) {
if (first_click_) {
@@ -347,10 +359,29 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, EditCommands) {
ExtensionTestMessageListener copy_listener("copy", false);
SendCopyKeyPressToPlatformApp();
+
// Wait for the guest to receive a 'copy' edit command.
ASSERT_TRUE(copy_listener.WaitUntilSatisfied());
}
+// Tests that guests receive edit commands and respond appropriately.
+IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, EditCommandsNoMenu) {
+ SetupTest("web_view/edit_commands_no_menu",
+ "files/extensions/platform_apps/web_view/edit_commands_no_menu/"
+ "guest.html");
+
+ ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
+ GetPlatformAppWindow()));
+
+ // Flush any pending events to make sure we start with a clean slate.
+ content::RunAllPendingInMessageLoop();
+
+ ExtensionTestMessageListener start_of_line_listener("StartOfLine", false);
+ SendStartOfLineKeyPressToPlatformApp();
+ // Wait for the guest to receive a 'copy' edit command.
+ ASSERT_TRUE(start_of_line_listener.WaitUntilSatisfied());
+}
+
// Disabled due to timeouts/crashing on several platforms. crbug.com/241912
IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DISABLED_NewWindow) {
ASSERT_TRUE(StartTestServer()); // For serving guest pages.
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/edit_commands_no_menu/embedder.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698