| OLD | NEW |
| 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 <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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::NONE))); | 96 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::NONE))); |
| 97 | 97 |
| 98 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1))) | 98 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page1))) |
| 99 .WillOnce(testing::DoAll( | 99 .WillOnce(testing::DoAll( |
| 100 SetFocusToRenderer(&ie_mock_), | 100 SetFocusToRenderer(&ie_mock_), |
| 101 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::SHIFT))); | 101 DelaySendScanCode(&loop_, 1000, bkspace, simulate_input::SHIFT))); |
| 102 | 102 |
| 103 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) | 103 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(page2))) |
| 104 .WillOnce(CloseBrowserMock(&ie_mock_)); | 104 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 105 | 105 |
| 106 LaunchIENavigateAndLoop(page1, | 106 LaunchIENavigateAndLoop(page1, kChromeFrameVeryLongNavigationTimeout); |
| 107 kChromeFrameVeryLongNavigationTimeoutInSeconds); | |
| 108 } | 107 } |
| 109 | 108 |
| 110 // Tests new window behavior with ctrl+N. | 109 // Tests new window behavior with ctrl+N. |
| 111 TEST_P(FullTabUITest, CtrlN) { | 110 TEST_P(FullTabUITest, 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(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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(CloseBrowserMock(&ie_mock_)) | 137 .WillOnce(CloseBrowserMock(&ie_mock_)) |
| 139 .WillOnce(testing::Return()); | 138 .WillOnce(testing::Return()); |
| 140 | 139 |
| 141 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) | 140 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) |
| 142 .Times(testing::AtMost(2)); | 141 .Times(testing::AtMost(2)); |
| 143 | 142 |
| 144 LaunchIENavigateAndLoop(GetSimplePageUrl(), | 143 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 145 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 144 kChromeFrameVeryLongNavigationTimeout); |
| 146 } | 145 } |
| 147 | 146 |
| 148 // Test that Ctrl+F opens the Find dialog. | 147 // Test that Ctrl+F opens the Find dialog. |
| 149 TEST_P(FullTabUITest, CtrlF) { | 148 TEST_P(FullTabUITest, CtrlF) { |
| 150 if (IsWorkstationLocked()) { | 149 if (IsWorkstationLocked()) { |
| 151 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 150 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
| 152 return; | 151 return; |
| 153 } | 152 } |
| 154 | 153 |
| 155 bool is_cf = GetParam().invokes_cf(); | 154 bool is_cf = GetParam().invokes_cf(); |
| 156 if (!is_cf) { | 155 if (!is_cf) { |
| 157 LOG(ERROR) << "Test not implemented for this configuration."; | 156 LOG(ERROR) << "Test not implemented for this configuration."; |
| 158 return; | 157 return; |
| 159 } | 158 } |
| 160 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); | 159 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); |
| 161 MockWindowObserver win_observer_mock; | 160 MockWindowObserver win_observer_mock; |
| 162 InSequence expect_in_sequence_for_scope; | 161 InSequence expect_in_sequence_for_scope; |
| 163 | 162 |
| 164 const char* kFindDialogCaption = "Find"; | 163 const char* kFindDialogCaption = "Find"; |
| 165 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl()))) | 164 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl()))) |
| 166 .WillOnce(testing::DoAll( | 165 .WillOnce(testing::DoAll( |
| 167 WatchWindow(&win_observer_mock, kFindDialogCaption, ""), | 166 WatchWindow(&win_observer_mock, kFindDialogCaption, ""), |
| 168 SetFocusToRenderer(&ie_mock_), | 167 SetFocusToRenderer(&ie_mock_), |
| 169 DelaySendChar(&loop_, 1500, 'f', simulate_input::CONTROL))); | 168 DelaySendChar(&loop_, 1500, 'f', simulate_input::CONTROL))); |
| 170 | 169 |
| 171 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) | 170 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
| 172 .WillOnce(CloseBrowserMock(&ie_mock_)); | 171 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 173 | 172 |
| 174 LaunchIENavigateAndLoop(GetSimplePageUrl(), | 173 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 175 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 174 kChromeFrameVeryLongNavigationTimeout); |
| 176 } | 175 } |
| 177 | 176 |
| 178 // Test that ctrl+r does cause a refresh. | 177 // Test that ctrl+r does cause a refresh. |
| 179 TEST_P(FullTabUITest, CtrlR) { | 178 TEST_P(FullTabUITest, CtrlR) { |
| 180 if (IsWorkstationLocked()) { | 179 if (IsWorkstationLocked()) { |
| 181 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 180 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
| 182 return; | 181 return; |
| 183 } | 182 } |
| 184 | 183 |
| 185 EXPECT_CALL(server_mock_, Get(_, UrlPathEq(GetSimplePageUrl()), _)) | 184 EXPECT_CALL(server_mock_, Get(_, UrlPathEq(GetSimplePageUrl()), _)) |
| 186 .Times(testing::AtMost(2)) | 185 .Times(testing::AtMost(2)) |
| 187 .WillRepeatedly(SendResponse(&server_mock_, GetParam())); | 186 .WillRepeatedly(SendResponse(&server_mock_, GetParam())); |
| 188 | 187 |
| 189 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 188 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
| 190 StrEq(GetSimplePageUrl()))) | 189 StrEq(GetSimplePageUrl()))) |
| 191 .Times(testing::AtMost(2)) | 190 .Times(testing::AtMost(2)) |
| 192 .WillOnce(testing::DoAll( | 191 .WillOnce(testing::DoAll( |
| 193 SetFocusToRenderer(&ie_mock_), | 192 SetFocusToRenderer(&ie_mock_), |
| 194 DelaySendChar(&loop_, 1000, 'r', simulate_input::CONTROL), | 193 DelaySendChar(&loop_, 1000, 'r', simulate_input::CONTROL), |
| 195 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))) | 194 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))) |
| 196 .WillRepeatedly(testing::Return()); | 195 .WillRepeatedly(testing::Return()); |
| 197 | 196 |
| 198 LaunchIENavigateAndLoop(GetSimplePageUrl(), | 197 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 199 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 198 kChromeFrameVeryLongNavigationTimeout); |
| 200 } | 199 } |
| 201 | 200 |
| 202 // Test window close with ctrl+w. | 201 // Test window close with ctrl+w. |
| 203 TEST_P(FullTabUITest, CtrlW) { | 202 TEST_P(FullTabUITest, CtrlW) { |
| 204 if (IsWorkstationLocked()) { | 203 if (IsWorkstationLocked()) { |
| 205 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 204 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
| 206 return; | 205 return; |
| 207 } | 206 } |
| 208 | 207 |
| 209 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 208 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
| 210 StrEq(GetSimplePageUrl()))) | 209 StrEq(GetSimplePageUrl()))) |
| 211 .WillOnce(testing::DoAll( | 210 .WillOnce(testing::DoAll( |
| 212 SetFocusToRenderer(&ie_mock_), | 211 SetFocusToRenderer(&ie_mock_), |
| 213 DelaySendChar(&loop_, 1000, 'w', simulate_input::CONTROL))); | 212 DelaySendChar(&loop_, 1000, 'w', simulate_input::CONTROL))); |
| 214 | 213 |
| 215 LaunchIENavigateAndLoop(GetSimplePageUrl(), | 214 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 216 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 215 kChromeFrameVeryLongNavigationTimeout); |
| 217 } | 216 } |
| 218 | 217 |
| 219 // Test address bar navigation with Alt+d and URL. | 218 // Test address bar navigation with Alt+d and URL. |
| 220 TEST_P(FullTabUITest, AltD) { | 219 TEST_P(FullTabUITest, AltD) { |
| 221 if (IsWorkstationLocked()) { | 220 if (IsWorkstationLocked()) { |
| 222 LOG(ERROR) << "This test cannot be run in a locked workstation."; | 221 LOG(ERROR) << "This test cannot be run in a locked workstation."; |
| 223 return; | 222 return; |
| 224 } | 223 } |
| 225 | 224 |
| 226 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 225 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
| 227 StrEq(GetSimplePageUrl()))) | 226 StrEq(GetSimplePageUrl()))) |
| 228 .WillOnce(testing::DoAll( | 227 .WillOnce(testing::DoAll( |
| 229 SetFocusToRenderer(&ie_mock_), | 228 SetFocusToRenderer(&ie_mock_), |
| 230 TypeUrlInAddressBar(&loop_, GetLinkPageUrl(), 1500))); | 229 TypeUrlInAddressBar(&loop_, GetLinkPageUrl(), 1500))); |
| 231 | 230 |
| 232 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 231 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
| 233 StrEq(GetLinkPageUrl()))) | 232 StrEq(GetLinkPageUrl()))) |
| 234 .WillOnce(CloseBrowserMock(&ie_mock_)); | 233 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 235 | 234 |
| 236 LaunchIENavigateAndLoop(GetSimplePageUrl(), | 235 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 237 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 236 kChromeFrameVeryLongNavigationTimeout); |
| 238 } | 237 } |
| 239 | 238 |
| 240 // Tests that the renderer has focus after navigation. | 239 // Tests that the renderer has focus after navigation. |
| 241 // Flaky, see http://crbug.com/90791 . | 240 // Flaky, see http://crbug.com/90791 . |
| 242 TEST_P(FullTabUITest, DISABLED_RendererHasFocus) { | 241 TEST_P(FullTabUITest, DISABLED_RendererHasFocus) { |
| 243 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), | 242 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), |
| 244 StrEq(GetSimplePageUrl()))) | 243 StrEq(GetSimplePageUrl()))) |
| 245 .WillOnce(testing::DoAll( | 244 .WillOnce(testing::DoAll( |
| 246 ExpectRendererHasFocus(&ie_mock_), | 245 ExpectRendererHasFocus(&ie_mock_), |
| 247 CloseBrowserMock(&ie_mock_))); | 246 CloseBrowserMock(&ie_mock_))); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) | 451 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
| 453 .WillOnce(testing::DoAll( | 452 .WillOnce(testing::DoAll( |
| 454 AccSendCharMessage(file_name_box, L'a'), | 453 AccSendCharMessage(file_name_box, L'a'), |
| 455 AccSetValue(file_name_box, temp_file_path.value()), | 454 AccSetValue(file_name_box, temp_file_path.value()), |
| 456 AccDoDefaultAction(AccObjectMatcher(L"Save", L"push button")))); | 455 AccDoDefaultAction(AccObjectMatcher(L"Save", L"push button")))); |
| 457 | 456 |
| 458 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) | 457 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) |
| 459 .WillOnce(CloseWhenFileSaved(&ie_mock_, temp_file_path, 8000)); | 458 .WillOnce(CloseWhenFileSaved(&ie_mock_, temp_file_path, 8000)); |
| 460 | 459 |
| 461 LaunchIENavigateAndLoop(GetTestUrl(L"save_as_context_menu.html"), | 460 LaunchIENavigateAndLoop(GetTestUrl(L"save_as_context_menu.html"), |
| 462 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 461 kChromeFrameVeryLongNavigationTimeout); |
| 463 ASSERT_TRUE(file_util::DieFileDie(temp_file_path, false)); | 462 ASSERT_TRUE(file_util::DieFileDie(temp_file_path, false)); |
| 464 } | 463 } |
| 465 | 464 |
| 466 protected: | 465 protected: |
| 467 // Html page that holds a text field for context menu testing. | 466 // Html page that holds a text field for context menu testing. |
| 468 std::wstring context_menu_page_url; | 467 std::wstring context_menu_page_url; |
| 469 // Title of said html page. | 468 // Title of said html page. |
| 470 std::wstring context_menu_page_title; | 469 std::wstring context_menu_page_title; |
| 471 // This is the text value used to test cut/copy/paste etc. | 470 // This is the text value used to test cut/copy/paste etc. |
| 472 const std::wstring kTextFieldInitValue; | 471 const std::wstring kTextFieldInitValue; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 OpenContextMenuAsync())); | 577 OpenContextMenuAsync())); |
| 579 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) | 578 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) |
| 580 .WillOnce(AccLeftClick(AccObjectMatcher(L"Inspect element"))); | 579 .WillOnce(AccLeftClick(AccObjectMatcher(L"Inspect element"))); |
| 581 | 580 |
| 582 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) | 581 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
| 583 .WillOnce(DelayDoCloseWindow(5000)); // wait to catch possible crash | 582 .WillOnce(DelayDoCloseWindow(5000)); // wait to catch possible crash |
| 584 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) | 583 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) |
| 585 .WillOnce(CloseBrowserMock(&ie_mock_)); | 584 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 586 | 585 |
| 587 LaunchIENavigateAndLoop(GetSimplePageUrl(), | 586 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
| 588 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 587 kChromeFrameVeryLongNavigationTimeout); |
| 589 } | 588 } |
| 590 | 589 |
| 591 // http://code.google.com/p/chromium/issues/detail?id=83114 | 590 // http://code.google.com/p/chromium/issues/detail?id=83114 |
| 592 TEST_F(ContextMenuTest, DISABLED_CFSavePageAs) { | 591 TEST_F(ContextMenuTest, DISABLED_CFSavePageAs) { |
| 593 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 | 592 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 594 // for more information on why this test is disabled for Vista with IE7. | 593 // for more information on why this test is disabled for Vista with IE7. |
| 595 if (base::win::GetVersion() == base::win::VERSION_VISTA && | 594 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 596 GetInstalledIEVersion() == IE_7) { | 595 GetInstalledIEVersion() == IE_7) { |
| 597 LOG(INFO) << "Not running test on Vista with IE7"; | 596 LOG(INFO) << "Not running test on Vista with IE7"; |
| 598 return; | 597 return; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 .WillOnce(testing::DoAll( | 1022 .WillOnce(testing::DoAll( |
| 1024 VerifyPageLoad(&ie_mock_, IN_IE, page2), | 1023 VerifyPageLoad(&ie_mock_, IN_IE, page2), |
| 1025 OpenContextMenuAsync())); | 1024 OpenContextMenuAsync())); |
| 1026 | 1025 |
| 1027 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) | 1026 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) |
| 1028 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); | 1027 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); |
| 1029 | 1028 |
| 1030 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) | 1029 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) |
| 1031 .WillOnce(CloseBrowserMock(&ie_mock_)); | 1030 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 1032 | 1031 |
| 1033 LaunchIENavigateAndLoop(page1, | 1032 LaunchIENavigateAndLoop(page1, kChromeFrameVeryLongNavigationTimeout); |
| 1034 kChromeFrameVeryLongNavigationTimeoutInSeconds); | |
| 1035 } | 1033 } |
| 1036 | 1034 |
| 1037 } // namespace chrome_frame_test | 1035 } // namespace chrome_frame_test |
| OLD | NEW |