Commit 805bab4b authored by noamsml@chromium.org's avatar noamsml@chromium.org

Fix local printing URL parameter names

Local printing URL parameter names do not match those in the privet spec. Fix
this so they do match it.

BUG=338868

Review URL: https://codereview.chromium.org/148183014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247595 0039d316-1c4b-4281-b951-d872f2087c98
parent b733d954
...@@ -23,10 +23,12 @@ const char kUrlPlaceHolder[] = "http://host/"; ...@@ -23,10 +23,12 @@ const char kUrlPlaceHolder[] = "http://host/";
const char kPrivetRegisterActionArgName[] = "action"; const char kPrivetRegisterActionArgName[] = "action";
const char kPrivetRegisterUserArgName[] = "user"; const char kPrivetRegisterUserArgName[] = "user";
const char kPrivetURLKeyUser[] = "user"; const char kPrivetURLKeyUserName[] = "user_name";
const char kPrivetURLKeyJobname[] = "jobname"; const char kPrivetURLKeyClientName[] = "client_name";
const char kPrivetURLKeyJobname[] = "job_name";
const char kPrivetURLKeyOffline[] = "offline"; const char kPrivetURLKeyOffline[] = "offline";
const char kPrivetURLValueOffline[] = "1"; const char kPrivetURLValueOffline[] = "1";
const char kPrivetURLValueClientName[] = "Chrome";
const char kPrivetContentTypePDF[] = "application/pdf"; const char kPrivetContentTypePDF[] = "application/pdf";
const char kPrivetContentTypePWGRaster[] = "image/pwg-raster"; const char kPrivetContentTypePWGRaster[] = "image/pwg-raster";
...@@ -478,9 +480,13 @@ void PrivetLocalPrintOperationImpl::DoSubmitdoc() { ...@@ -478,9 +480,13 @@ void PrivetLocalPrintOperationImpl::DoSubmitdoc() {
GURL url = CreatePrivetURL(kPrivetSubmitdocPath); GURL url = CreatePrivetURL(kPrivetSubmitdocPath);
url = net::AppendQueryParameter(url,
kPrivetURLKeyClientName,
kPrivetURLValueClientName);
if (!user_.empty()) { if (!user_.empty()) {
url = net::AppendQueryParameter(url, url = net::AppendQueryParameter(url,
kPrivetURLKeyUser, kPrivetURLKeyUserName,
user_); user_);
} }
......
...@@ -826,7 +826,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrint) { ...@@ -826,7 +826,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrint) {
// TODO(noamsml): Is encoding spaces as pluses standard? // TODO(noamsml): Is encoding spaces as pluses standard?
EXPECT_TRUE(SuccessfulResponseToURLAndData( EXPECT_TRUE(SuccessfulResponseToURLAndData(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?" GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name"), "client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name"),
"Sample print data", "Sample print data",
kSampleLocalPrintResponse)); kSampleLocalPrintResponse));
}; };
...@@ -851,7 +852,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrintWithAnyMimetype) { ...@@ -851,7 +852,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrintWithAnyMimetype) {
// TODO(noamsml): Is encoding spaces as pluses standard? // TODO(noamsml): Is encoding spaces as pluses standard?
EXPECT_TRUE(SuccessfulResponseToURLAndData( EXPECT_TRUE(SuccessfulResponseToURLAndData(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?" GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name"), "client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name"),
"Sample print data", "Sample print data",
kSampleLocalPrintResponse)); kSampleLocalPrintResponse));
}; };
...@@ -876,7 +878,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulPWGLocalPrint) { ...@@ -876,7 +878,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulPWGLocalPrint) {
// TODO(noamsml): Is encoding spaces as pluses standard? // TODO(noamsml): Is encoding spaces as pluses standard?
EXPECT_TRUE(SuccessfulResponseToURLAndFilePath( EXPECT_TRUE(SuccessfulResponseToURLAndFilePath(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?" GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name"), "client_name=Chrome&user_name=sample%40gmail.com"
"&job_name=Sample+job+name"),
base::FilePath(FILE_PATH_LITERAL("path/to/test.pdf")), base::FilePath(FILE_PATH_LITERAL("path/to/test.pdf")),
kSampleLocalPrintResponse)); kSampleLocalPrintResponse));
}; };
...@@ -907,7 +910,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrintWithCreatejob) { ...@@ -907,7 +910,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrintWithCreatejob) {
// TODO(noamsml): Is encoding spaces as pluses standard? // TODO(noamsml): Is encoding spaces as pluses standard?
EXPECT_TRUE(SuccessfulResponseToURLAndData( EXPECT_TRUE(SuccessfulResponseToURLAndData(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?" GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name&job_id=1234"), "client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name&job_id=1234"),
"Sample print data", "Sample print data",
kSampleLocalPrintResponse)); kSampleLocalPrintResponse));
}; };
...@@ -936,7 +940,8 @@ TEST_F(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) { ...@@ -936,7 +940,8 @@ TEST_F(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) {
// TODO(noamsml): Is encoding spaces as pluses standard? // TODO(noamsml): Is encoding spaces as pluses standard?
EXPECT_TRUE(SuccessfulResponseToURLAndData( EXPECT_TRUE(SuccessfulResponseToURLAndData(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?" GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name&job_id=1234"), "client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name&job_id=1234"),
"sample/path/", "sample/path/",
kSampleInvalidDocumentTypeResponse)); kSampleInvalidDocumentTypeResponse));
...@@ -944,7 +949,8 @@ TEST_F(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) { ...@@ -944,7 +949,8 @@ TEST_F(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) {
EXPECT_TRUE(SuccessfulResponseToURLAndFilePath( EXPECT_TRUE(SuccessfulResponseToURLAndFilePath(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?" GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name&job_id=1234"), "client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name&job_id=1234"),
base::FilePath(FILE_PATH_LITERAL("sample/path/test.pdf")), base::FilePath(FILE_PATH_LITERAL("sample/path/test.pdf")),
kSampleLocalPrintResponse)); kSampleLocalPrintResponse));
}; };
...@@ -972,7 +978,8 @@ TEST_F(PrivetLocalPrintTest, LocalPrintRetryOnInvalidJobID) { ...@@ -972,7 +978,8 @@ TEST_F(PrivetLocalPrintTest, LocalPrintRetryOnInvalidJobID) {
EXPECT_TRUE(SuccessfulResponseToURLAndData( EXPECT_TRUE(SuccessfulResponseToURLAndData(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?" GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name&job_id=1234"), "client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name&job_id=1234"),
"Sample print data", "Sample print data",
kSampleErrorResponsePrinterBusy)); kSampleErrorResponsePrinterBusy));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment