OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 ExpectDocumentReadystate(&ie_mock_, READYSTATE_UNINITIALIZED), | 373 ExpectDocumentReadystate(&ie_mock_, READYSTATE_UNINITIALIZED), |
374 DelayExecCommand(&ie_mock_, &loop_, 10, static_cast<GUID*>(NULL), | 374 DelayExecCommand(&ie_mock_, &loop_, 10, static_cast<GUID*>(NULL), |
375 OLECMDID_REFRESH, 0, &empty, &empty))); | 375 OLECMDID_REFRESH, 0, &empty, &empty))); |
376 | 376 |
377 EXPECT_CALL(ie_mock_, OnLoad(_, StrEq(GetSimplePageUrl()))) | 377 EXPECT_CALL(ie_mock_, OnLoad(_, StrEq(GetSimplePageUrl()))) |
378 .WillOnce(CloseBrowserMock(&ie_mock_)); | 378 .WillOnce(CloseBrowserMock(&ie_mock_)); |
379 | 379 |
380 LaunchIEAndNavigate(GetSimplePageUrl()); | 380 LaunchIEAndNavigate(GetSimplePageUrl()); |
381 } | 381 } |
382 | 382 |
| 383 // Test that window.print() on a page results in the native Windows print dialog |
| 384 // appearing rather than Chrome's in-page print preview. |
| 385 TEST_P(FullTabUITest, WindowPrintOpensNativePrintDialog) { |
| 386 std::wstring window_print_url(GetTestUrl(L"window_print.html")); |
| 387 std::wstring window_print_title(L"window.print"); |
| 388 |
| 389 const bool is_cf = GetParam().invokes_cf(); |
| 390 MockWindowObserver win_observer_mock; |
| 391 |
| 392 // When the page is loaded, start watching for the Print dialog to appear. |
| 393 EXPECT_CALL(ie_mock_, OnLoad(is_cf, StrEq(window_print_url))) |
| 394 .WillOnce(WatchWindow(&win_observer_mock, "Print", "")); |
| 395 |
| 396 // When the print dialog opens, close it. |
| 397 EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) |
| 398 .WillOnce(DoCloseWindow()); |
| 399 |
| 400 // When the print dialog closes, close the browser. |
| 401 EXPECT_CALL(win_observer_mock, OnWindowClose(_)) |
| 402 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 403 |
| 404 // Launch IE and navigate to the window_print.html page, which will |
| 405 // window.print() immediately after loading. |
| 406 LaunchIEAndNavigate(window_print_url); |
| 407 } |
| 408 |
383 // Test fixture for tests related to the context menu UI. Since the context | 409 // Test fixture for tests related to the context menu UI. Since the context |
384 // menus for CF and IE are different, these tests are not parameterized. | 410 // menus for CF and IE are different, these tests are not parameterized. |
385 class ContextMenuTest : public MockIEEventSinkTest, public testing::Test { | 411 class ContextMenuTest : public MockIEEventSinkTest, public testing::Test { |
386 public: | 412 public: |
387 ContextMenuTest(): kTextFieldInitValue(L"SomeInitializedTextValue") {} | 413 ContextMenuTest(): kTextFieldInitValue(L"SomeInitializedTextValue") {} |
388 | 414 |
389 virtual void SetUp() { | 415 virtual void SetUp() { |
390 context_menu_page_url = GetTestUrl(L"context_menu.html"); | 416 context_menu_page_url = GetTestUrl(L"context_menu.html"); |
391 // Clear clipboard to make sure there is no effect from previous tests. | 417 // Clear clipboard to make sure there is no effect from previous tests. |
392 SetClipboardText(L""); | 418 SetClipboardText(L""); |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); | 989 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); |
964 | 990 |
965 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) | 991 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) |
966 .WillOnce(CloseBrowserMock(&ie_mock_)); | 992 .WillOnce(CloseBrowserMock(&ie_mock_)); |
967 | 993 |
968 LaunchIENavigateAndLoop(page1, | 994 LaunchIENavigateAndLoop(page1, |
969 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 995 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
970 } | 996 } |
971 | 997 |
972 } // namespace chrome_frame_test | 998 } // namespace chrome_frame_test |
OLD | NEW |