| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/service/cloud_print/cloud_print_helpers.h" | 5 #include "chrome/service/cloud_print/cloud_print_helpers.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 details.platform_status_flags = 2; | 66 details.platform_status_flags = 2; |
| 67 details.status_message = "Out of Paper"; | 67 details.status_message = "Out of Paper"; |
| 68 details.total_pages = 345; | 68 details.total_pages = 345; |
| 69 details.pages_printed = 47; | 69 details.pages_printed = 47; |
| 70 url = CloudPrintHelpers::GetUrlForJobStatusUpdate(server_base_url, | 70 url = CloudPrintHelpers::GetUrlForJobStatusUpdate(server_base_url, |
| 71 "87654321", details); | 71 "87654321", details); |
| 72 expected_url = StringPrintf("%scontrol?jobid=87654321&status=in_progress&" | 72 expected_url = StringPrintf("%scontrol?jobid=87654321&status=in_progress&" |
| 73 "code=2&message=Out%%20of%%20Paper&numpages=345&" | 73 "code=2&message=Out%%20of%%20Paper&numpages=345&" |
| 74 "pagesprinted=47", expected_url_base.c_str()); | 74 "pagesprinted=47", expected_url_base.c_str()); |
| 75 EXPECT_EQ(expected_url, url.spec()); | 75 EXPECT_EQ(expected_url, url.spec()); |
| 76 |
| 77 url = CloudPrintHelpers::GetUrlForUserMessage(server_base_url, |
| 78 "blahmessageid"); |
| 79 expected_url = StringPrintf("%suser/message?code=blahmessageid", |
| 80 expected_url_base.c_str()); |
| 81 EXPECT_EQ(expected_url, url.spec()); |
| 76 } | 82 } |
| 77 | 83 |
| 78 } // namespace | 84 } // namespace |
| 79 | 85 |
| 80 TEST(CloudPrintHelpersTest, URLGetters) { | 86 TEST(CloudPrintHelpersTest, URLGetters) { |
| 81 CheckURLs(GURL("https://www.google.com/cloudprint")); | 87 CheckURLs(GURL("https://www.google.com/cloudprint")); |
| 82 CheckURLs(GURL("https://www.google.com/cloudprint/")); | 88 CheckURLs(GURL("https://www.google.com/cloudprint/")); |
| 83 CheckURLs(GURL("http://www.myprinterserver.com")); | 89 CheckURLs(GURL("http://www.myprinterserver.com")); |
| 84 CheckURLs(GURL("http://www.myprinterserver.com/")); | 90 CheckURLs(GURL("http://www.myprinterserver.com/")); |
| 85 } | 91 } |
| 86 | 92 |
| OLD | NEW |