diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-12 07:25:41 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-12 07:25:41 +0000 |
commit | d8d17eb0918779607b83afda9c9e3657c78093a4 (patch) | |
tree | 60528bd69eff21539516582c0bcbf5d1a52f9e5d /printing/printing_context_win_unittest.cc | |
parent | efdd1617a387f369cdd42515d99a2e6c21fedc48 (diff) | |
download | chromium_src-d8d17eb0918779607b83afda9c9e3657c78093a4.zip chromium_src-d8d17eb0918779607b83afda9c9e3657c78093a4.tar.gz chromium_src-d8d17eb0918779607b83afda9c9e3657c78093a4.tar.bz2 |
Wrapers for PRINTER_INFO_* and DRIVER_INFO_*.
Review URL: https://chromiumcodereview.appspot.com/11530005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172552 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printing_context_win_unittest.cc')
-rw-r--r-- | printing/printing_context_win_unittest.cc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc index 5917b65..2251e64 100644 --- a/printing/printing_context_win_unittest.cc +++ b/printing/printing_context_win_unittest.cc @@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/memory/scoped_ptr.h" +#include "printing/backend/printing_info_win.h" #include "printing/printing_test.h" #include "printing/printing_context.h" #include "printing/printing_context_win.h" @@ -50,18 +51,15 @@ HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { return E_FAIL; scoped_array<uint8> buffer; - DEVMODE* dev_mode = NULL; - PRINTER_INFO_2* info_2 = NULL; + const DEVMODE* dev_mode = NULL; HRESULT result = S_OK; lppd->hDC = NULL; lppd->hDevMode = NULL; lppd->hDevNames = NULL; - printing::PrintingContextWin::GetPrinterHelper(printer, 2, &buffer); - if (buffer.get()) { - info_2 = reinterpret_cast<PRINTER_INFO_2*>(buffer.get()); - if (info_2->pDevMode != NULL) - dev_mode = info_2->pDevMode; + printing::PrinterInfo2 info_2; + if (info_2.Init(printer)) { + dev_mode = info_2.get()->pDevMode; } if (!dev_mode) { result = E_FAIL; @@ -89,11 +87,12 @@ HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { GlobalUnlock(lppd->hDevMode); dev_mode_ptr = NULL; - size_t driver_size = 2 + sizeof(wchar_t) * lstrlen(info_2->pDriverName); - size_t printer_size = 2 + sizeof(wchar_t) * lstrlen(info_2->pPrinterName); - size_t port_size = 2 + sizeof(wchar_t) * lstrlen(info_2->pPortName); + size_t driver_size = 2 + sizeof(wchar_t) * lstrlen(info_2.get()->pDriverName); + size_t printer_size = 2 + sizeof(wchar_t) * + lstrlen(info_2.get()->pPrinterName); + size_t port_size = 2 + sizeof(wchar_t) * lstrlen(info_2.get()->pPortName); size_t dev_names_size = sizeof(DEVNAMES) + driver_size + printer_size + - port_size; + port_size; lppd->hDevNames = GlobalAlloc(GHND, dev_names_size); if (!lppd->hDevNames) { result = E_FAIL; @@ -108,13 +107,13 @@ HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { dev_names->wDefault = 1; dev_names->wDriverOffset = sizeof(DEVNAMES); memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDriverOffset, - info_2->pDriverName, driver_size); + info_2.get()->pDriverName, driver_size); dev_names->wDeviceOffset = dev_names->wDriverOffset + driver_size; memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wDeviceOffset, - info_2->pPrinterName, printer_size); + info_2.get()->pPrinterName, printer_size); dev_names->wOutputOffset = dev_names->wDeviceOffset + printer_size; memcpy(reinterpret_cast<uint8*>(dev_names_ptr) + dev_names->wOutputOffset, - info_2->pPortName, port_size); + info_2.get()->pPortName, port_size); GlobalUnlock(lppd->hDevNames); dev_names_ptr = NULL; |