Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: printing/printing_context_win_unittest.cc

Issue 5998010: Use the existing PRINTPAGERANGE rather than allocating a new one.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/printing_context_win.cc ('k') | tools/valgrind/drmemory/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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];
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
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 }
OLDNEW
« no previous file with comments | « printing/printing_context_win.cc ('k') | tools/valgrind/drmemory/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698