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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // Validates that set of printers reported by test apps via | 327 // Validates that set of printers reported by test apps via |
328 // chrome.printerProvider.onGetPritersRequested is the same as the set of | 328 // chrome.printerProvider.onGetPritersRequested is the same as the set of |
329 // printers in |expected_printers|. |expected_printers| contains list of | 329 // printers in |expected_printers|. |expected_printers| contains list of |
330 // printer objects formatted as a JSON string. It is assumed that the values | 330 // printer objects formatted as a JSON string. It is assumed that the values |
331 // in |expoected_printers| are unique. | 331 // in |expoected_printers| are unique. |
332 void ValidatePrinterListValue( | 332 void ValidatePrinterListValue( |
333 const base::ListValue& printers, | 333 const base::ListValue& printers, |
334 const std::vector<std::unique_ptr<base::Value>> expected_printers) { | 334 const std::vector<std::unique_ptr<base::Value>> expected_printers) { |
335 ASSERT_EQ(expected_printers.size(), printers.GetSize()); | 335 ASSERT_EQ(expected_printers.size(), printers.GetSize()); |
336 for (const auto& printer_value : expected_printers) { | 336 for (const auto& printer_value : expected_printers) { |
337 EXPECT_TRUE(printers.Find(*printer_value.get()) != printers.end()) | 337 EXPECT_TRUE(printers.Find(*printer_value) != printers.end()) |
338 << "Unable to find " << *printer_value.get() << " in " << printers; | 338 << "Unable to find " << *printer_value << " in " << printers; |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 protected: | 342 protected: |
343 device::MockUsbService usb_service_; | 343 device::MockUsbService usb_service_; |
344 | 344 |
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, |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 RunUsbPrinterInfoRequestTest("EMPTY_RESPONSE"); | 851 RunUsbPrinterInfoRequestTest("EMPTY_RESPONSE"); |
852 } | 852 } |
853 | 853 |
854 IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetUsbPrinterInfoNoListener) { | 854 IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetUsbPrinterInfoNoListener) { |
855 RunUsbPrinterInfoRequestTest("NO_LISTENER"); | 855 RunUsbPrinterInfoRequestTest("NO_LISTENER"); |
856 } | 856 } |
857 | 857 |
858 } // namespace | 858 } // namespace |
859 | 859 |
860 } // namespace extensions | 860 } // namespace extensions |
OLD | NEW |