| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 559   extensions::DevicePermissionsManager* permissions_manager = | 559   extensions::DevicePermissionsManager* permissions_manager = | 
| 560       extensions::DevicePermissionsManager::Get(env_.profile()); | 560       extensions::DevicePermissionsManager::Get(env_.profile()); | 
| 561   permissions_manager->AllowUsbDevice(extension_2->id(), device0); | 561   permissions_manager->AllowUsbDevice(extension_2->id(), device0); | 
| 562 | 562 | 
| 563   size_t call_count = 0; | 563   size_t call_count = 0; | 
| 564   std::unique_ptr<base::ListValue> printers; | 564   std::unique_ptr<base::ListValue> printers; | 
| 565   bool is_done = false; | 565   bool is_done = false; | 
| 566   extension_printer_handler_->StartGetPrinters( | 566   extension_printer_handler_->StartGetPrinters( | 
| 567       base::Bind(&RecordPrinterList, &call_count, &printers, &is_done)); | 567       base::Bind(&RecordPrinterList, &call_count, &printers, &is_done)); | 
| 568 | 568 | 
|  | 569   base::RunLoop().RunUntilIdle(); | 
|  | 570 | 
| 569   FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI(); | 571   FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI(); | 
| 570   ASSERT_TRUE(fake_api); | 572   ASSERT_TRUE(fake_api); | 
| 571   ASSERT_EQ(1u, fake_api->pending_get_printers_count()); | 573   ASSERT_EQ(1u, fake_api->pending_get_printers_count()); | 
| 572 | 574 | 
| 573   EXPECT_EQ(1u, call_count); | 575   EXPECT_EQ(1u, call_count); | 
| 574   EXPECT_FALSE(is_done); | 576   EXPECT_FALSE(is_done); | 
| 575   EXPECT_TRUE(printers.get()); | 577   EXPECT_TRUE(printers.get()); | 
| 576   EXPECT_EQ(2u, printers->GetSize()); | 578   EXPECT_EQ(2u, printers->GetSize()); | 
| 577   std::unique_ptr<base::DictionaryValue> extension_1_entry( | 579   std::unique_ptr<base::DictionaryValue> extension_1_entry( | 
| 578       DictionaryBuilder() | 580       DictionaryBuilder() | 
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1007       DictionaryBuilder() | 1009       DictionaryBuilder() | 
| 1008           .Set("id", "printer1") | 1010           .Set("id", "printer1") | 
| 1009           .Set("name", "Printer 1") | 1011           .Set("name", "Printer 1") | 
| 1010           .Build()); | 1012           .Build()); | 
| 1011 | 1013 | 
| 1012   fake_api->TriggerNextUsbPrinterInfoCallback(*original_printer_info); | 1014   fake_api->TriggerNextUsbPrinterInfoCallback(*original_printer_info); | 
| 1013 | 1015 | 
| 1014   EXPECT_EQ(0u, call_count); | 1016   EXPECT_EQ(0u, call_count); | 
| 1015   EXPECT_FALSE(printer_info.get()); | 1017   EXPECT_FALSE(printer_info.get()); | 
| 1016 } | 1018 } | 
| OLD | NEW | 
|---|