Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), StrEq(key_event_url))) | 60 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), StrEq(key_event_url))) |
| 61 .WillOnce(PostCharMessagesToRenderer(&ie_mock_, input)); | 61 .WillOnce(PostCharMessagesToRenderer(&ie_mock_, input)); |
| 62 | 62 |
| 63 EXPECT_CALL(ie_mock_, OnMessage(StrCaseEq(UTF8ToWide(input)), _, _)) | 63 EXPECT_CALL(ie_mock_, OnMessage(StrCaseEq(UTF8ToWide(input)), _, _)) |
| 64 .WillOnce(CloseBrowserMock(&ie_mock_)); | 64 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 65 | 65 |
| 66 LaunchIEAndNavigate(key_event_url); | 66 LaunchIEAndNavigate(key_event_url); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Tests keyboard shortcuts for back and forward. | 69 // Tests keyboard shortcuts for back and forward. |
| 70 // Marking this test FLAKY as it fails at times on the buildbot. | 70 TEST_P(FullTabUITest, KeyboardBackForward) { |
| 71 // http://code.google.com/p/chromium/issues/detail?id=26549 | 71 if (IsWorkstationLocked()) { |
| 72 TEST_P(FullTabUITest, FLAKY_KeyboardBackForward) { | 72 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
| 73 return; | |
| 74 } | |
| 75 | |
| 73 std::wstring page1 = GetSimplePageUrl(); | 76 std::wstring page1 = GetSimplePageUrl(); |
| 74 std::wstring page2 = GetLinkPageUrl(); | 77 std::wstring page2 = GetLinkPageUrl(); |
| 75 bool in_cf = GetParam().invokes_cf(); | 78 bool in_cf = GetParam().invokes_cf(); |
| 76 InSequence expect_in_sequence_for_scope; | 79 InSequence expect_in_sequence_for_scope; |
| 77 | 80 |
| 78 // This test performs the following steps. | 81 // This test performs the following steps. |
| 79 // 1. Launches IE and navigates to page1 | 82 // 1. Launches IE and navigates to page1 |
| 80 // 2. It then navigates to page2 | 83 // 2. It then navigates to page2 |
| 81 // 3. Sends the VK_BACK keystroke to IE, which should navigate back to | 84 // 3. Sends the VK_BACK keystroke to IE, which should navigate back to |
| 82 // page 1 | 85 // page 1 |
| 83 // 4. Sends the Shift + VK_BACK keystroke to IE which should navigate | 86 // 4. Sends the Shift + VK_BACK keystroke to IE which should navigate |
| 84 // forward to page2 | 87 // forward to page2 |
| 85 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1))) | 88 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1))) |
| 86 .WillOnce(Navigate(&ie_mock_, page2)); | 89 .WillOnce(Navigate(&ie_mock_, page2)); |
| 87 | 90 |
| 88 short bkspace = VkKeyScanA(VK_BACK); // NOLINT | 91 short bkspace = VkKeyScanA(VK_BACK); // NOLINT |
| 89 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) | 92 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) |
| 90 .WillOnce(testing::DoAll( | 93 .WillOnce(testing::DoAll( |
| 91 SetFocusToRenderer(&ie_mock_), | 94 SetFocusToRenderer(&ie_mock_), |
| 92 DelaySendScanCode(&loop_, 500, bkspace, simulate_input::NONE))); | 95 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::NONE))); |
| 93 | 96 |
| 94 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1))) | 97 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1))) |
| 95 .WillOnce(testing::DoAll( | 98 .WillOnce(testing::DoAll( |
| 96 SetFocusToRenderer(&ie_mock_), | 99 SetFocusToRenderer(&ie_mock_), |
| 97 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::SHIFT))); | 100 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::SHIFT))); |
| 98 | 101 |
| 99 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) | 102 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) |
| 100 .WillOnce(CloseBrowserMock(&ie_mock_)); | 103 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 101 | 104 |
| 102 LaunchIENavigateAndLoop(page1, | 105 LaunchIENavigateAndLoop(page1, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 128 DelaySendChar(&loop_, 1000, 'n', simulate_input::CONTROL))); | 131 DelaySendChar(&loop_, 1000, 'n', simulate_input::CONTROL))); |
| 129 | 132 |
| 130 // 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 |
| 131 // reliably delivered immediately upon receipt of the window open event. | 134 // reliably delivered immediately upon receipt of the window open event. |
| 132 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) | 135 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
| 133 .Times(testing::AtMost(2)) | 136 .Times(testing::AtMost(2)) |
| 134 .WillOnce(DelayDoCloseWindow(500)) | 137 .WillOnce(DelayDoCloseWindow(500)) |
| 135 .WillOnce(testing::Return()); | 138 .WillOnce(testing::Return()); |
| 136 | 139 |
| 137 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) | 140 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) |
| 141 .Times(testing::AtMost(2)) | |
| 138 .WillOnce(CloseBrowserMock(&ie_mock_)); | 142 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 139 | 143 |
|
ananta
2010/11/12 21:10:34
Add another .WillOnce here? Perhaps .WillOnce(test
| |
| 140 LaunchIEAndNavigate(GetSimplePageUrl()); | 144 LaunchIEAndNavigate(GetSimplePageUrl()); |
| 141 } | 145 } |
| 142 | 146 |
| 143 // Test that Ctrl+F opens the Find dialog. | 147 // Test that Ctrl+F opens the Find dialog. |
| 144 TEST_P(FullTabUITest, CtrlF) { | 148 TEST_P(FullTabUITest, CtrlF) { |
| 145 if (IsWorkstationLocked()) { | 149 if (IsWorkstationLocked()) { |
| 146 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 150 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
| 147 return; | 151 return; |
| 148 } | 152 } |
| 149 | 153 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) | 742 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) |
| 739 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); | 743 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); |
| 740 | 744 |
| 741 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) | 745 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) |
| 742 .WillOnce(CloseBrowserMock(&ie_mock_)); | 746 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 743 | 747 |
| 744 LaunchIEAndNavigate(page1); | 748 LaunchIEAndNavigate(page1); |
| 745 } | 749 } |
| 746 | 750 |
| 747 } // namespace chrome_frame_test | 751 } // namespace chrome_frame_test |
| OLD | NEW |