| Index: chrome/browser/local_discovery/privet_http_unittest.cc
|
| diff --git a/chrome/browser/local_discovery/privet_http_unittest.cc b/chrome/browser/local_discovery/privet_http_unittest.cc
|
| index d2cc72b70ce9889ae4934b0ea5ea7344995d8389..9062f3b22c0fac31f336ce88297edfc61a82aa93 100644
|
| --- a/chrome/browser/local_discovery/privet_http_unittest.cc
|
| +++ b/chrome/browser/local_discovery/privet_http_unittest.cc
|
| @@ -177,6 +177,10 @@ const char kSampleErrorResponsePrinterBusy[] = "{"
|
| "\"timeout\": 1 "
|
| "}";
|
|
|
| +const char kSampleInvalidDocumentTypeResponse[] = "{"
|
| + "\"error\" : \"invalid_document_type\""
|
| + "}";
|
| +
|
| const char kSampleCreatejobResponse[] = "{ \"job_id\": \"1234\" }";
|
|
|
| class MockTestURLFetcherFactoryDelegate
|
| @@ -900,6 +904,50 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrintWithCreatejob) {
|
| kSampleLocalPrintResponse));
|
| };
|
|
|
| +TEST_F(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) {
|
| + local_print_operation_->SetUsername("sample@gmail.com");
|
| + local_print_operation_->SetJobname("Sample job name");
|
| + local_print_operation_->SetTicket("Sample print ticket");
|
| + local_print_operation_->Start();
|
| +
|
| + EXPECT_TRUE(SuccessfulResponseToURL(
|
| + GURL("http://10.0.0.8:6006/privet/info"),
|
| + kSampleInfoResponseWithCreatejob));
|
| +
|
| + EXPECT_CALL(local_print_delegate_, OnPrivetPrintingRequestPDFInternal());
|
| +
|
| + EXPECT_TRUE(SuccessfulResponseToURL(
|
| + GURL("http://10.0.0.8:6006/privet/capabilities"),
|
| + kSampleCapabilitiesResponse));
|
| +
|
| + local_print_operation_->SendData("Sample print data");
|
| +
|
| + EXPECT_TRUE(SuccessfulResponseToURLAndData(
|
| + GURL("http://10.0.0.8:6006/privet/printer/createjob"),
|
| + "Sample print ticket",
|
| + kSampleCreatejobResponse));
|
| +
|
| + EXPECT_CALL(local_print_delegate_,
|
| + OnPrivetPrintingRequestPWGRasterInternal());
|
| +
|
| + // TODO(noamsml): Is encoding spaces as pluses standard?
|
| + EXPECT_TRUE(SuccessfulResponseToURLAndData(
|
| + GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
|
| + "user=sample%40gmail.com&jobname=Sample+job+name&job_id=1234"),
|
| + "Sample print data",
|
| + kSampleInvalidDocumentTypeResponse));
|
| +
|
| + local_print_operation_->SendData("Sample print data2");
|
| +
|
| + EXPECT_CALL(local_print_delegate_, OnPrivetPrintingDoneInternal());
|
| +
|
| + EXPECT_TRUE(SuccessfulResponseToURLAndData(
|
| + GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
|
| + "user=sample%40gmail.com&jobname=Sample+job+name&job_id=1234"),
|
| + "Sample print data2",
|
| + kSampleLocalPrintResponse));
|
| +};
|
| +
|
| TEST_F(PrivetLocalPrintTest, LocalPrintRetryOnInvalidJobID) {
|
| local_print_operation_->SetUsername("sample@gmail.com");
|
| local_print_operation_->SetJobname("Sample job name");
|
|
|