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 <cups/cups.h> | 5 #include <cups/cups.h> |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 it != test_cases.end(); ++it) { | 214 it != test_cases.end(); ++it) { |
215 num_options = 0; | 215 num_options = 0; |
216 options = NULL; | 216 options = NULL; |
217 printing_internal::parse_lpoptions(userLpOptionsFile, it->printer_name, | 217 printing_internal::parse_lpoptions(userLpOptionsFile, it->printer_name, |
218 &num_options, &options); | 218 &num_options, &options); |
219 ASSERT_EQ(num_options, it->expected_option_count); | 219 ASSERT_EQ(num_options, it->expected_option_count); |
220 EXPECT_EQ(num_options != 0, options != NULL); | 220 EXPECT_EQ(num_options != 0, options != NULL); |
221 cupsFreeOptions(num_options, options); | 221 cupsFreeOptions(num_options, options); |
222 } | 222 } |
223 } | 223 } |
224 | |
225 // Test duplex detection code, which regressed in http://crbug.com/103999. | |
226 TEST(PrintSystemTaskProxyTest, DetectDuplexModeCUPS) { | |
kmadhusu
2011/11/16 20:43:29
Can you add another test for windows duplex settin
Lei Zhang
2011/11/17 00:20:16
That's beyond the scope of this CL.
kmadhusu
2011/11/17 01:03:00
From my understanding, the purpose of this CL to a
| |
227 // Specifies the test ppd data. | |
228 printing::PrinterCapsAndDefaults printer_info; | |
229 printer_info.printer_capabilities.append( | |
230 "*PPD-Adobe: \"4.3\"\n\n" | |
231 "*OpenGroup: General/General\n\n" | |
232 "*OpenUI *Duplex/Double-Sided Printing: PickOne\n" | |
233 "*DefaultDuplex: None\n" | |
234 "*Duplex None/Off: " | |
235 "\"<</Duplex false>>setpagedevice\"\n" | |
236 "*Duplex DuplexNoTumble/Long Edge (Standard): " | |
237 "\"<</Duplex true/Tumble false>>setpagedevice\"\n" | |
238 "*Duplex DuplexTumble/Short Edge (Flip): " | |
239 "\"<</Duplex true/Tumble true>>setpagedevice\"\n" | |
240 "*CloseUI: *Duplex\n\n" | |
241 "*CloseGroup: General\n"); | |
242 | |
kmadhusu
2011/11/16 20:43:29
nit: remove blank line
Lei Zhang
2011/11/17 00:20:16
Done.
| |
243 | |
244 bool set_color_as_default = false; | |
245 bool set_duplex_as_default = false; | |
246 int printer_color_space_for_color = printing::UNKNOWN_COLOR_MODEL; | |
247 int printer_color_space_for_black = printing::UNKNOWN_COLOR_MODEL; | |
248 int default_duplex_setting_value = printing::UNKNOWN_DUPLEX_MODE; | |
249 | |
250 scoped_refptr<PrintSystemTaskProxy> test_proxy; | |
251 bool res = test_proxy->GetPrinterCapabilitiesCUPS( | |
252 printer_info, | |
253 "InvalidPrinter", | |
254 &set_color_as_default, | |
255 &printer_color_space_for_color, | |
256 &printer_color_space_for_black, | |
257 &set_duplex_as_default, | |
258 &default_duplex_setting_value); | |
259 ASSERT_TRUE(res); | |
260 EXPECT_FALSE(set_duplex_as_default); | |
261 EXPECT_EQ(printing::SIMPLEX, default_duplex_setting_value); | |
kmadhusu
2011/11/16 20:43:29
Can you add another test to verify that a ppd with
Lei Zhang
2011/11/17 00:20:16
Done.
| |
262 } | |
OLD | NEW |