Chromium Code Reviews| Index: chrome/service/cloud_print/cloud_print_helpers_unittest.cc |
| diff --git a/chrome/service/cloud_print/cloud_print_helpers_unittest.cc b/chrome/service/cloud_print/cloud_print_helpers_unittest.cc |
| index 429b3f55f84fd6283740b1f81280606bfc8e11d9..4ba63c872f17322454349b474fb91de821d96b25 100644 |
| --- a/chrome/service/cloud_print/cloud_print_helpers_unittest.cc |
| +++ b/chrome/service/cloud_print/cloud_print_helpers_unittest.cc |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @@ -10,87 +10,20 @@ |
| namespace { |
| void CheckURLs(const GURL& server_base_url) { |
| - GURL url = CloudPrintHelpers::GetUrlForPrinterRegistration(server_base_url); |
| - std::string expected_url_base = server_base_url.spec(); |
| - if (expected_url_base[expected_url_base.length() - 1] != '/') { |
| - expected_url_base += "/"; |
| - } |
| - std::string expected_url = base::StringPrintf("%sregister", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForPrinterUpdate(server_base_url, |
| - "printeridfoo"); |
| - expected_url = base::StringPrintf("%supdate?printerid=printeridfoo", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForPrinterDelete(server_base_url, |
| - "printeridbar", "deleted"); |
| - expected_url = base::StringPrintf( |
| - "%sdelete?printerid=printeridbar&reason=deleted", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForPrinterList(server_base_url, "demoproxy"); |
| - expected_url = base::StringPrintf("%slist?proxy=demoproxy", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForJobFetch(server_base_url, |
| - "myprinter", |
| - "nogoodreason"); |
| - expected_url = base::StringPrintf( |
| - "%sfetch?printerid=myprinter&deb=nogoodreason", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForJobStatusUpdate( |
|
msw
2012/11/17 00:22:30
You should leave these test cases (three calls to
Chen Yu
2012/11/26 12:07:06
Done.
|
| - server_base_url, "12345678", cloud_print::PRINT_JOB_STATUS_IN_PROGRESS); |
| - expected_url = base::StringPrintf( |
| - "%scontrol?jobid=12345678&status=IN_PROGRESS", expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForJobStatusUpdate( |
| - server_base_url, "12345678", cloud_print::PRINT_JOB_STATUS_ERROR); |
| - expected_url = base::StringPrintf("%scontrol?jobid=12345678&status=ERROR", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForJobStatusUpdate( |
| - server_base_url, "12345678", cloud_print::PRINT_JOB_STATUS_COMPLETED); |
| - expected_url = base::StringPrintf("%scontrol?jobid=12345678&status=DONE", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| cloud_print::PrintJobDetails details; |
| details.status = cloud_print::PRINT_JOB_STATUS_IN_PROGRESS; |
| details.platform_status_flags = 2; |
| details.status_message = "Out of Paper"; |
| details.total_pages = 345; |
| details.pages_printed = 47; |
| - url = CloudPrintHelpers::GetUrlForJobStatusUpdate(server_base_url, |
| - "87654321", details); |
| - expected_url = base::StringPrintf( |
| + GURL url = CloudPrintHelpers::GetUrlForJobStatusUpdate( |
| + server_base_url, "87654321", details); |
| + std::string expected_url_base = server_base_url.spec(); |
| + std::string expected_url = base::StringPrintf( |
| "%scontrol?jobid=87654321&status=IN_PROGRESS&code=2" |
| "&message=Out%%20of%%20Paper&numpages=345&pagesprinted=47", |
| expected_url_base.c_str()); |
| EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForUserMessage(server_base_url, |
|
msw
2012/11/17 00:22:30
You should leave these test cases (calls to GetUrl
Chen Yu
2012/11/26 12:07:06
Done.
|
| - "blahmessageid"); |
| - expected_url = base::StringPrintf("%smessage?code=blahmessageid", |
| - expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| - |
| - url = CloudPrintHelpers::GetUrlForGetAuthCode( |
| - server_base_url, |
| - "fooclientid.apps.googleusercontent.com", |
| - "test_proxy"); |
| - expected_url = base::StringPrintf( |
| - "%screaterobot?oauth_client_id=fooclientid.apps.googleusercontent.com&" |
| - "proxy=test_proxy", expected_url_base.c_str()); |
| - EXPECT_EQ(expected_url, url.spec()); |
| } |
| } // namespace |