| OLD | NEW |
| 1 // Copyright (c) 2011 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/bind.h" |
| 11 #include "base/bind_helpers.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 #include "printing/printing_test.h" | 13 #include "printing/printing_test.h" |
| 12 #include "printing/printing_context.h" | 14 #include "printing/printing_context.h" |
| 13 #include "printing/printing_context_win.h" | 15 #include "printing/printing_context_win.h" |
| 14 #include "printing/print_settings.h" | 16 #include "printing/print_settings.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 18 |
| 17 // This test is automatically disabled if no printer is available. | 19 // This test is automatically disabled if no printer is available. |
| 18 class PrintingContextTest : public PrintingTest<testing::Test> { | 20 class PrintingContextTest : public PrintingTest<testing::Test> { |
| 19 public: | 21 public: |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 160 |
| 159 TEST_F(PrintingContextTest, PrintAll) { | 161 TEST_F(PrintingContextTest, PrintAll) { |
| 160 // Sometimes ::GetDefaultPrinter() fails? bug 61509. | 162 // Sometimes ::GetDefaultPrinter() fails? bug 61509. |
| 161 if (IsTestCaseDisabled()) | 163 if (IsTestCaseDisabled()) |
| 162 return; | 164 return; |
| 163 | 165 |
| 164 std::string dummy_locale; | 166 std::string dummy_locale; |
| 165 printing::PrintingContextWin context(dummy_locale); | 167 printing::PrintingContextWin context(dummy_locale); |
| 166 context.SetPrintDialog(&PrintDlgExMock); | 168 context.SetPrintDialog(&PrintDlgExMock); |
| 167 context.AskUserForSettings( | 169 context.AskUserForSettings( |
| 168 NULL, | 170 NULL, 123, false, base::Bind(&PrintingContextTest::PrintSettingsCallback, |
| 169 123, | 171 base::Unretained(this))); |
| 170 false, | 172 EXPECT_EQ(printing::PrintingContext::OK, result()); |
| 171 NewCallback(static_cast<PrintingContextTest*>(this), | |
| 172 &PrintingContextTest::PrintSettingsCallback)); | |
| 173 ASSERT_EQ(printing::PrintingContext::OK, result()); | |
| 174 printing::PrintSettings settings = context.settings(); | 173 printing::PrintSettings settings = context.settings(); |
| 175 EXPECT_EQ(settings.ranges.size(), 0); | 174 EXPECT_EQ(settings.ranges.size(), 0); |
| 176 } | 175 } |
| OLD | NEW |