diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 22:21:17 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 22:21:17 +0000 |
commit | 51e8d9357bb1738b462baa48da9f86e016f936ce (patch) | |
tree | 463241b65d5c3993992f62e313d49aebce220bfc /printing/printing_context_win_unittest.cc | |
parent | c27a5ed3f25971f028dd1baedd73efb59497ceeb (diff) | |
download | chromium_src-51e8d9357bb1738b462baa48da9f86e016f936ce.zip chromium_src-51e8d9357bb1738b462baa48da9f86e016f936ce.tar.gz chromium_src-51e8d9357bb1738b462baa48da9f86e016f936ce.tar.bz2 |
Printing: Convert PrintingContext into an interface implemented by the separate
platforms.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3610013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printing_context_win_unittest.cc')
-rw-r--r-- | printing/printing_context_win_unittest.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc index 625af54..6e194d1 100644 --- a/printing/printing_context_win_unittest.cc +++ b/printing/printing_context_win_unittest.cc @@ -2,9 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "printing/printing_context.h" +#include <ocidl.h> +#include <commdlg.h> + +#include <string> +#include "base/scoped_ptr.h" #include "printing/printing_test.h" +#include "printing/printing_context.h" +#include "printing/printing_context_win.h" #include "printing/print_settings.h" #include "testing/gtest/include/gtest/gtest.h" @@ -46,7 +52,7 @@ HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { DEVMODE* dev_mode = NULL; PRINTER_INFO_2* info_2 = NULL; - printing::PrintingContext::GetPrinterHelper(printer, 2, &buffer); + printing::PrintingContextWin::GetPrinterHelper(printer, 2, &buffer); if (buffer.get()) { info_2 = reinterpret_cast<PRINTER_INFO_2*>(buffer.get()); if (info_2->pDevMode != NULL) @@ -55,7 +61,7 @@ HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { if (!dev_mode) return E_FAIL; - if (!printing::PrintingContext::AllocateContext(printer_name, dev_mode, + if (!printing::PrintingContextWin::AllocateContext(printer_name, dev_mode, &lppd->hDC)) { return E_FAIL; } @@ -102,18 +108,19 @@ TEST_F(PrintingContextTest, Base) { settings.set_device_name(GetDefaultPrinter()); // Initialize it. - printing::PrintingContext context; - EXPECT_EQ(printing::PrintingContext::OK, context.InitWithSettings(settings)); + scoped_ptr<printing::PrintingContext> context( + printing::PrintingContext::Create()); + EXPECT_EQ(printing::PrintingContext::OK, context->InitWithSettings(settings)); // The print may lie to use and may not support world transformation. // Verify right now. XFORM random_matrix = { 1, 0.1f, 0, 1.5f, 0, 1 }; - EXPECT_TRUE(SetWorldTransform(context.context(), &random_matrix)); - EXPECT_TRUE(ModifyWorldTransform(context.context(), NULL, MWT_IDENTITY)); + EXPECT_TRUE(SetWorldTransform(context->context(), &random_matrix)); + EXPECT_TRUE(ModifyWorldTransform(context->context(), NULL, MWT_IDENTITY)); } TEST_F(PrintingContextTest, PrintAll) { - printing::PrintingContext context; + printing::PrintingContextWin context; context.SetPrintDialog(&PrintDlgExMock); context.AskUserForSettings( NULL, |