Chromium Code Reviews| 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 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", "")); | |
|
robertshield
2012/02/13 20:23:21
Does the print window contain the word "Print" on
grt (UTC plus 2)
2012/02/14 01:48:30
Your guess is as good as mine. I think I have a f
| |
| 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 context_menu_page_title = L"context menu"; | 417 context_menu_page_title = L"context menu"; |
| 392 // Clear clipboard to make sure there is no effect from previous tests. | 418 // Clear clipboard to make sure there is no effect from previous tests. |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 995 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); | 1021 .WillOnce(AccLeftClick(AccObjectMatcher(L"Forward"))); |
| 996 | 1022 |
| 997 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) | 1023 EXPECT_CALL(ie_mock_, OnLoad(IN_CF, StrEq(page3))) |
| 998 .WillOnce(CloseBrowserMock(&ie_mock_)); | 1024 .WillOnce(CloseBrowserMock(&ie_mock_)); |
| 999 | 1025 |
| 1000 LaunchIENavigateAndLoop(page1, | 1026 LaunchIENavigateAndLoop(page1, |
| 1001 kChromeFrameVeryLongNavigationTimeoutInSeconds); | 1027 kChromeFrameVeryLongNavigationTimeoutInSeconds); |
| 1002 } | 1028 } |
| 1003 | 1029 |
| 1004 } // namespace chrome_frame_test | 1030 } // namespace chrome_frame_test |
| OLD | NEW |