OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "chromeos/chromeos_paths.h" | 14 #include "chromeos/chromeos_paths.h" |
15 #include "chromeos/printing/ppd_cache.h" | 15 #include "chromeos/printing/ppd_cache.h" |
16 #include "chromeos/printing/ppd_provider.h" | 16 #include "chromeos/printing/ppd_provider.h" |
17 #include "net/url_request/test_url_request_interceptor.h" | 17 #include "net/url_request/test_url_request_interceptor.h" |
18 #include "net/url_request/url_request_test_util.h" | 18 #include "net/url_request/url_request_test_util.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 namespace printing { | 22 namespace printing { |
23 namespace { | 23 namespace { |
24 | 24 |
25 const char kTestQuirksServer[] = "bogusserver.bogus.com"; | 25 const char kTestQuirksServer[] = "bogusserver.bogus.com"; |
26 const char kTestAPIKey[] = "BOGUSAPIKEY"; | 26 const char kTestAPIKey[] = "BOGUSAPIKEY"; |
27 const char kLocalPpdUrl[] = "/some/path"; | 27 const char kLocalPpdUrl[] = "/some/path"; |
28 const char kTestManufacturer[] = "Bogus Printer Corp"; | 28 const char kTestManufacturer[] = "Bogus Printer Corp"; |
29 const char kTestModel[] = "MegaPrint 9000"; | 29 const char kTestModel[] = "MegaPrint 9000"; |
| 30 // The compressedPPD contents here comes from running the command |
| 31 // echo -n "This is the quirks ppd" | base64 |
30 const char kQuirksResponse[] = | 32 const char kQuirksResponse[] = |
31 "{\n" | 33 "{\n" |
32 " \"compressedPpd\": \"This is the quirks ppd\",\n" | 34 " \"compressedPpd\": \"VGhpcyBpcyB0aGUgcXVpcmtzIHBwZA==\",\n" |
33 " \"lastUpdatedTime\": \"1\"\n" | 35 " \"lastUpdatedTime\": \"1\"\n" |
34 "}\n"; | 36 "}\n"; |
35 const char kQuirksPpd[] = "This is the quirks ppd"; | 37 const char kQuirksPpd[] = "This is the quirks ppd"; |
36 | 38 |
37 // A well-formatted response for a list of ppds from quirks server. This | 39 // A well-formatted response for a list of ppds from quirks server. This |
38 // corresponds to the AvailablePrintersMap returned by QuirksPrinters() below. | 40 // corresponds to the AvailablePrintersMap returned by QuirksPrinters() below. |
39 const char kQuirksListResponse[] = | 41 const char kQuirksListResponse[] = |
40 "{\n" | 42 "{\n" |
41 " \"manufacturers\": [\n" | 43 " \"manufacturers\": [\n" |
42 " {\n" | 44 " {\n" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 available_printers.clear(); | 257 available_printers.clear(); |
256 ppd_provider_->QueryAvailable(query_callback); | 258 ppd_provider_->QueryAvailable(query_callback); |
257 base::RunLoop().RunUntilIdle(); | 259 base::RunLoop().RunUntilIdle(); |
258 EXPECT_EQ(PpdProvider::SUCCESS, result_code); | 260 EXPECT_EQ(PpdProvider::SUCCESS, result_code); |
259 EXPECT_EQ(QuirksPrinters(), available_printers); | 261 EXPECT_EQ(QuirksPrinters(), available_printers); |
260 } | 262 } |
261 | 263 |
262 } // namespace | 264 } // namespace |
263 } // namespace printing | 265 } // namespace printing |
264 } // namespace chromeos | 266 } // namespace chromeos |
OLD | NEW |