Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 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 <ocidl.h> | 5 #include <ocidl.h> |
| 6 #include <commdlg.h> | 6 #include <commdlg.h> |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "printing/printing_test.h" | 11 #include "printing/printing_test.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 31 // This is a fake PrintDlgEx implementation that sets the right fields in | 31 // This is a fake PrintDlgEx implementation that sets the right fields in |
| 32 // |lppd| to trigger a bug in older revisions of PrintingContext. | 32 // |lppd| to trigger a bug in older revisions of PrintingContext. |
| 33 HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { | 33 HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { |
| 34 // The interesting bits: | 34 // The interesting bits: |
| 35 // Pretend the user hit print | 35 // Pretend the user hit print |
| 36 lppd->dwResultAction = PD_RESULT_PRINT; | 36 lppd->dwResultAction = PD_RESULT_PRINT; |
| 37 | 37 |
| 38 // Pretend the page range is 1-5, but since lppd->Flags does not have | 38 // Pretend the page range is 1-5, but since lppd->Flags does not have |
| 39 // PD_SELECTION set, this really shouldn't matter. | 39 // PD_SELECTION set, this really shouldn't matter. |
| 40 lppd->nPageRanges = 1; | 40 lppd->nPageRanges = 1; |
| 41 lppd->lpPageRanges = new PRINTPAGERANGE[1]; | |
|
Lei Zhang
2011/01/05 01:34:54
This is not needed, since we only call PrintDlgExM
| |
| 42 lppd->lpPageRanges[0].nFromPage = 1; | 41 lppd->lpPageRanges[0].nFromPage = 1; |
| 43 lppd->lpPageRanges[0].nToPage = 5; | 42 lppd->lpPageRanges[0].nToPage = 5; |
| 44 | 43 |
| 45 // Painful paperwork. | 44 // Painful paperwork. |
| 46 std::wstring printer_name = PrintingContextTest::GetDefaultPrinter(); | 45 std::wstring printer_name = PrintingContextTest::GetDefaultPrinter(); |
| 47 HANDLE printer; | 46 HANDLE printer; |
| 48 if (!OpenPrinter(const_cast<wchar_t*>(printer_name.c_str()), &printer, NULL)) | 47 if (!OpenPrinter(const_cast<wchar_t*>(printer_name.c_str()), &printer, NULL)) |
| 49 return E_FAIL; | 48 return E_FAIL; |
| 50 | 49 |
| 51 scoped_array<uint8> buffer; | 50 scoped_array<uint8> buffer; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 context.AskUserForSettings( | 132 context.AskUserForSettings( |
| 134 NULL, | 133 NULL, |
| 135 123, | 134 123, |
| 136 false, | 135 false, |
| 137 NewCallback(static_cast<PrintingContextTest*>(this), | 136 NewCallback(static_cast<PrintingContextTest*>(this), |
| 138 &PrintingContextTest::PrintSettingsCallback)); | 137 &PrintingContextTest::PrintSettingsCallback)); |
| 139 ASSERT_EQ(printing::PrintingContext::OK, result()); | 138 ASSERT_EQ(printing::PrintingContext::OK, result()); |
| 140 printing::PrintSettings settings = context.settings(); | 139 printing::PrintSettings settings = context.settings(); |
| 141 EXPECT_EQ(settings.ranges.size(), 0); | 140 EXPECT_EQ(settings.ranges.size(), 0); |
| 142 } | 141 } |
| OLD | NEW |