| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 #include "components/guest_view/browser/test_guest_view_manager.h" | 27 #include "components/guest_view/browser/test_guest_view_manager.h" |
| 28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
| 30 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
| 31 #include "content/public/browser/render_widget_host.h" | 31 #include "content/public/browser/render_widget_host.h" |
| 32 #include "content/public/browser/render_widget_host_iterator.h" | 32 #include "content/public/browser/render_widget_host_iterator.h" |
| 33 #include "content/public/browser/render_widget_host_view.h" | 33 #include "content/public/browser/render_widget_host_view.h" |
| 34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
| 36 #include "content/public/test/browser_test_utils.h" | 36 #include "content/public/test/browser_test_utils.h" |
| 37 #include "content/public/test/text_input_test_utils.h" |
| 37 #include "extensions/browser/api/extensions_api_client.h" | 38 #include "extensions/browser/api/extensions_api_client.h" |
| 38 #include "extensions/browser/app_window/app_window.h" | 39 #include "extensions/browser/app_window/app_window.h" |
| 39 #include "extensions/browser/app_window/app_window_registry.h" | 40 #include "extensions/browser/app_window/app_window_registry.h" |
| 40 #include "extensions/test/extension_test_message_listener.h" | 41 #include "extensions/test/extension_test_message_listener.h" |
| 41 #include "net/test/embedded_test_server/embedded_test_server.h" | 42 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 42 #include "ui/base/ime/composition_text.h" | 43 #include "ui/base/ime/composition_text.h" |
| 43 #include "ui/base/ime/text_input_client.h" | 44 #include "ui/base/ime/text_input_client.h" |
| 44 #include "ui/base/test/ui_controls.h" | 45 #include "ui/base/test/ui_controls.h" |
| 45 #include "ui/events/keycodes/keyboard_codes.h" | 46 #include "ui/events/keycodes/keyboard_codes.h" |
| 46 | 47 |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 "window.runCommand('testInputMethodRunNextStep', 3);")); | 1281 "window.runCommand('testInputMethodRunNextStep', 3);")); |
| 1281 | 1282 |
| 1282 // Wait for the next step to complete. | 1283 // Wait for the next step to complete. |
| 1283 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); | 1284 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); |
| 1284 } | 1285 } |
| 1285 } | 1286 } |
| 1286 #endif | 1287 #endif |
| 1287 | 1288 |
| 1288 #if defined(OS_MACOSX) | 1289 #if defined(OS_MACOSX) |
| 1289 IN_PROC_BROWSER_TEST_P(WebViewInteractiveTest, TextSelection) { | 1290 IN_PROC_BROWSER_TEST_P(WebViewInteractiveTest, TextSelection) { |
| 1290 #if defined(OS_MACOSX) | 1291 // TODO(ekaramad): This test is failing under OOPIF for MAC |
| 1291 // TODO(ekaramad): This test is failing under OOPIF for MAC. | 1292 // (crbug.com/582562). |
| 1292 if (GetParam()) | 1293 if (GetParam()) |
| 1293 return; | 1294 return; |
| 1294 #endif | 1295 |
| 1295 SetupTest("web_view/text_selection", | 1296 SetupTest("web_view/text_selection", |
| 1296 "/extensions/platform_apps/web_view/text_selection/guest.html"); | 1297 "/extensions/platform_apps/web_view/text_selection/guest.html"); |
| 1297 ASSERT_TRUE(guest_web_contents()); | 1298 ASSERT_TRUE(guest_web_contents()); |
| 1298 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( | 1299 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow( |
| 1299 GetPlatformAppWindow())); | 1300 GetPlatformAppWindow())); |
| 1300 | 1301 |
| 1301 // Wait until guest sees a context menu, select an arbitrary item (copy). | 1302 // Wait until guest sees a context menu, select an arbitrary item (copy). |
| 1302 ExtensionTestMessageListener ctx_listener("MSG_CONTEXTMENU", false); | 1303 ExtensionTestMessageListener ctx_listener("MSG_CONTEXTMENU", false); |
| 1303 ContextMenuNotificationObserver menu_observer(IDC_CONTENT_CONTEXT_COPY); | 1304 ContextMenuNotificationObserver menu_observer(IDC_CONTENT_CONTEXT_COPY); |
| 1304 SimulateRWHMouseClick(guest_web_contents()->GetRenderViewHost()->GetWidget(), | 1305 SimulateRWHMouseClick(guest_web_contents()->GetRenderViewHost()->GetWidget(), |
| 1305 blink::WebMouseEvent::ButtonRight, 20, 20); | 1306 blink::WebMouseEvent::ButtonRight, 20, 20); |
| 1306 ASSERT_TRUE(ctx_listener.WaitUntilSatisfied()); | 1307 ASSERT_TRUE(ctx_listener.WaitUntilSatisfied()); |
| 1307 | 1308 |
| 1308 // Now verify that the selection text propagates properly to RWHV. | 1309 // Now verify that the selection text propagates properly to RWHV. |
| 1309 content::RenderWidgetHostView* guest_rwhv = | 1310 content::RenderWidgetHostView* embedder_rwhv = |
| 1310 guest_web_contents()->GetRenderWidgetHostView(); | 1311 embedder_web_contents()->GetRenderWidgetHostView(); |
| 1311 ASSERT_TRUE(guest_rwhv); | 1312 ASSERT_TRUE(embedder_rwhv); |
| 1312 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); | 1313 std::string selected_text = |
| 1314 base::UTF16ToUTF8(content::GetSelectedTextForView(embedder_rwhv)); |
| 1313 ASSERT_TRUE(selected_text.size() >= 10u); | 1315 ASSERT_TRUE(selected_text.size() >= 10u); |
| 1314 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); | 1316 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); |
| 1315 } | 1317 } |
| 1316 #endif | 1318 #endif |
| 1317 | 1319 |
| 1318 IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, FocusAndVisibility) { | 1320 IN_PROC_BROWSER_TEST_F(WebViewFocusInteractiveTest, FocusAndVisibility) { |
| 1319 ASSERT_TRUE(StartEmbeddedTestServer()); | 1321 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 1320 LoadAndLaunchPlatformApp("web_view/focus_visibility", | 1322 LoadAndLaunchPlatformApp("web_view/focus_visibility", |
| 1321 "WebViewInteractiveTest.LOADED"); | 1323 "WebViewInteractiveTest.LOADED"); |
| 1322 ExtensionTestMessageListener test_init_listener( | 1324 ExtensionTestMessageListener test_init_listener( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1346 // this time. | 1348 // this time. |
| 1347 for (size_t i = 0; i < 4; ++i) | 1349 for (size_t i = 0; i < 4; ++i) |
| 1348 SendKeyPressToPlatformApp(ui::VKEY_TAB); | 1350 SendKeyPressToPlatformApp(ui::VKEY_TAB); |
| 1349 ExtensionTestMessageListener webview_button_not_focused_listener( | 1351 ExtensionTestMessageListener webview_button_not_focused_listener( |
| 1350 "WebViewInteractiveTest.WebViewButtonWasNotFocused", false); | 1352 "WebViewInteractiveTest.WebViewButtonWasNotFocused", false); |
| 1351 webview_button_not_focused_listener.set_failure_message( | 1353 webview_button_not_focused_listener.set_failure_message( |
| 1352 "WebViewInteractiveTest.WebViewButtonWasFocused"); | 1354 "WebViewInteractiveTest.WebViewButtonWasFocused"); |
| 1353 SendMessageToEmbedder("verify"); | 1355 SendMessageToEmbedder("verify"); |
| 1354 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied()); | 1356 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied()); |
| 1355 } | 1357 } |
| OLD | NEW |