Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: chrome/browser/local_discovery/privet_http_unittest.cc

Issue 61643021: If a job fails when sending a PDF, retry with a PWG raster (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698