OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/webui/print_preview/extension_printer_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/extension_printer_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 if (!initialized_ && !temp_dir_.CreateUniqueTempDir()) { | 291 if (!initialized_ && !temp_dir_.CreateUniqueTempDir()) { |
292 ADD_FAILURE() << "Unable to create target dir for cenverter"; | 292 ADD_FAILURE() << "Unable to create target dir for cenverter"; |
293 callback.Run(false, base::FilePath()); | 293 callback.Run(false, base::FilePath()); |
294 return; | 294 return; |
295 } | 295 } |
296 | 296 |
297 initialized_ = true; | 297 initialized_ = true; |
298 | 298 |
299 path_ = temp_dir_.path().AppendASCII("output.pwg"); | 299 path_ = temp_dir_.GetPath().AppendASCII("output.pwg"); |
300 std::string data_str(data->front_as<char>(), data->size()); | 300 std::string data_str(data->front_as<char>(), data->size()); |
301 int written = WriteFile(path_, data_str.c_str(), data_str.size()); | 301 int written = WriteFile(path_, data_str.c_str(), data_str.size()); |
302 if (written != static_cast<int>(data_str.size())) { | 302 if (written != static_cast<int>(data_str.size())) { |
303 ADD_FAILURE() << "Failed to write pwg raster file."; | 303 ADD_FAILURE() << "Failed to write pwg raster file."; |
304 callback.Run(false, base::FilePath()); | 304 callback.Run(false, base::FilePath()); |
305 return; | 305 return; |
306 } | 306 } |
307 | 307 |
308 conversion_settings_ = conversion_settings; | 308 conversion_settings_ = conversion_settings; |
309 bitmap_settings_ = bitmap_settings; | 309 bitmap_settings_ = bitmap_settings; |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 DictionaryBuilder() | 1007 DictionaryBuilder() |
1008 .Set("id", "printer1") | 1008 .Set("id", "printer1") |
1009 .Set("name", "Printer 1") | 1009 .Set("name", "Printer 1") |
1010 .Build()); | 1010 .Build()); |
1011 | 1011 |
1012 fake_api->TriggerNextUsbPrinterInfoCallback(*original_printer_info); | 1012 fake_api->TriggerNextUsbPrinterInfoCallback(*original_printer_info); |
1013 | 1013 |
1014 EXPECT_EQ(0u, call_count); | 1014 EXPECT_EQ(0u, call_count); |
1015 EXPECT_FALSE(printer_info.get()); | 1015 EXPECT_FALSE(printer_info.get()); |
1016 } | 1016 } |
OLD | NEW |