| 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 "printing/printing_context_win.h" | 5 #include "printing/printing_context_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "printing/backend/printing_info_win.h" | 9 #include "printing/backend/printing_info_win.h" |
| 10 #include "printing/backend/win_helper.h" | 10 #include "printing/backend/win_helper.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 TEST_F(PrintingContextTest, PrintAll) { | 155 TEST_F(PrintingContextTest, PrintAll) { |
| 156 base::MessageLoop message_loop; | 156 base::MessageLoop message_loop; |
| 157 if (IsTestCaseDisabled()) | 157 if (IsTestCaseDisabled()) |
| 158 return; | 158 return; |
| 159 | 159 |
| 160 MockPrintingContextWin context(this); | 160 MockPrintingContextWin context(this); |
| 161 context.AskUserForSettings( | 161 context.AskUserForSettings( |
| 162 123, | 162 123, |
| 163 false, | 163 false, |
| 164 false, |
| 164 base::Bind(&PrintingContextTest::PrintSettingsCallback, | 165 base::Bind(&PrintingContextTest::PrintSettingsCallback, |
| 165 base::Unretained(this))); | 166 base::Unretained(this))); |
| 166 EXPECT_EQ(PrintingContext::OK, result()); | 167 EXPECT_EQ(PrintingContext::OK, result()); |
| 167 PrintSettings settings = context.settings(); | 168 PrintSettings settings = context.settings(); |
| 168 EXPECT_EQ(settings.ranges().size(), 0); | 169 EXPECT_EQ(settings.ranges().size(), 0); |
| 169 } | 170 } |
| 170 | 171 |
| 171 TEST_F(PrintingContextTest, Base) { | 172 TEST_F(PrintingContextTest, Base) { |
| 172 if (IsTestCaseDisabled()) | 173 if (IsTestCaseDisabled()) |
| 173 return; | 174 return; |
| 174 | 175 |
| 175 PrintSettings settings; | 176 PrintSettings settings; |
| 176 settings.set_device_name(GetDefaultPrinter()); | 177 settings.set_device_name(GetDefaultPrinter()); |
| 177 // Initialize it. | 178 // Initialize it. |
| 178 scoped_ptr<PrintingContext> context(PrintingContext::Create(this)); | 179 scoped_ptr<PrintingContext> context(PrintingContext::Create(this)); |
| 179 EXPECT_EQ(PrintingContext::OK, context->InitWithSettings(settings)); | 180 EXPECT_EQ(PrintingContext::OK, context->InitWithSettings(settings)); |
| 180 | 181 |
| 181 // The print may lie to use and may not support world transformation. | 182 // The print may lie to use and may not support world transformation. |
| 182 // Verify right now. | 183 // Verify right now. |
| 183 XFORM random_matrix = { 1, 0.1f, 0, 1.5f, 0, 1 }; | 184 XFORM random_matrix = { 1, 0.1f, 0, 1.5f, 0, 1 }; |
| 184 EXPECT_TRUE(SetWorldTransform(context->context(), &random_matrix)); | 185 EXPECT_TRUE(SetWorldTransform(context->context(), &random_matrix)); |
| 185 EXPECT_TRUE(ModifyWorldTransform(context->context(), NULL, MWT_IDENTITY)); | 186 EXPECT_TRUE(ModifyWorldTransform(context->context(), NULL, MWT_IDENTITY)); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace printing | 189 } // namespace printing |
| OLD | NEW |