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/";
const char kPrivetRegisterActionArgName[] = "action";
const char kPrivetRegisterUserArgName[] = "user";
const char kPrivetURLKeyUser[] = "user";
const char kPrivetURLKeyJobname[] = "jobname";
const char kPrivetURLKeyUserName[] = "user_name";
const char kPrivetURLKeyClientName[] = "client_name";
const char kPrivetURLKeyJobname[] = "job_name";
const char kPrivetURLKeyOffline[] = "offline";
const char kPrivetURLValueOffline[] = "1";
const char kPrivetURLValueClientName[] = "Chrome";
const char kPrivetContentTypePDF[] = "application/pdf";
const char kPrivetContentTypePWGRaster[] = "image/pwg-raster";
......@@ -478,9 +480,13 @@ void PrivetLocalPrintOperationImpl::DoSubmitdoc() {
GURL url = CreatePrivetURL(kPrivetSubmitdocPath);
url = net::AppendQueryParameter(url,
kPrivetURLKeyClientName,
kPrivetURLValueClientName);
if (!user_.empty()) {
url = net::AppendQueryParameter(url,
kPrivetURLKeyUser,
kPrivetURLKeyUserName,
user_);
}
......
......@@ -826,7 +826,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrint) {
// 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"),
"client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name"),
"Sample print data",
kSampleLocalPrintResponse));
};
......@@ -851,7 +852,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrintWithAnyMimetype) {
// 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"),
"client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name"),
"Sample print data",
kSampleLocalPrintResponse));
};
......@@ -876,7 +878,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulPWGLocalPrint) {
// TODO(noamsml): Is encoding spaces as pluses standard?
EXPECT_TRUE(SuccessfulResponseToURLAndFilePath(
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")),
kSampleLocalPrintResponse));
};
......@@ -907,7 +910,8 @@ TEST_F(PrivetLocalPrintTest, SuccessfulLocalPrintWithCreatejob) {
// 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"),
"client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name&job_id=1234"),
"Sample print data",
kSampleLocalPrintResponse));
};
......@@ -936,7 +940,8 @@ TEST_F(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) {
// 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"),
"client_name=Chrome&user_name=sample%40gmail.com&"
"job_name=Sample+job+name&job_id=1234"),
"sample/path/",
kSampleInvalidDocumentTypeResponse));
......@@ -944,7 +949,8 @@ TEST_F(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) {
EXPECT_TRUE(SuccessfulResponseToURLAndFilePath(
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")),
kSampleLocalPrintResponse));
};
......@@ -972,7 +978,8 @@ TEST_F(PrivetLocalPrintTest, LocalPrintRetryOnInvalidJobID) {
EXPECT_TRUE(SuccessfulResponseToURLAndData(
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",
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