OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <mshtmcid.h> | 5 #include <mshtmcid.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/test/test_file_util.h" | 8 #include "base/test/test_file_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/win/scoped_bstr.h" | 10 #include "base/win/scoped_bstr.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::SHIFT))); | 100 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::SHIFT))); |
101 | 101 |
102 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) | 102 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) |
103 .WillOnce(CloseBrowserMock(&ie_mock_)); | 103 .WillOnce(CloseBrowserMock(&ie_mock_)); |
104 | 104 |
105 LaunchIENavigateAndLoop(page1, | 105 LaunchIENavigateAndLoop(page1, |
106 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 106 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
107 } | 107 } |
108 | 108 |
109 // Tests new window behavior with ctrl+N. | 109 // Tests new window behavior with ctrl+N. |
110 // Flaky on Chrome Frame Tests (ie6), http://crbug.com/86251. | 110 TEST_P(FullTabUITest, CtrlN) { |
111 TEST_P(FullTabUITest, FLAKY_CtrlN) { | |
112 if (IsWorkstationLocked()) { | 111 if (IsWorkstationLocked()) { |
113 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 112 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
114 return; | 113 return; |
115 } | 114 } |
116 | 115 |
117 bool is_cf = GetParam().invokes_cf(); | 116 bool is_cf = GetParam().invokes_cf(); |
118 if (!is_cf) { | 117 if (!is_cf) { |
119 LOG(ERROR) << "Test not implemented for this configuration."; | 118 LOG(ERROR) << "Test not implemented for this configuration."; |
120 return; | 119 return; |
121 } | 120 } |
122 // Ideally we want to use a ie_mock_ to watch for finer grained | 121 // Ideally we want to use a ie_mock_ to watch for finer grained |
123 // events for New Window, but for Crl+N we don't get any | 122 // events for New Window, but for Crl+N we don't get any |
124 // OnNewWindowX notifications. :( | 123 // OnNewWindowX notifications. :( |
125 MockWindowObserver win_observer_mock; | 124 MockWindowObserver win_observer_mock; |
126 | 125 |
127 const char* kNewWindowTitlePattern = "*Internet Explorer*"; | 126 const char* kNewWindowTitlePattern = "*Internet Explorer*"; |
128 EXPECT_CALL(ie_mock_, OnLoad(is_cf, StrEq(GetSimplePageUrl()))) | 127 EXPECT_CALL(ie_mock_, OnLoad(is_cf, StrEq(GetSimplePageUrl()))) |
129 .WillOnce(testing::DoAll( | 128 .WillOnce(testing::DoAll( |
130 WatchWindow(&win_observer_mock, kNewWindowTitlePattern, ""), | 129 WatchWindow(&win_observer_mock, kNewWindowTitlePattern, ""), |
131 SetFocusToRenderer(&ie_mock_), | 130 SetFocusToRenderer(&ie_mock_), |
132 DelaySendChar(&loop_, 1000, 'n', simulate_input::CONTROL))); | 131 DelaySendChar(&loop_, 1000, 'n', simulate_input::CONTROL))); |
133 | 132 |
134 // Watch for new window. It appears that the window close message cannot be | 133 // Watch for new window. It appears that the window close message cannot be |
135 // reliably delivered immediately upon receipt of the window open event. | 134 // reliably delivered immediately upon receipt of the window open event. |
136 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) | 135 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
137 .Times(testing::AtMost(2)) | 136 .Times(testing::AtMost(2)) |
138 .WillOnce(DelayDoCloseWindow(500)) | |
139 .WillOnce(testing::Return()); | |
140 | |
141 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) | |
142 .Times(testing::AtMost(2)) | |
143 .WillOnce(CloseBrowserMock(&ie_mock_)) | 137 .WillOnce(CloseBrowserMock(&ie_mock_)) |
144 .WillOnce(testing::Return()); | 138 .WillOnce(testing::Return()); |
145 | 139 |
146 LaunchIEAndNavigate(GetSimplePageUrl()); | 140 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) |
| 141 .Times(testing::AtMost(2)); |
| 142 |
| 143 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 144 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
147 } | 145 } |
148 | 146 |
149 // Test that Ctrl+F opens the Find dialog. | 147 // Test that Ctrl+F opens the Find dialog. |
150 TEST_P(FullTabUITest, CtrlF) { | 148 TEST_P(FullTabUITest, CtrlF) { |
151 if (IsWorkstationLocked()) { | 149 if (IsWorkstationLocked()) { |
152 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 150 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
153 return; | 151 return; |
154 } | 152 } |
155 | 153 |
156 bool is_cf = GetParam().invokes_cf(); | 154 bool is_cf = GetParam().invokes_cf(); |
157 if (!is_cf) { | 155 if (!is_cf) { |
158 LOG(ERROR) << "Test not implemented for this configuration."; | 156 LOG(ERROR) << "Test not implemented for this configuration."; |
159 return; | 157 return; |
160 } | 158 } |
161 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); | 159 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); |
162 MockWindowObserver win_observer_mock; | 160 MockWindowObserver win_observer_mock; |
163 InSequence expect_in_sequence_for_scope; | 161 InSequence expect_in_sequence_for_scope; |
164 | 162 |
165 const char* kFindDialogCaption = "Find"; | 163 const char* kFindDialogCaption = "Find"; |
166 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl()))) | 164 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl()))) |
167 .WillOnce(testing::DoAll( | 165 .WillOnce(testing::DoAll( |
168 WatchWindow(&win_observer_mock, kFindDialogCaption, ""), | 166 WatchWindow(&win_observer_mock, kFindDialogCaption, ""), |
169 SetFocusToRenderer(&ie_mock_), | 167 SetFocusToRenderer(&ie_mock_), |
170 DelaySendChar(&loop_, 1500, 'f', simulate_input::CONTROL))); | 168 DelaySendChar(&loop_, 1500, 'f', simulate_input::CONTROL))); |
171 | 169 |
172 // Watch for find dialog. It appears that the window close message cannot be | |
173 // reliably delivered immediately upon receipt of the window open event. | |
174 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) | 170 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
175 .WillOnce(DelayDoCloseWindow(500)); | |
176 | |
177 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) | |
178 .WillOnce(CloseBrowserMock(&ie_mock_)); | 171 .WillOnce(CloseBrowserMock(&ie_mock_)); |
179 | 172 |
180 LaunchIEAndNavigate(GetSimplePageUrl()); | 173 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 174 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
181 } | 175 } |
182 | 176 |
183 // Test that ctrl+r does cause a refresh. | 177 // Test that ctrl+r does cause a refresh. |
184 // http://code.google.com/p/chromium/issues/detail?id=84297 | 178 TEST_P(FullTabUITest, CtrlR) { |
185 TEST_P(FullTabUITest, FLAKY_CtrlR) { | |
186 if (IsWorkstationLocked()) { | 179 if (IsWorkstationLocked()) { |
187 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 180 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
188 return; | 181 return; |
189 } | 182 } |
190 | 183 |
191 EXPECT_CALL(server_mock_, Get(_, UrlPathEq(GetSimplePageUrl()), _)) | 184 EXPECT_CALL(server_mock_, Get(_, UrlPathEq(GetSimplePageUrl()), _)) |
192 .Times(testing::AtMost(2)) | 185 .Times(testing::AtMost(2)) |
193 .WillRepeatedly(SendResponse(&server_mock_, GetParam())); | 186 .WillRepeatedly(SendResponse(&server_mock_, GetParam())); |
194 | 187 |
195 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 188 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
196 StrEq(GetSimplePageUrl()))) | 189 StrEq(GetSimplePageUrl()))) |
197 .Times(testing::AtMost(2)) | 190 .Times(testing::AtMost(2)) |
198 .WillOnce(testing::DoAll( | 191 .WillOnce(testing::DoAll( |
199 SetFocusToRenderer(&ie_mock_), | 192 SetFocusToRenderer(&ie_mock_), |
200 DelaySendChar(&loop_, 1000, 'r', simulate_input::CONTROL), | 193 DelaySendChar(&loop_, 1000, 'r', simulate_input::CONTROL), |
201 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))) | 194 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))) |
202 .WillRepeatedly(testing::Return()); | 195 .WillRepeatedly(testing::Return()); |
203 | 196 |
204 LaunchIEAndNavigate(GetSimplePageUrl()); | 197 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 198 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
205 } | 199 } |
206 | 200 |
207 // Test window close with ctrl+w. | 201 // Test window close with ctrl+w. |
208 TEST_P(FullTabUITest, CtrlW) { | 202 TEST_P(FullTabUITest, CtrlW) { |
209 if (IsWorkstationLocked()) { | 203 if (IsWorkstationLocked()) { |
210 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 204 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
211 return; | 205 return; |
212 } | 206 } |
213 | 207 |
214 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 208 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
215 StrEq(GetSimplePageUrl()))) | 209 StrEq(GetSimplePageUrl()))) |
216 .WillOnce(testing::DoAll( | 210 .WillOnce(testing::DoAll( |
217 SetFocusToRenderer(&ie_mock_), | 211 SetFocusToRenderer(&ie_mock_), |
218 DelaySendChar(&loop_, 1000, 'w', simulate_input::CONTROL))); | 212 DelaySendChar(&loop_, 1000, 'w', simulate_input::CONTROL))); |
219 | 213 |
220 LaunchIEAndNavigate(GetSimplePageUrl()); | 214 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 215 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
221 } | 216 } |
222 | 217 |
223 // Test address bar navigation with Alt+d and URL. | 218 // Test address bar navigation with Alt+d and URL. |
224 // http://code.google.com/p/chromium/issues/detail?id=84297 | 219 TEST_P(FullTabUITest, AltD) { |
225 TEST_P(FullTabUITest, FLAKY_AltD) { | |
226 if (IsWorkstationLocked()) { | 220 if (IsWorkstationLocked()) { |
227 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 221 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
228 return; | 222 return; |
229 } | 223 } |
230 | 224 |
231 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 225 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
232 StrEq(GetSimplePageUrl()))) | 226 StrEq(GetSimplePageUrl()))) |
233 .WillOnce(testing::DoAll( | 227 .WillOnce(testing::DoAll( |
234 SetFocusToRenderer(&ie_mock_), | 228 SetFocusToRenderer(&ie_mock_), |
235 TypeUrlInAddressBar(&loop_, GetLinkPageUrl(), 1500))); | 229 TypeUrlInAddressBar(&loop_, GetLinkPageUrl(), 1500))); |
236 | 230 |
237 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 231 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
238 StrEq(GetLinkPageUrl()))) | 232 StrEq(GetLinkPageUrl()))) |
239 .WillOnce(CloseBrowserMock(&ie_mock_)); | 233 .WillOnce(CloseBrowserMock(&ie_mock_)); |
240 | 234 |
241 LaunchIEAndNavigate(GetSimplePageUrl()); | 235 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 236 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
242 } | 237 } |
243 | 238 |
244 // Tests that the renderer has focus after navigation. | 239 // Tests that the renderer has focus after navigation. |
245 TEST_P(FullTabUITest, RendererHasFocus) { | 240 TEST_P(FullTabUITest, RendererHasFocus) { |
246 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 241 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
247 StrEq(GetSimplePageUrl()))) | 242 StrEq(GetSimplePageUrl()))) |
248 .WillOnce(testing::DoAll( | 243 .WillOnce(testing::DoAll( |
249 ExpectRendererHasFocus(&ie_mock_), | 244 ExpectRendererHasFocus(&ie_mock_), |
250 CloseBrowserMock(&ie_mock_))); | 245 CloseBrowserMock(&ie_mock_))); |
251 | 246 |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); | 964 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); |
970 | 965 |
971 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) | 966 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) |
972 .WillOnce(CloseBrowserMock(&ie_mock_)); | 967 .WillOnce(CloseBrowserMock(&ie_mock_)); |
973 | 968 |
974 LaunchIENavigateAndLoop(page1, | 969 LaunchIENavigateAndLoop(page1, |
975 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 970 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
976 } | 971 } |
977 | 972 |
978 } // namespace chrome_frame_test | 973 } // namespace chrome_frame_test |
OLD | NEW |