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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/scoped_comptr_win.h" | 7 #include "base/scoped_comptr_win.h" |
8 #include "base/test/test_file_util.h" | 8 #include "base/test/test_file_util.h" |
| 9 #include "base/win/windows_version.h" |
9 #include "chrome_frame/test/chrome_frame_test_utils.h" | 10 #include "chrome_frame/test/chrome_frame_test_utils.h" |
10 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" | 11 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" |
11 #include "chrome_frame/test/mock_ie_event_sink_actions.h" | 12 #include "chrome_frame/test/mock_ie_event_sink_actions.h" |
12 #include "chrome_frame/test/mock_ie_event_sink_test.h" | 13 #include "chrome_frame/test/mock_ie_event_sink_test.h" |
13 | 14 |
14 // Needed for CreateFunctor. | 15 // Needed for CreateFunctor. |
15 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING | 16 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
16 #include "testing/gmock_mutant.h" | 17 #include "testing/gmock_mutant.h" |
17 | 18 |
18 using testing::_; | 19 using testing::_; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 374 |
374 // OnNavigateError can take a long time to fire. | 375 // OnNavigateError can take a long time to fire. |
375 LaunchIENavigateAndLoop(parent_url, | 376 LaunchIENavigateAndLoop(parent_url, |
376 kChromeFrameLongNavigationTimeoutInSeconds * 4); | 377 kChromeFrameLongNavigationTimeoutInSeconds * 4); |
377 ASSERT_TRUE(new_window_mock.event_sink()->web_browser2() != NULL); | 378 ASSERT_TRUE(new_window_mock.event_sink()->web_browser2() != NULL); |
378 } | 379 } |
379 | 380 |
380 // Tests that the parent window can successfully close its popup through | 381 // Tests that the parent window can successfully close its popup through |
381 // the javascript close method. | 382 // the javascript close method. |
382 TEST_P(FullTabNavigationTest, JavascriptWindowOpenCanClose) { | 383 TEST_P(FullTabNavigationTest, JavascriptWindowOpenCanClose) { |
| 384 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 385 // for more information on why this test is disabled for Vista with IE7. |
| 386 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 387 GetInstalledIEVersion() == IE_7) { |
| 388 LOG(INFO) << "Not running test on Vista with IE7"; |
| 389 return; |
| 390 } |
| 391 |
383 std::wstring parent_url = GetTestUrl(L"window_open.html?simple.html"); | 392 std::wstring parent_url = GetTestUrl(L"window_open.html?simple.html"); |
384 MockAccEventObserver acc_observer; | 393 MockAccEventObserver acc_observer; |
385 MockIEEventSink new_window_mock; | 394 MockIEEventSink new_window_mock; |
386 ie_mock_.ExpectAnyNavigations(); | 395 ie_mock_.ExpectAnyNavigations(); |
387 new_window_mock.ExpectAnyNavigations(); | 396 new_window_mock.ExpectAnyNavigations(); |
388 server_mock_.ExpectAndServeAnyRequests(GetParam()); | 397 server_mock_.ExpectAndServeAnyRequests(GetParam()); |
389 | 398 |
390 // Tell the page to open the popup. Some versions of IE will prevent a popup | 399 // Tell the page to open the popup. Some versions of IE will prevent a popup |
391 // unless a click is involved. | 400 // unless a click is involved. |
392 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), StrEq(parent_url))); | 401 EXPECT_CALL(ie_mock_, OnLoad(GetParam().invokes_cf(), StrEq(parent_url))); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 testing::Values(NavigationTransitionTestParameter( | 469 testing::Values(NavigationTransitionTestParameter( |
461 CFInvocation::META_TAG, CFInvocation::META_TAG))); | 470 CFInvocation::META_TAG, CFInvocation::META_TAG))); |
462 INSTANTIATE_TEST_CASE_P( | 471 INSTANTIATE_TEST_CASE_P( |
463 CFToIE, | 472 CFToIE, |
464 NavigationTransitionTest, | 473 NavigationTransitionTest, |
465 testing::Values(NavigationTransitionTestParameter( | 474 testing::Values(NavigationTransitionTestParameter( |
466 CFInvocation::META_TAG, CFInvocation::NONE))); | 475 CFInvocation::META_TAG, CFInvocation::NONE))); |
467 | 476 |
468 // Test window.open calls. | 477 // Test window.open calls. |
469 TEST_P(NavigationTransitionTest, JavascriptWindowOpen) { | 478 TEST_P(NavigationTransitionTest, JavascriptWindowOpen) { |
| 479 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 480 // for more information on why this test is disabled for Vista with IE7. |
| 481 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 482 GetInstalledIEVersion() == IE_7) { |
| 483 LOG(INFO) << "Not running test on Vista with IE7"; |
| 484 return; |
| 485 } |
| 486 |
470 std::wstring parent_url = GetTestUrl(L"window_open.html?simple.html"); | 487 std::wstring parent_url = GetTestUrl(L"window_open.html?simple.html"); |
471 std::wstring new_window_url = GetSimplePageUrl(); | 488 std::wstring new_window_url = GetSimplePageUrl(); |
472 MockAccEventObserver acc_observer; | 489 MockAccEventObserver acc_observer; |
473 testing::StrictMock<MockIEEventSink> new_window_mock; | 490 testing::StrictMock<MockIEEventSink> new_window_mock; |
474 | 491 |
475 ie_mock_.ExpectNavigation(page1_.invokes_cf(), parent_url); | 492 ie_mock_.ExpectNavigation(page1_.invokes_cf(), parent_url); |
476 server_mock_.ExpectAndServeRequest(page1_, parent_url); | 493 server_mock_.ExpectAndServeRequest(page1_, parent_url); |
477 EXPECT_CALL(ie_mock_, OnLoad(page1_.invokes_cf(), StrEq(parent_url))); | 494 EXPECT_CALL(ie_mock_, OnLoad(page1_.invokes_cf(), StrEq(parent_url))); |
478 // Tell the page to open the popup. Some versions of IE will prevent a popup | 495 // Tell the page to open the popup. Some versions of IE will prevent a popup |
479 // unless a click is involved. | 496 // unless a click is involved. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 // See bug http://crbug.com/36694 | 751 // See bug http://crbug.com/36694 |
735 // This test does the following:- | 752 // This test does the following:- |
736 // Navigates IE to a URL which in ChromeFrame. | 753 // Navigates IE to a URL which in ChromeFrame. |
737 // Performs a top level form post in the document | 754 // Performs a top level form post in the document |
738 // In response to the POST we send over an attachment via the | 755 // In response to the POST we send over an attachment via the |
739 // content-disposition header. | 756 // content-disposition header. |
740 // IE brings up a file open dialog in this context. | 757 // IE brings up a file open dialog in this context. |
741 // We bring up the Save dialog via accessibility and save the file | 758 // We bring up the Save dialog via accessibility and save the file |
742 // and validate that all is well. | 759 // and validate that all is well. |
743 TEST_F(FullTabDownloadTest, CF_DownloadFileFromPost) { | 760 TEST_F(FullTabDownloadTest, CF_DownloadFileFromPost) { |
| 761 // Please see http://code.google.com/p/chromium/issues/detail?id=60987 |
| 762 // for more information on why this test is disabled for Vista with IE7. |
| 763 if (base::win::GetVersion() == base::win::VERSION_VISTA && |
| 764 GetInstalledIEVersion() == IE_7) { |
| 765 LOG(INFO) << "Not running test on Vista with IE7"; |
| 766 return; |
| 767 } |
744 chrome_frame_test::MockWindowObserver download_watcher; | 768 chrome_frame_test::MockWindowObserver download_watcher; |
745 download_watcher.WatchWindow("File Download", ""); | 769 download_watcher.WatchWindow("File Download", ""); |
746 | 770 |
747 chrome_frame_test::MockWindowObserver save_dialog_watcher; | 771 chrome_frame_test::MockWindowObserver save_dialog_watcher; |
748 save_dialog_watcher.WatchWindow("Save As", ""); | 772 save_dialog_watcher.WatchWindow("Save As", ""); |
749 | 773 |
750 EXPECT_CALL(server_mock_, Get(_, StrEq(L"/post_source.html"), _)).WillOnce( | 774 EXPECT_CALL(server_mock_, Get(_, StrEq(L"/post_source.html"), _)).WillOnce( |
751 SendFast( | 775 SendFast( |
752 "HTTP/1.1 200 OK\r\n" | 776 "HTTP/1.1 200 OK\r\n" |
753 "Content-Type: text/html\r\n", | 777 "Content-Type: text/html\r\n", |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 DelayRefresh(&ie_mock_, &loop_, 2000), | 958 DelayRefresh(&ie_mock_, &loop_, 2000), |
935 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))); | 959 DelayCloseBrowserMock(&loop_, 4000, &ie_mock_))); |
936 | 960 |
937 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(src_url))) | 961 EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(src_url))) |
938 .Times(2); | 962 .Times(2); |
939 | 963 |
940 LaunchIEAndNavigate(src_url); | 964 LaunchIEAndNavigate(src_url); |
941 } | 965 } |
942 | 966 |
943 } // namespace chrome_frame_test | 967 } // namespace chrome_frame_test |
OLD | NEW |