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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 private: | 345 private: |
346 // Initializes |data_dir_| if needed and creates a file in it containing | 346 // Initializes |data_dir_| if needed and creates a file in it containing |
347 // provided data. | 347 // provided data. |
348 bool CreateTempFileWithContents(const char* data, | 348 bool CreateTempFileWithContents(const char* data, |
349 int size, | 349 int size, |
350 base::FilePath* path, | 350 base::FilePath* path, |
351 base::File::Info* file_info) { | 351 base::File::Info* file_info) { |
352 if (!data_dir_.IsValid() && !data_dir_.CreateUniqueTempDir()) | 352 if (!data_dir_.IsValid() && !data_dir_.CreateUniqueTempDir()) |
353 return false; | 353 return false; |
354 | 354 |
355 *path = data_dir_.path().AppendASCII("data.pwg"); | 355 *path = data_dir_.GetPath().AppendASCII("data.pwg"); |
356 int written = base::WriteFile(*path, data, size); | 356 int written = base::WriteFile(*path, data, size); |
357 if (written != size) | 357 if (written != size) |
358 return false; | 358 return false; |
359 if (!base::GetFileInfo(*path, file_info)) | 359 if (!base::GetFileInfo(*path, file_info)) |
360 return false; | 360 return false; |
361 return true; | 361 return true; |
362 } | 362 } |
363 | 363 |
364 base::ScopedTempDir data_dir_; | 364 base::ScopedTempDir data_dir_; |
365 | 365 |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 RunUsbPrinterInfoRequestTest("EMPTY_RESPONSE"); | 857 RunUsbPrinterInfoRequestTest("EMPTY_RESPONSE"); |
858 } | 858 } |
859 | 859 |
860 IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetUsbPrinterInfoNoListener) { | 860 IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetUsbPrinterInfoNoListener) { |
861 RunUsbPrinterInfoRequestTest("NO_LISTENER"); | 861 RunUsbPrinterInfoRequestTest("NO_LISTENER"); |
862 } | 862 } |
863 | 863 |
864 } // namespace | 864 } // namespace |
865 | 865 |
866 } // namespace extensions | 866 } // namespace extensions |
OLD | NEW |