OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/local_discovery/privet_http_impl.h" | 9 #include "chrome/browser/local_discovery/privet_http_impl.h" |
10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 "\"error\": \"invalid_print_job\"," | 179 "\"error\": \"invalid_print_job\"," |
180 "\"timeout\": 1 " | 180 "\"timeout\": 1 " |
181 "}"; | 181 "}"; |
182 | 182 |
183 const char kSampleInvalidDocumentTypeResponse[] = "{" | 183 const char kSampleInvalidDocumentTypeResponse[] = "{" |
184 "\"error\" : \"invalid_document_type\"" | 184 "\"error\" : \"invalid_document_type\"" |
185 "}"; | 185 "}"; |
186 | 186 |
187 const char kSampleCreatejobResponse[] = "{ \"job_id\": \"1234\" }"; | 187 const char kSampleCreatejobResponse[] = "{ \"job_id\": \"1234\" }"; |
188 | 188 |
189 const char kSampleEmptyJSONResponse[] = "{}"; | |
190 | |
191 const char kSampleCJT[] = "{ \"version\" : \"1.0\" }"; | 189 const char kSampleCJT[] = "{ \"version\" : \"1.0\" }"; |
192 | 190 |
193 const char kSampleCapabilitiesResponsePWGSettings[] = | 191 const char kSampleCapabilitiesResponsePWGSettings[] = |
194 "{" | 192 "{" |
195 "\"version\" : \"1.0\"," | 193 "\"version\" : \"1.0\"," |
196 "\"printer\" : {" | 194 "\"printer\" : {" |
197 " \"pwg_raster_config\" : {" | 195 " \"pwg_raster_config\" : {" |
198 " \"document_sheet_back\" : \"MANUAL_TUMBLE\"," | 196 " \"document_sheet_back\" : \"MANUAL_TUMBLE\"," |
199 " \"reverse_order_streaming\": true" | 197 " \"reverse_order_streaming\": true" |
200 " }," | 198 " }," |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 451 } |
454 | 452 |
455 const printing::PwgRasterSettings& bitmap_settings() { | 453 const printing::PwgRasterSettings& bitmap_settings() { |
456 return bitmap_settings_; | 454 return bitmap_settings_; |
457 } | 455 } |
458 | 456 |
459 private: | 457 private: |
460 printing::PwgRasterSettings bitmap_settings_; | 458 printing::PwgRasterSettings bitmap_settings_; |
461 }; | 459 }; |
462 | 460 |
463 TEST_F(PrivetHTTPTest, CreatePrivetStorageList) { | |
464 MockJSONCallback mock_callback; | |
465 scoped_ptr<PrivetJSONOperation> storage_list_operation = | |
466 privet_client_->CreateStorageListOperation( | |
467 "/path/to/nothing", | |
468 mock_callback.callback()); | |
469 storage_list_operation->Start(); | |
470 | |
471 EXPECT_TRUE(SuccessfulResponseToURL(GURL("http://10.0.0.8:6006/privet/info"), | |
472 kSampleInfoResponse)); | |
473 | |
474 EXPECT_CALL(mock_callback, OnPrivetJSONDoneInternal()); | |
475 | |
476 EXPECT_TRUE(SuccessfulResponseToURL( | |
477 GURL("http://10.0.0.8:6006/privet/storage/list?path=/path/to/nothing"), | |
478 kSampleEmptyJSONResponse)); | |
479 } | |
480 | |
481 class PrivetInfoTest : public PrivetHTTPTest { | 461 class PrivetInfoTest : public PrivetHTTPTest { |
482 public: | 462 public: |
483 PrivetInfoTest() {} | 463 PrivetInfoTest() {} |
484 | 464 |
485 virtual ~PrivetInfoTest() {} | 465 virtual ~PrivetInfoTest() {} |
486 | 466 |
487 virtual void SetUp() OVERRIDE { | 467 virtual void SetUp() OVERRIDE { |
488 info_operation_ = privet_client_->CreateInfoOperation( | 468 info_operation_ = privet_client_->CreateInfoOperation( |
489 info_callback_.callback()); | 469 info_callback_.callback()); |
490 } | 470 } |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 | 1066 |
1087 EXPECT_TRUE(SuccessfulResponseToURL( | 1067 EXPECT_TRUE(SuccessfulResponseToURL( |
1088 GURL("http://10.0.0.8:6006/privet/printer/createjob"), | 1068 GURL("http://10.0.0.8:6006/privet/printer/createjob"), |
1089 kSampleCreatejobResponse)); | 1069 kSampleCreatejobResponse)); |
1090 }; | 1070 }; |
1091 | 1071 |
1092 | 1072 |
1093 } // namespace | 1073 } // namespace |
1094 | 1074 |
1095 } // namespace local_discovery | 1075 } // namespace local_discovery |
OLD | NEW |