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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/apps/app_browsertest_util.h" | 8 #include "chrome/browser/apps/app_browsertest_util.h" |
9 #include "chrome/browser/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 embedder_web_contents->GetRenderViewHost()->GetView() | 1003 embedder_web_contents->GetRenderViewHost()->GetView() |
1004 ->GetTextInputClient(); | 1004 ->GetTextInputClient(); |
1005 ASSERT_TRUE(text_input_client); | 1005 ASSERT_TRUE(text_input_client); |
1006 ASSERT_TRUE(text_input_client->GetTextInputType() != | 1006 ASSERT_TRUE(text_input_client->GetTextInputType() != |
1007 ui::TEXT_INPUT_TYPE_NONE); | 1007 ui::TEXT_INPUT_TYPE_NONE); |
1008 #endif | 1008 #endif |
1009 } | 1009 } |
1010 | 1010 |
1011 // ui::TextInputClient is NULL for mac and android. | 1011 // ui::TextInputClient is NULL for mac and android. |
1012 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 1012 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
1013 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Focus_InputMethod) { | 1013 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DISABLED_Focus_InputMethod) { |
1014 content::WebContents* embedder_web_contents = NULL; | 1014 content::WebContents* embedder_web_contents = NULL; |
1015 scoped_ptr<ExtensionTestMessageListener> done_listener( | 1015 scoped_ptr<ExtensionTestMessageListener> done_listener( |
1016 RunAppHelper("testInputMethod", "web_view/focus", NO_TEST_SERVER, | 1016 RunAppHelper("testInputMethod", "web_view/focus", NO_TEST_SERVER, |
1017 &embedder_web_contents)); | 1017 &embedder_web_contents)); |
1018 ASSERT_TRUE(done_listener->WaitUntilSatisfied()); | 1018 ASSERT_TRUE(done_listener->WaitUntilSatisfied()); |
1019 | 1019 |
1020 ui::TextInputClient* text_input_client = | 1020 ui::TextInputClient* text_input_client = |
1021 embedder_web_contents->GetRenderViewHost()->GetView() | 1021 embedder_web_contents->GetRenderViewHost()->GetView() |
1022 ->GetTextInputClient(); | 1022 ->GetTextInputClient(); |
1023 ASSERT_TRUE(text_input_client); | 1023 ASSERT_TRUE(text_input_client); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 EXPECT_TRUE(next_step_listener.WaitUntilSatisfied()); | 1055 EXPECT_TRUE(next_step_listener.WaitUntilSatisfied()); |
1056 } | 1056 } |
1057 | 1057 |
1058 // Moving focus causes IME cancel, and the composition will be committed | 1058 // Moving focus causes IME cancel, and the composition will be committed |
1059 // in first <input> in the <webview>, not in the second <input>. | 1059 // in first <input> in the <webview>, not in the second <input>. |
1060 { | 1060 { |
1061 next_step_listener.Reset(); | 1061 next_step_listener.Reset(); |
1062 ui::CompositionText composition; | 1062 ui::CompositionText composition; |
1063 composition.text = base::UTF8ToUTF16("InputTest789"); | 1063 composition.text = base::UTF8ToUTF16("InputTest789"); |
1064 text_input_client->SetCompositionText(composition); | 1064 text_input_client->SetCompositionText(composition); |
1065 // Do a roundtrip to the renderer so that in-flight IPC from | |
1066 // SetCompositionText() above gets routed before the next step. | |
1067 // The test becomes flaky otherwise. | |
1068 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents, std::string())); | |
1069 EXPECT_TRUE(content::ExecuteScript( | 1065 EXPECT_TRUE(content::ExecuteScript( |
1070 embedder_web_contents, | 1066 embedder_web_contents, |
1071 "window.runCommand('testInputMethodRunNextStep', 3);")); | 1067 "window.runCommand('testInputMethodRunNextStep', 3);")); |
1072 | 1068 |
1073 // Wait for the next step to complete. | 1069 // Wait for the next step to complete. |
1074 EXPECT_TRUE(next_step_listener.WaitUntilSatisfied()); | 1070 EXPECT_TRUE(next_step_listener.WaitUntilSatisfied()); |
1075 } | 1071 } |
1076 | 1072 |
1077 // Tests ExtendSelectionAndDelete message works in <webview>. | 1073 // Tests ExtendSelectionAndDelete message works in <webview>. |
1078 { | 1074 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 | 1106 |
1111 // Now verify that the selection text propagates properly to RWHV. | 1107 // Now verify that the selection text propagates properly to RWHV. |
1112 content::RenderWidgetHostView* guest_rwhv = | 1108 content::RenderWidgetHostView* guest_rwhv = |
1113 guest_web_contents()->GetRenderWidgetHostView(); | 1109 guest_web_contents()->GetRenderWidgetHostView(); |
1114 ASSERT_TRUE(guest_rwhv); | 1110 ASSERT_TRUE(guest_rwhv); |
1115 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); | 1111 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); |
1116 ASSERT_TRUE(selected_text.size() >= 10u); | 1112 ASSERT_TRUE(selected_text.size() >= 10u); |
1117 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); | 1113 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); |
1118 } | 1114 } |
1119 #endif | 1115 #endif |
OLD | NEW |