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" |
11 #include "base/win/scoped_variant.h" | 11 #include "base/win/scoped_variant.h" |
| 12 #include "base/win/windows_version.h" |
12 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
13 #include "chrome_frame/test/chrome_frame_test_utils.h" | 14 #include "chrome_frame/test/chrome_frame_test_utils.h" |
14 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" | 15 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" |
15 #include "chrome_frame/test/mock_ie_event_sink_actions.h" | 16 #include "chrome_frame/test/mock_ie_event_sink_actions.h" |
16 #include "chrome_frame/test/mock_ie_event_sink_test.h" | 17 #include "chrome_frame/test/mock_ie_event_sink_test.h" |
17 | 18 |
18 #include "testing/gmock_mutant.h" | 19 #include "testing/gmock_mutant.h" |
19 | 20 |
20 using testing::_; | 21 using testing::_; |
21 using testing::InSequence; | 22 using testing::InSequence; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 StrEq(GetSimplePageUrl()))) | 216 StrEq(GetSimplePageUrl()))) |
216 .WillOnce(testing::DoAll( | 217 .WillOnce(testing::DoAll( |
217 ExpectRendererHasFocus(&ie_mock_), | 218 ExpectRendererHasFocus(&ie_mock_), |
218 CloseBrowserMock(&ie_mock_))); | 219 CloseBrowserMock(&ie_mock_))); |
219 | 220 |
220 LaunchIEAndNavigate(GetSimplePageUrl()); | 221 LaunchIEAndNavigate(GetSimplePageUrl()); |
221 } | 222 } |
222 | 223 |
223 // Tests that view source works. | 224 // Tests that view source works. |
224 TEST_P(FullTabUITest, ViewSource) { | 225 TEST_P(FullTabUITest, ViewSource) { |
| 226 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 227 // for more information on why this test is disabled for Vista with IE7. |
| 228 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 229 GetInstalledIEVersion() == IE_7) { |
| 230 LOG(INFO) << "Not running test on Vista with IE7"; |
| 231 return; |
| 232 } |
| 233 |
225 bool in_cf = GetParam().invokes_cf(); | 234 bool in_cf = GetParam().invokes_cf(); |
226 if (!in_cf) { | 235 if (!in_cf) { |
227 LOG(ERROR) << "Test not implemented for this configuration."; | 236 LOG(ERROR) << "Test not implemented for this configuration."; |
228 return; | 237 return; |
229 } | 238 } |
230 MockIEEventSink view_source_mock; | 239 MockIEEventSink view_source_mock; |
231 view_source_mock.ExpectAnyNavigations(); | 240 view_source_mock.ExpectAnyNavigations(); |
232 InSequence expect_in_sequence_for_scope; | 241 InSequence expect_in_sequence_for_scope; |
233 | 242 |
234 // After navigation invoke view soruce action using IWebBrowser2::ExecWB | 243 // After navigation invoke view soruce action using IWebBrowser2::ExecWB |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 .WillOnce(AccLeftClick(AccObjectMatcher(L"Reload"))); | 416 .WillOnce(AccLeftClick(AccObjectMatcher(L"Reload"))); |
408 | 417 |
409 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl()))) | 418 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(GetSimplePageUrl()))) |
410 .WillOnce(CloseBrowserMock(&ie_mock_)); | 419 .WillOnce(CloseBrowserMock(&ie_mock_)); |
411 | 420 |
412 LaunchIEAndNavigate(GetSimplePageUrl()); | 421 LaunchIEAndNavigate(GetSimplePageUrl()); |
413 } | 422 } |
414 | 423 |
415 // Test view source from the context menu. | 424 // Test view source from the context menu. |
416 TEST_F(ContextMenuTest, CFViewSource) { | 425 TEST_F(ContextMenuTest, CFViewSource) { |
| 426 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 427 // for more information on why this test is disabled for Vista with IE7. |
| 428 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 429 GetInstalledIEVersion() == IE_7) { |
| 430 LOG(INFO) << "Not running test on Vista with IE7"; |
| 431 return; |
| 432 } |
417 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); | 433 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); |
418 MockIEEventSink view_source_mock; | 434 MockIEEventSink view_source_mock; |
419 view_source_mock.ExpectAnyNavigations(); | 435 view_source_mock.ExpectAnyNavigations(); |
420 InSequence expect_in_sequence_for_scope; | 436 InSequence expect_in_sequence_for_scope; |
421 | 437 |
422 // View the page source. | 438 // View the page source. |
423 EXPECT_CALL(acc_observer_, OnAccDocLoad(_)) | 439 EXPECT_CALL(acc_observer_, OnAccDocLoad(_)) |
424 .WillOnce(OpenContextMenuAsync()); | 440 .WillOnce(OpenContextMenuAsync()); |
425 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) | 441 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) |
426 .WillOnce(AccLeftClick(AccObjectMatcher(L"View page source"))); | 442 .WillOnce(AccLeftClick(AccObjectMatcher(L"View page source"))); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) | 509 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
494 .WillOnce(DelayDoCloseWindow(5000)); // wait to catch possible crash | 510 .WillOnce(DelayDoCloseWindow(5000)); // wait to catch possible crash |
495 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) | 511 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) |
496 .WillOnce(CloseBrowserMock(&ie_mock_)); | 512 .WillOnce(CloseBrowserMock(&ie_mock_)); |
497 | 513 |
498 LaunchIENavigateAndLoop(GetSimplePageUrl(), | 514 LaunchIENavigateAndLoop(GetSimplePageUrl(), |
499 kChromeFrameLongNavigationTimeoutInSeconds * 2); | 515 kChromeFrameLongNavigationTimeoutInSeconds * 2); |
500 } | 516 } |
501 | 517 |
502 TEST_F(ContextMenuTest, CFSavePageAs) { | 518 TEST_F(ContextMenuTest, CFSavePageAs) { |
| 519 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 520 // for more information on why this test is disabled for Vista with IE7. |
| 521 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 522 GetInstalledIEVersion() == IE_7) { |
| 523 LOG(INFO) << "Not running test on Vista with IE7"; |
| 524 return; |
| 525 } |
503 ASSERT_NO_FATAL_FAILURE(DoSaveAsTest(L"", L"Save as...", L".html")); | 526 ASSERT_NO_FATAL_FAILURE(DoSaveAsTest(L"", L"Save as...", L".html")); |
504 } | 527 } |
505 | 528 |
506 TEST_F(ContextMenuTest, CFSaveLinkAs) { | 529 TEST_F(ContextMenuTest, CFSaveLinkAs) { |
| 530 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 531 // for more information on why this test is disabled for Vista with IE7. |
| 532 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 533 GetInstalledIEVersion() == IE_7) { |
| 534 LOG(INFO) << "Not running test on Vista with IE7"; |
| 535 return; |
| 536 } |
507 ASSERT_NO_FATAL_FAILURE(DoSaveAsTest(L"link", L"Save link as...", L".zip")); | 537 ASSERT_NO_FATAL_FAILURE(DoSaveAsTest(L"link", L"Save link as...", L".zip")); |
508 } | 538 } |
509 | 539 |
510 // This tests that the about:version page can be opened via the CF context menu. | 540 // This tests that the about:version page can be opened via the CF context menu. |
511 TEST_F(ContextMenuTest, CFAboutVersionLoads) { | 541 TEST_F(ContextMenuTest, CFAboutVersionLoads) { |
| 542 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 543 // for more information on why this test is disabled for Vista with IE7. |
| 544 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 545 GetInstalledIEVersion() == IE_7) { |
| 546 LOG(INFO) << "Not running test on Vista with IE7"; |
| 547 return; |
| 548 } |
512 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); | 549 server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); |
513 const wchar_t* kAboutVersionUrl = L"gcf:about:version"; | 550 const wchar_t* kAboutVersionUrl = L"gcf:about:version"; |
514 const wchar_t* kAboutVersionWithoutProtoUrl = L"about:version"; | 551 const wchar_t* kAboutVersionWithoutProtoUrl = L"about:version"; |
515 MockIEEventSink new_window_mock; | 552 MockIEEventSink new_window_mock; |
516 new_window_mock.ExpectAnyNavigations(); | 553 new_window_mock.ExpectAnyNavigations(); |
517 InSequence expect_in_sequence_for_scope; | 554 InSequence expect_in_sequence_for_scope; |
518 | 555 |
519 EXPECT_CALL(acc_observer_, OnAccDocLoad(_)) | 556 EXPECT_CALL(acc_observer_, OnAccDocLoad(_)) |
520 .WillOnce(OpenContextMenuAsync()); | 557 .WillOnce(OpenContextMenuAsync()); |
521 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) | 558 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) | 645 EXPECT_CALL(acc_observer_, OnMenuPopup(_)) |
609 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); | 646 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); |
610 | 647 |
611 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page2))) | 648 EXPECT_CALL(ie_mock_, OnLoad(IN_IE, StrEq(page2))) |
612 .WillOnce(CloseBrowserMock(&ie_mock_)); | 649 .WillOnce(CloseBrowserMock(&ie_mock_)); |
613 | 650 |
614 LaunchIEAndNavigate(page1); | 651 LaunchIEAndNavigate(page1); |
615 } | 652 } |
616 | 653 |
617 } // namespace chrome_frame_test | 654 } // namespace chrome_frame_test |
OLD | NEW |