| 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 30 matching lines...) Expand all Loading... |
| 41 // |callback|. | 41 // |callback|. |
| 42 void AppendPrintersAndRunCallbackIfDone(base::ListValue* printers_out, | 42 void AppendPrintersAndRunCallbackIfDone(base::ListValue* printers_out, |
| 43 const base::Closure& callback, | 43 const base::Closure& callback, |
| 44 const base::ListValue& printers, | 44 const base::ListValue& printers, |
| 45 bool done) { | 45 bool done) { |
| 46 for (size_t i = 0; i < printers.GetSize(); ++i) { | 46 for (size_t i = 0; i < printers.GetSize(); ++i) { |
| 47 const base::DictionaryValue* printer = NULL; | 47 const base::DictionaryValue* printer = NULL; |
| 48 EXPECT_TRUE(printers.GetDictionary(i, &printer)) | 48 EXPECT_TRUE(printers.GetDictionary(i, &printer)) |
| 49 << "Found invalid printer value at index " << i << ": " << printers; | 49 << "Found invalid printer value at index " << i << ": " << printers; |
| 50 if (printer) | 50 if (printer) |
| 51 printers_out->Append(printer->DeepCopy()); | 51 printers_out->Append(printer->CreateDeepCopy()); |
| 52 } | 52 } |
| 53 if (done && !callback.is_null()) | 53 if (done && !callback.is_null()) |
| 54 callback.Run(); | 54 callback.Run(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Callback for PrinterProviderAPI::DispatchPrintRequested calls. | 57 // Callback for PrinterProviderAPI::DispatchPrintRequested calls. |
| 58 // It copies |value| to |*result| and runs |callback|. | 58 // It copies |value| to |*result| and runs |callback|. |
| 59 void RecordPrintResultAndRunCallback(bool* result_success, | 59 void RecordPrintResultAndRunCallback(bool* result_success, |
| 60 std::string* result_status, | 60 std::string* result_status, |
| 61 const base::Closure& callback, | 61 const base::Closure& callback, |
| (...skipping 795 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 |