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

Side by Side Diff: chrome_frame/test/ui_test.cc

Issue 2822016: [chrome_frame] Refactor/merge IE no interference tests with other mock event ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « chrome_frame/test/test_with_web_server.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <mshtmcid.h>
6 #include <string>
7
8 #include "chrome/common/url_constants.h"
9 #include "chrome_frame/test/chrome_frame_test_utils.h"
10 #include "chrome_frame/test/mock_ie_event_sink_actions.h"
11 #include "chrome_frame/test/mock_ie_event_sink_test.h"
12
13 using testing::_;
14 using testing::InSequence;
15 using testing::StrCaseEq;
16 using testing::StrEq;
17
18 namespace chrome_frame_test {
19
20 // This parameterized test fixture uses the MockIEEventSink and is used by
21 // UI-related tests.
22 class FullTabUITest : public MockIEEventSinkTest,
23 public testing::TestWithParam<CFInvocation> {
24 public:
25 FullTabUITest() {}
26
27 virtual void SetUp() {
28 // These are UI-related tests, so we do not care about the exact requests
29 // and navigations that occur.
30 server_mock_.ExpectAndServeAnyRequests(GetParam());
31 ie_mock_.ExpectAnyNavigations();
32 }
33 };
34
35 // Instantiate each test case for the IE case and for CF meta tag case.
36 // It does not seem too useful to also run the CF http header case since these
37 // are UI, not navigation tests.
38 INSTANTIATE_TEST_CASE_P(IE, FullTabUITest,
39 testing::Values(CFInvocation::None()));
40 INSTANTIATE_TEST_CASE_P(CF, FullTabUITest,
41 testing::Values(CFInvocation::MetaTag()));
42
43 // Tests keyboard input.
44 // Marking this test FLAKY as it fails at times on the buildbot.
45 // http://code.google.com/p/chromium/issues/detail?id=26549
46 TEST_P(FullTabUITest, FLAKY_KeyboardInput) {
47 if (!GetParam().invokes_cf()) {
48 LOG(ERROR) << "Test not implemented for this configuration.";
49 return;
50 }
51 std::wstring key_event_url = GetTestUrl(L"keyevent.html");
52
53 const wchar_t* input = L"Chrome";
54 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), StrEq(key_event_url)))
55 .WillOnce(testing::DoAll(
56 SetFocusToRenderer(&ie_mock_),
57 DelaySendString(&loop_, 500, input)));
58
59 EXPECT_CALL(ie_mock_, OnMessage(StrCaseEq(input), _, _))
60 .WillOnce(CloseBrowserMock(&ie_mock_));
61
62 LaunchIEAndNavigate(key_event_url);
63 }
64
65 // Tests keyboard shortcuts for back and forward.
66 // Marking this test FLAKY as it fails at times on the buildbot.
67 // http://code.google.com/p/chromium/issues/detail?id=26549
68 TEST_P(FullTabUITest, FLAKY_KeyboardBackForward) {
69 std::wstring page1 = GetSimplePageUrl();
70 std::wstring page2 = GetLinkPageUrl();
71 bool in_cf = GetParam().invokes_cf();
72 InSequence expect_in_sequence_for_scope;
73
74 // This test performs the following steps.
75 // 1. Launches IE and navigates to page1
76 // 2. It then navigates to page2
77 // 3. Sends the VK_BACK keystroke to IE, which should navigate back to
78 // page 1
79 // 4. Sends the Shift + VK_BACK keystroke to IE which should navigate
80 // forward to page2
81 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1)))
82 .WillOnce(Navigate(&ie_mock_, page2));
83
84 short bkspace = VkKeyScanA(VK_BACK); // NOLINT
85 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2)))
86 .WillOnce(testing::DoAll(
87 SetFocusToRenderer(&ie_mock_),
88 DelaySendScanCode(&loop_, 500, bkspace, simulate_input::NONE)));
89
90 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1)))
91 .WillOnce(testing::DoAll(
92 SetFocusToRenderer(&ie_mock_),
93 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::SHIFT)));
94
95 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2)))
96 .WillOnce(CloseBrowserMock(&ie_mock_));
97
98 LaunchIENavigateAndLoop(page1,
99 kChromeFrameLongNavigationTimeoutInSeconds * 2);
100 }
101
102 // Tests new window behavior with ctrl+N.
103 TEST_P(FullTabUITest, FLAKY_CtrlN) {
104 bool is_cf = GetParam().invokes_cf();
105 if (!is_cf) {
106 LOG(ERROR) << "Test not implemented for this configuration.";
107 return;
108 }
109 // Ideally we want to use a ie_mock_ to watch for finer grained
110 // events for New Window, but for Crl+N we don't get any
111 // OnNewWindowX notifications. :(
112 MockWindowObserver win_observer_mock;
113 const wchar_t* kIEFrameClass = L"IEFrame";
114 EXPECT_CALL(ie_mock_, OnLoad(is_cf, StrEq(GetSimplePageUrl())))
115 .WillOnce(testing::DoAll(
116 WatchWindow(&win_observer_mock, kIEFrameClass),
117 SetFocusToRenderer(&ie_mock_),
118 DelaySendChar(&loop_, 1000, 'n', simulate_input::CONTROL)));
119
120 // Watch for new window
121 const char* kNewWindowTitle = "Internet Explorer";
122 EXPECT_CALL(win_observer_mock,
123 OnWindowDetected(_, testing::HasSubstr(kNewWindowTitle)))
124 .WillOnce(testing::DoAll(
125 DoCloseWindow(),
126 CloseBrowserMock(&ie_mock_)));
127
128 LaunchIEAndNavigate(GetSimplePageUrl());
129 // TODO(kkania): The new window does not close properly sometimes.
130 }
131
132 // Test that ctrl+r does cause a refresh.
133 TEST_P(FullTabUITest, FLAKY_CtrlR) {
134 InSequence expect_in_sequence_for_scope;
135
136 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(),
137 StrEq(GetSimplePageUrl())))
138 .WillOnce(testing::DoAll(
139 SetFocusToRenderer(&ie_mock_),
140 DelaySendChar(&loop_, 1000, 'r', simulate_input::CONTROL)));
141
142 EXPECT_CALL(server_mock_, Get(_, UrlPathEq(GetSimplePageUrl()), _))
143 .WillOnce(testing::DoAll(
144 SendResponse(&server_mock_, GetParam()),
145 CloseBrowserMock(&ie_mock_)));
146
147 LaunchIEAndNavigate(GetSimplePageUrl());
148 }
149
150 // Test window close with ctrl+w.
151 TEST_P(FullTabUITest, FLAKY_CtrlW) {
152 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(),
153 StrEq(GetSimplePageUrl())))
154 .WillOnce(testing::DoAll(
155 SetFocusToRenderer(&ie_mock_),
156 DelaySendChar(&loop_, 1000, 'w', simulate_input::CONTROL)));
157
158 LaunchIEAndNavigate(GetSimplePageUrl());
159 }
160
161 // Test address bar navigation with Alt+d and URL.
162 TEST_P(FullTabUITest, FLAKY_AltD) {
163 if (IsIBrowserServicePatchEnabled()) {
164 LOG(ERROR) << "Not running test. IBrowserServicePatch is in place.";
165 return;
166 }
167 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(),
168 StrEq(GetSimplePageUrl())))
169 .WillOnce(testing::DoAll(
170 SetFocusToRenderer(&ie_mock_),
171 TypeUrlInAddressBar(&loop_, GetLinkPageUrl(), 1500)));
172
173 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(),
174 StrEq(GetLinkPageUrl())))
175 .WillOnce(CloseBrowserMock(&ie_mock_));
176
177 LaunchIEAndNavigate(GetSimplePageUrl());
178 }
179
180 // Tests that the renderer has focus after navigation.
181 TEST_P(FullTabUITest, FLAKY_RendererHasFocus) {
182 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(),
183 StrEq(GetSimplePageUrl())))
184 .WillOnce(testing::DoAll(
185 ExpectRendererHasFocus(&ie_mock_),
186 CloseBrowserMock(&ie_mock_)));
187
188 LaunchIEAndNavigate(GetSimplePageUrl());
189 }
190
191 // Tests that view source works.
192 // This test has been marked FLAKY
193 // http://code.google.com/p/chromium/issues/detail?id=35370
194 TEST_P(FullTabUITest, FLAKY_ViewSource) {
195 bool in_cf = GetParam().invokes_cf();
196 if (!in_cf) {
197 LOG(ERROR) << "Test not implemented for this configuration.";
198 return;
199 }
200 MockIEEventSink view_source_mock;
201 view_source_mock.ExpectAnyNavigations();
202 InSequence expect_in_sequence_for_scope;
203
204 // After navigation invoke view soruce action using IWebBrowser2::ExecWB
205 VARIANT empty = ScopedVariant::kEmptyVariant;
206 EXPECT_CALL(ie_mock_, OnLoad(in_cf,
207 StrEq(GetSimplePageUrl())))
208 .WillOnce(DelayExecCommand(&ie_mock_, &loop_, 0, &CGID_MSHTML,
209 static_cast<OLECMDID>(IDM_VIEWSOURCE),
210 OLECMDEXECOPT_DONTPROMPTUSER, &empty, &empty));
211
212 // Expect notification for view-source window, handle new window event
213 // and attach a new ie_mock_ to the received web browser
214 std::wstring view_source_url;
215 view_source_url += UTF8ToWide(chrome::kViewSourceScheme);
216 view_source_url += L":";
217 view_source_url += GetSimplePageUrl();
218 std::wstring url_in_new_window = kChromeProtocolPrefix;
219 url_in_new_window += view_source_url;
220
221 ie_mock_.ExpectNewWindow(&view_source_mock);
222 // For some reason this happens occasionally at least on XP IE7.
223 EXPECT_CALL(view_source_mock, OnLoad(false, StrEq(url_in_new_window)))
224 .Times(testing::AtMost(1));
225 EXPECT_CALL(view_source_mock, OnLoad(in_cf, StrEq(view_source_url)))
226 .WillOnce(testing::DoAll(
227 VerifyAddressBarUrlWithGcf(&view_source_mock),
228 CloseBrowserMock(&view_source_mock)));
229
230 EXPECT_CALL(view_source_mock, OnQuit())
231 .Times(testing::AtMost(1))
232 .WillOnce(CloseBrowserMock(&ie_mock_));
233
234 LaunchIEAndNavigate(GetSimplePageUrl());
235 }
236
237 // Test fixture for tests related to the context menu UI. Since the context
238 // menus for CF and IE are different, these tests are not parameterized.
239 class ContextMenuTest : public MockIEEventSinkTest, public testing::Test {
240 public:
241 ContextMenuTest() {}
242
243 virtual void SetUp() {
244 // These are UI-related tests, so we do not care about the exact
245 // navigations that occur.
246 ie_mock_.ExpectAnyNavigations();
247 }
248 };
249
250 // Test Reload from context menu.
251 // Marking this test FLAKY as it fails at times on the buildbot.
252 // http://code.google.com/p/chromium/issues/detail?id=26549
253 TEST_F(ContextMenuTest, FLAKY_CFReload) {
254 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag());
255 InSequence expect_in_sequence_for_scope;
256
257 // Reload using Rt-Click + DOWN + DOWN + DOWN + ENTER
258 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl())))
259 .WillOnce(testing::DoAll(
260 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
261 simulate_input::RIGHT),
262 SendExtendedKeysEnter(&loop_, 500, VK_DOWN, 3,
263 simulate_input::NONE)));
264
265 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl())))
266 .WillOnce(CloseBrowserMock(&ie_mock_));
267
268 LaunchIEAndNavigate(GetSimplePageUrl());
269 }
270
271 // Test view source using context menu
272 // Marking this test FLAKY as it fails at times on the buildbot.
273 // http://code.google.com/p/chromium/issues/detail?id=26549
274 TEST_F(ContextMenuTest, FLAKY_CFViewSource) {
275 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag());
276 MockIEEventSink view_source_mock;
277 view_source_mock.ExpectAnyNavigations();
278 InSequence expect_in_sequence_for_scope;
279
280 // View source using Rt-Click + UP + UP + UP + UP + ENTER
281 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl())))
282 .WillOnce(testing::DoAll(
283 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
284 simulate_input::RIGHT),
285 SendExtendedKeysEnter(&loop_, 500, VK_UP, 4, simulate_input::NONE)));
286
287 // Expect notification for view-source window, handle new window event
288 // and attach a new ie_mock_ to the received web browser
289 std::wstring view_source_url;
290 view_source_url += UTF8ToWide(chrome::kViewSourceScheme);
291 view_source_url += L":";
292 view_source_url += GetSimplePageUrl();
293 std::wstring url_in_new_window = kChromeProtocolPrefix;
294 url_in_new_window += view_source_url;
295
296 ie_mock_.ExpectNewWindow(&view_source_mock);
297 EXPECT_CALL(view_source_mock, OnLoad(IN_CF, StrEq(view_source_url)))
298 .WillOnce(testing::DoAll(
299 VerifyAddressBarUrlWithGcf(&view_source_mock),
300 CloseBrowserMock(&view_source_mock)));
301 EXPECT_CALL(view_source_mock, OnQuit())
302 .Times(testing::AtMost(1))
303 .WillOnce(CloseBrowserMock(&ie_mock_));
304
305 LaunchIEAndNavigate(GetSimplePageUrl());
306 }
307
308 TEST_F(ContextMenuTest, FLAKY_CFPageInfo) {
309 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag());
310 MockWindowObserver win_observer_mock;
311 InSequence expect_in_sequence_for_scope;
312
313 // View page information using Rt-Click + UP + UP + UP + ENTER
314 const wchar_t* kPageInfoWindowClass = L"Chrome_WidgetWin_0";
315 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl())))
316 .WillOnce(testing::DoAll(
317 WatchWindow(&win_observer_mock, kPageInfoWindowClass),
318 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
319 simulate_input::RIGHT),
320 SendExtendedKeysEnter(&loop_, 500, VK_UP, 3, simulate_input::NONE)));
321
322 // Expect page info dialog to pop up. Dismiss the dialog with 'Esc' key
323 const char* kPageInfoCaption = "Security Information";
324 EXPECT_CALL(win_observer_mock, OnWindowDetected(_, StrEq(kPageInfoCaption)))
325 .WillOnce(testing::DoAll(
326 DelaySendChar(&loop_, 100, VK_ESCAPE, simulate_input::NONE),
327 DelayCloseBrowserMock(&loop_, 2000, &ie_mock_)));
328
329 LaunchIEAndNavigate(GetSimplePageUrl());
330 }
331
332 TEST_F(ContextMenuTest, FLAKY_CFInspector) {
333 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag());
334 MockWindowObserver win_observer_mock;
335 InSequence expect_in_sequence_for_scope;
336
337 // Open developer tools using Rt-Click + UP + UP + ENTER
338 const wchar_t* kPageInfoWindowClass = L"Chrome_WidgetWin_0";
339 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl())))
340 .WillOnce(testing::DoAll(
341 WatchWindow(&win_observer_mock, kPageInfoWindowClass),
342 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
343 simulate_input::RIGHT),
344 SendExtendedKeysEnter(&loop_, 500, VK_UP, 2, simulate_input::NONE)));
345
346 // Devtools begins life with "Untitled" caption and it changes
347 // later to the 'Developer Tools - <url> form.
348 const char* kPageInfoCaption = "Untitled";
349 EXPECT_CALL(win_observer_mock,
350 OnWindowDetected(_, testing::StartsWith(kPageInfoCaption)))
351 .WillOnce(testing::DoAll(
352 SetFocusToRenderer(&ie_mock_),
353 DelayCloseBrowserMock(&loop_, 2000, &ie_mock_)));
354
355 LaunchIEAndNavigate(GetSimplePageUrl());
356 }
357
358 TEST_F(ContextMenuTest, FLAKY_CFSaveAs) {
359 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag());
360 MockWindowObserver win_observer_mock;
361 InSequence expect_in_sequence_for_scope;
362
363 // Open'Save As' dialog using Rt-Click + DOWN + DOWN + DOWN + DOWN + ENTER
364 const wchar_t* kSaveDlgClass = L"#32770";
365 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl())))
366 .WillOnce(testing::DoAll(
367 WatchWindow(&win_observer_mock, kSaveDlgClass),
368 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
369 simulate_input::RIGHT),
370 SendExtendedKeysEnter(&loop_, 500, VK_DOWN, 4,
371 simulate_input::NONE)));
372
373 FilePath temp_file_path;
374 EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_file_path));
375 temp_file_path = temp_file_path.ReplaceExtension(L".htm");
376
377 const wchar_t* kSaveFileName = temp_file_path.value().c_str();
378 DeleteFile(kSaveFileName);
379
380 const char* kSaveDlgCaption = "Save As";
381 EXPECT_CALL(win_observer_mock, OnWindowDetected(_, StrEq(kSaveDlgCaption)))
382 .WillOnce(testing::DoAll(
383 DelaySendString(&loop_, 100, kSaveFileName),
384 DelaySendChar(&loop_, 200, VK_RETURN, simulate_input::NONE),
385 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_)));
386
387 LaunchIEAndNavigate(GetSimplePageUrl());
388 ASSERT_NE(INVALID_FILE_ATTRIBUTES, GetFileAttributes(kSaveFileName));
389 ASSERT_TRUE(DeleteFile(kSaveFileName));
390 }
391
392 // This tests that the about:version page can be opened via the CF context menu.
393 TEST_F(ContextMenuTest, FLAKY_CFAboutVersionLoads) {
394 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag());
395 const wchar_t* kAboutVersionUrl = L"gcf:about:version";
396 const wchar_t* kAboutVersionWithoutProtoUrl = L"about:version";
397 MockIEEventSink new_window_mock;
398 new_window_mock.ExpectAnyNavigations();
399
400 ie_mock_.ExpectNavigation(IN_CF, GetSimplePageUrl());
401 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl())))
402 .WillOnce(testing::DoAll(
403 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
404 simulate_input::RIGHT),
405 SendExtendedKeysEnter(&loop_, 500, VK_UP, 1, simulate_input::NONE)));
406
407 ie_mock_.ExpectNewWindow(&new_window_mock);
408 EXPECT_CALL(new_window_mock,
409 OnLoad(IN_CF, StrEq(kAboutVersionWithoutProtoUrl)))
410 .WillOnce(testing::DoAll(
411 VerifyAddressBarUrlWithGcf(&new_window_mock),
412 CloseBrowserMock(&new_window_mock)));
413
414 EXPECT_CALL(new_window_mock, OnQuit())
415 .Times(testing::AtMost(1))
416 .WillOnce(CloseBrowserMock(&ie_mock_));
417
418 LaunchIEAndNavigate(GetSimplePageUrl());
419 }
420
421 TEST_F(ContextMenuTest, FLAKY_IEOpen) {
422 server_mock_.ExpectAndServeAnyRequests(CFInvocation::None());
423 // Focus the renderer window by clicking and then tab once to highlight the
424 // link.
425 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetLinkPageUrl())))
426 .WillOnce(testing::DoAll(
427 DelaySendMouseClick(&ie_mock_, &loop_, 0, 1, 1, simulate_input::LEFT),
428 DelaySendScanCode(&loop_, 1000, VK_TAB, simulate_input::NONE),
429 OpenContextMenu(&loop_, 2000),
430 SelectItem(&loop_, 3000, 0)));
431
432 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetSimplePageUrl())))
433 .WillOnce(testing::DoAll(
434 VerifyAddressBarUrl(&ie_mock_),
435 CloseBrowserMock(&ie_mock_)));
436
437 LaunchIEAndNavigate(GetLinkPageUrl());
438 }
439
440 TEST_F(ContextMenuTest, FLAKY_IEOpenInNewWindow) {
441 server_mock_.ExpectAndServeAnyRequests(CFInvocation::None());
442 MockIEEventSink new_window_mock;
443 new_window_mock.ExpectAnyNavigations();
444
445 int open_new_window_index = 2;
446 if (chrome_frame_test::GetInstalledIEVersion() == IE_6)
447 open_new_window_index = 1;
448
449 // Focus the renderer window by clicking and then tab once to highlight the
450 // link.
451 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(GetLinkPageUrl())))
452 .WillOnce(testing::DoAll(
453 DelaySendMouseClick(&ie_mock_, &loop_, 0, 1, 1, simulate_input::LEFT),
454 DelaySendScanCode(&loop_, 500, VK_TAB, simulate_input::NONE),
455 OpenContextMenu(&loop_, 1000),
456 SelectItem(&loop_, 1500, open_new_window_index)));
457
458 ie_mock_.ExpectNewWindow(&new_window_mock);
459 EXPECT_CALL(new_window_mock, OnLoad(IN_IE, StrEq(GetSimplePageUrl())))
460 // TODO(kkania): Verifying the address bar is flaky with this, at least
461 // on XP ie6. Fix.
462 .WillOnce(CloseBrowserMock(&new_window_mock));
463
464 EXPECT_CALL(new_window_mock, OnQuit())
465 .Times(testing::AtMost(1))
466 .WillOnce(CloseBrowserMock(&ie_mock_));
467
468 LaunchIEAndNavigate(GetLinkPageUrl());
469 }
470
471 // Test Back/Forward from context menu.
472 // Marking this test FLAKY as it fails at times on the buildbot.
473 // http://code.google.com/p/chromium/issues/detail?id=26549
474 TEST_F(ContextMenuTest, FLAKY_IEBackForward) {
475 server_mock_.ExpectAndServeAnyRequests(CFInvocation::None());
476 std::wstring page1 = GetLinkPageUrl();
477 std::wstring page2 = GetSimplePageUrl();
478 InSequence expect_in_sequence_for_scope;
479
480 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page1)))
481 .WillOnce(Navigate(&ie_mock_, page2));
482
483 // Go back using Rt-Click + DOWN + ENTER
484 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page2)))
485 .WillOnce(testing::DoAll(
486 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
487 simulate_input::RIGHT),
488 SendExtendedKeysEnter(&loop_, 500, VK_DOWN, 1,
489 simulate_input::NONE)));
490
491 // Go forward using Rt-Click + DOWN + DOWN + ENTER
492 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page1)))
493 .WillOnce(testing::DoAll(
494 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
495 simulate_input::RIGHT),
496 SendExtendedKeysEnter(&loop_, 500, VK_DOWN, 2,
497 simulate_input::NONE)));
498
499 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page2)))
500 .WillOnce(CloseBrowserMock(&ie_mock_));
501
502 LaunchIEAndNavigate(page1);
503 }
504
505 // Test Back/Forward from context menu. Loads page 1 in chrome and page 2
506 // in IE. Then it tests back and forward using context menu
507 // Disabling this test as it won't work as per the current chrome external tab
508 // design.
509 // http://code.google.com/p/chromium/issues/detail?id=46615
510 TEST_F(ContextMenuTest, DISABLED_BackForwardWithSwitch) {
511 std::wstring page1 = GetLinkPageUrl();
512 std::wstring page2 = GetSimplePageUrl();
513 InSequence expect_in_sequence_for_scope;
514
515 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page1)))
516 .WillOnce(Navigate(&ie_mock_, page2));
517
518 server_mock_.ExpectAndServeRequest(CFInvocation::None(), page2);
519 // Go back using Rt-Click + DOWN + ENTER
520 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page2)))
521 .WillOnce(testing::DoAll(
522 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
523 simulate_input::RIGHT),
524 SendExtendedKeysEnter(&loop_, 500, VK_DOWN, 1,
525 simulate_input::NONE)));
526
527 // Go forward using Rt-Click + DOWN + DOWN + ENTER
528 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page1)))
529 .WillOnce(testing::DoAll(
530 DelaySendMouseClick(&ie_mock_, &loop_, 0, 10, 10,
531 simulate_input::RIGHT),
532 SendExtendedKeysEnter(&loop_, 500, VK_DOWN, 2,
533 simulate_input::NONE)));
534
535 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page2)))
536 .WillOnce(CloseBrowserMock(&ie_mock_));
537
538 LaunchIEAndNavigate(page1);
539 }
540
541 } // namespace chrome_frame_test
OLDNEW
« no previous file with comments | « chrome_frame/test/test_with_web_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698