Index: printing/printing_context_win_unittest.cc |
diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc |
index 088873614d2e31d9bef988a265da5cdf3e698e0c..9ba225e5755d66896fe7afa4b1363c5995318fc0 100644 |
--- a/printing/printing_context_win_unittest.cc |
+++ b/printing/printing_context_win_unittest.cc |
@@ -29,7 +29,7 @@ class PrintingContextTest : public PrintingTest<testing::Test>, |
} |
// PrintingContext::Delegate methods. |
- gfx::NativeView GetParentView() override { return NULL; } |
+ gfx::NativeView GetParentView() override { return nullptr; } |
std::string GetAppLocale() override { return std::string(); } |
protected: |
@@ -44,12 +44,13 @@ namespace { |
struct FreeHandleTraits { |
typedef HANDLE Handle; |
static void CloseHandle(HANDLE handle) { GlobalFree(handle); } |
- static bool IsHandleValid(HANDLE handle) { return handle != NULL; } |
- static HANDLE NullHandle() { return NULL; } |
+ static bool IsHandleValid(HANDLE handle) { return handle != nullptr; } |
+ static HANDLE NullHandle() { return nullptr; } |
}; |
-typedef base::win::GenericScopedHandle<FreeHandleTraits, |
- base::win::DummyVerifierTraits> |
- ScopedGlobalAlloc; |
+ |
+using ScopedGlobalAlloc = |
+ base::win::GenericScopedHandle<FreeHandleTraits, |
+ base::win::DummyVerifierTraits>; |
} // namespace |
@@ -77,10 +78,10 @@ class MockPrintingContextWin : public PrintingContextSystemDialogWin { |
if (!printer.OpenPrinter(printer_name.c_str())) |
return E_FAIL; |
- const DEVMODE* dev_mode = NULL; |
- lppd->hDC = NULL; |
- lppd->hDevMode = NULL; |
- lppd->hDevNames = NULL; |
+ const DEVMODE* dev_mode = nullptr; |
+ lppd->hDC = nullptr; |
+ lppd->hDevMode = nullptr; |
+ lppd->hDevNames = nullptr; |
PrinterInfo2 info_2; |
if (info_2.Init(printer.Get())) |
@@ -89,7 +90,7 @@ class MockPrintingContextWin : public PrintingContextSystemDialogWin { |
return E_FAIL; |
base::win::ScopedCreateDC hdc( |
- CreateDC(L"WINSPOOL", printer_name.c_str(), NULL, dev_mode)); |
+ CreateDC(L"WINSPOOL", printer_name.c_str(), nullptr, dev_mode)); |
if (!hdc.Get()) |
return E_FAIL; |
@@ -102,7 +103,7 @@ class MockPrintingContextWin : public PrintingContextSystemDialogWin { |
return E_FAIL; |
memcpy(dev_mode_ptr, dev_mode, dev_mode_size); |
GlobalUnlock(dev_mode_mem.Get()); |
- dev_mode_ptr = NULL; |
+ dev_mode_ptr = nullptr; |
size_t driver_size = |
2 + sizeof(wchar_t) * lstrlen(info_2.get()->pDriverName); |
@@ -131,7 +132,7 @@ class MockPrintingContextWin : public PrintingContextSystemDialogWin { |
memcpy(reinterpret_cast<uint8_t*>(dev_names_ptr) + dev_names->wOutputOffset, |
info_2.get()->pPortName, port_size); |
GlobalUnlock(dev_names_mem.Get()); |
- dev_names_ptr = NULL; |
+ dev_names_ptr = nullptr; |
lppd->hDC = hdc.Take(); |
lppd->hDevMode = dev_mode_mem.Take(); |
@@ -164,14 +165,14 @@ TEST_F(PrintingContextTest, Base) { |
PrintSettings settings; |
settings.set_device_name(GetDefaultPrinter()); |
// Initialize it. |
- std::unique_ptr<PrintingContext> context(PrintingContext::Create(this)); |
- EXPECT_EQ(PrintingContext::OK, context->InitWithSettings(settings)); |
+ PrintingContextWin context(this); |
+ EXPECT_EQ(PrintingContext::OK, context.InitWithSettingsForTest(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(), nullptr, MWT_IDENTITY)); |
} |
} // namespace printing |