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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_win_browsertest.cc

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/win/metro.h" 6 #include "base/win/metro.h"
7 #include "content/public/browser/web_contents.h" 7 #include "content/public/browser/web_contents.h"
8 #include "content/public/common/content_switches.h" 8 #include "content/public/common/content_switches.h"
9 #include "content/public/test/test_utils.h" 9 #include "content/public/test/test_utils.h"
10 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 23 matching lines...) Expand all
34 34
35 NavigateToURL(shell(), test_url); 35 NavigateToURL(shell(), test_url);
36 WaitForLoadStop(shell()->web_contents()); 36 WaitForLoadStop(shell()->web_contents());
37 RunAllPendingInMessageLoop(); 37 RunAllPendingInMessageLoop();
38 38
39 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, mock_bridge.latest_text_iput_type()); 39 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, mock_bridge.latest_text_iput_type());
40 40
41 // Focus to the text field, the IME should be enabled. 41 // Focus to the text field, the IME should be enabled.
42 bool success = false; 42 bool success = false;
43 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool( 43 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool(
44 shell()->web_contents()->GetRenderViewHost(), L"", 44 shell()->web_contents()->GetRenderViewHost(),
45 L"window.domAutomationController.send(text01_focus());", 45 "",
46 "window.domAutomationController.send(text01_focus());",
46 &success)); 47 &success));
47 EXPECT_TRUE(success); 48 EXPECT_TRUE(success);
48 WaitForLoadStop(shell()->web_contents()); 49 WaitForLoadStop(shell()->web_contents());
49 RunAllPendingInMessageLoop(); 50 RunAllPendingInMessageLoop();
50 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, mock_bridge.latest_text_iput_type()); 51 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, mock_bridge.latest_text_iput_type());
51 52
52 // Focus to the password field, the IME should be disabled. 53 // Focus to the password field, the IME should be disabled.
53 success = false; 54 success = false;
54 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool( 55 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool(
55 shell()->web_contents()->GetRenderViewHost(), L"", 56 shell()->web_contents()->GetRenderViewHost(),
56 L"window.domAutomationController.send(password02_focus());", 57 "",
58 "window.domAutomationController.send(password02_focus());",
57 &success)); 59 &success));
58 EXPECT_TRUE(success); 60 EXPECT_TRUE(success);
59 WaitForLoadStop(shell()->web_contents()); 61 WaitForLoadStop(shell()->web_contents());
60 RunAllPendingInMessageLoop(); 62 RunAllPendingInMessageLoop();
61 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, mock_bridge.latest_text_iput_type()); 63 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, mock_bridge.latest_text_iput_type());
62 64
63 ui::TSFBridge::ReplaceForTesting(old_bridge); 65 ui::TSFBridge::ReplaceForTesting(old_bridge);
64 } 66 }
65 67
66 // crbug.com/151798 68 // crbug.com/151798
67 IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewWinTest, 69 IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewWinTest,
68 DISABLED_SwitchToSameField) { 70 DISABLED_SwitchToSameField) {
69 ui::MockTSFBridge mock_bridge; 71 ui::MockTSFBridge mock_bridge;
70 ui::TSFBridge* old_bridge = ui::TSFBridge::ReplaceForTesting(&mock_bridge); 72 ui::TSFBridge* old_bridge = ui::TSFBridge::ReplaceForTesting(&mock_bridge);
71 GURL test_url = GetTestUrl("textinput", "ime_enable_disable_test.html"); 73 GURL test_url = GetTestUrl("textinput", "ime_enable_disable_test.html");
72 74
73 NavigateToURL(shell(), test_url); 75 NavigateToURL(shell(), test_url);
74 WaitForLoadStop(shell()->web_contents()); 76 WaitForLoadStop(shell()->web_contents());
75 RunAllPendingInMessageLoop(); 77 RunAllPendingInMessageLoop();
76 78
77 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, mock_bridge.latest_text_iput_type()); 79 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, mock_bridge.latest_text_iput_type());
78 80
79 // Focus to the text field, the IME should be enabled. 81 // Focus to the text field, the IME should be enabled.
80 bool success = false; 82 bool success = false;
81 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool( 83 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool(
82 shell()->web_contents()->GetRenderViewHost(), L"", 84 shell()->web_contents()->GetRenderViewHost(),
83 L"window.domAutomationController.send(text01_focus());", 85 "",
86 "window.domAutomationController.send(text01_focus());",
84 &success)); 87 &success));
85 EXPECT_TRUE(success); 88 EXPECT_TRUE(success);
86 WaitForLoadStop(shell()->web_contents()); 89 WaitForLoadStop(shell()->web_contents());
87 RunAllPendingInMessageLoop(); 90 RunAllPendingInMessageLoop();
88 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, mock_bridge.latest_text_iput_type()); 91 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, mock_bridge.latest_text_iput_type());
89 92
90 // Focus to another text field, the IME should be enabled. 93 // Focus to another text field, the IME should be enabled.
91 success = false; 94 success = false;
92 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool( 95 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool(
93 shell()->web_contents()->GetRenderViewHost(), L"", 96 shell()->web_contents()->GetRenderViewHost(),
94 L"window.domAutomationController.send(text02_focus());", 97 "",
98 "window.domAutomationController.send(text02_focus());",
95 &success)); 99 &success));
96 EXPECT_TRUE(success); 100 EXPECT_TRUE(success);
97 WaitForLoadStop(shell()->web_contents()); 101 WaitForLoadStop(shell()->web_contents());
98 RunAllPendingInMessageLoop(); 102 RunAllPendingInMessageLoop();
99 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, mock_bridge.latest_text_iput_type()); 103 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, mock_bridge.latest_text_iput_type());
100 104
101 ui::TSFBridge::ReplaceForTesting(old_bridge); 105 ui::TSFBridge::ReplaceForTesting(old_bridge);
102 } 106 }
103 107
104 // crbug.com/151798 108 // crbug.com/151798
105 IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewWinTest, 109 IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewWinTest,
106 DISABLED_SwitchToSamePasswordField) { 110 DISABLED_SwitchToSamePasswordField) {
107 ui::MockTSFBridge mock_bridge; 111 ui::MockTSFBridge mock_bridge;
108 ui::TSFBridge* old_bridge = ui::TSFBridge::ReplaceForTesting(&mock_bridge); 112 ui::TSFBridge* old_bridge = ui::TSFBridge::ReplaceForTesting(&mock_bridge);
109 GURL test_url = GetTestUrl("textinput", "ime_enable_disable_test.html"); 113 GURL test_url = GetTestUrl("textinput", "ime_enable_disable_test.html");
110 114
111 NavigateToURL(shell(), test_url); 115 NavigateToURL(shell(), test_url);
112 WaitForLoadStop(shell()->web_contents()); 116 WaitForLoadStop(shell()->web_contents());
113 RunAllPendingInMessageLoop(); 117 RunAllPendingInMessageLoop();
114 118
115 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, mock_bridge.latest_text_iput_type()); 119 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, mock_bridge.latest_text_iput_type());
116 120
117 // Focus to the password field, the IME should be disabled. 121 // Focus to the password field, the IME should be disabled.
118 bool success = false; 122 bool success = false;
119 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool( 123 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool(
120 shell()->web_contents()->GetRenderViewHost(), L"", 124 shell()->web_contents()->GetRenderViewHost(),
121 L"window.domAutomationController.send(password01_focus());", 125 "",
126 "window.domAutomationController.send(password01_focus());",
122 &success)); 127 &success));
123 EXPECT_TRUE(success); 128 EXPECT_TRUE(success);
124 WaitForLoadStop(shell()->web_contents()); 129 WaitForLoadStop(shell()->web_contents());
125 RunAllPendingInMessageLoop(); 130 RunAllPendingInMessageLoop();
126 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, mock_bridge.latest_text_iput_type()); 131 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, mock_bridge.latest_text_iput_type());
127 132
128 // Focus to the another password field, the IME should be disabled. 133 // Focus to the another password field, the IME should be disabled.
129 success = false; 134 success = false;
130 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool( 135 EXPECT_TRUE(ExecuteJavaScriptAndExtractBool(
131 shell()->web_contents()->GetRenderViewHost(), L"", 136 shell()->web_contents()->GetRenderViewHost(),
132 L"window.domAutomationController.send(password02_focus());", 137 "",
138 "window.domAutomationController.send(password02_focus());",
133 &success)); 139 &success));
134 EXPECT_TRUE(success); 140 EXPECT_TRUE(success);
135 WaitForLoadStop(shell()->web_contents()); 141 WaitForLoadStop(shell()->web_contents());
136 RunAllPendingInMessageLoop(); 142 RunAllPendingInMessageLoop();
137 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, mock_bridge.latest_text_iput_type()); 143 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, mock_bridge.latest_text_iput_type());
138 144
139 ui::TSFBridge::ReplaceForTesting(old_bridge); 145 ui::TSFBridge::ReplaceForTesting(old_bridge);
140 } 146 }
141 147
142 } // namespace content 148 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_manager_browsertest.cc ('k') | content/browser/session_history_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698