OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 url = CloudPrintHelpers::GetUrlForJobStatusUpdate(server_base_url, | 71 url = CloudPrintHelpers::GetUrlForJobStatusUpdate(server_base_url, |
72 "87654321", details); | 72 "87654321", details); |
73 expected_url = base::StringPrintf( | 73 expected_url = base::StringPrintf( |
74 "%scontrol?jobid=87654321&status=in_progress&code=2" | 74 "%scontrol?jobid=87654321&status=in_progress&code=2" |
75 "&message=Out%%20of%%20Paper&numpages=345&pagesprinted=47", | 75 "&message=Out%%20of%%20Paper&numpages=345&pagesprinted=47", |
76 expected_url_base.c_str()); | 76 expected_url_base.c_str()); |
77 EXPECT_EQ(expected_url, url.spec()); | 77 EXPECT_EQ(expected_url, url.spec()); |
78 | 78 |
79 url = CloudPrintHelpers::GetUrlForUserMessage(server_base_url, | 79 url = CloudPrintHelpers::GetUrlForUserMessage(server_base_url, |
80 "blahmessageid"); | 80 "blahmessageid"); |
81 expected_url = base::StringPrintf("%suser/message?code=blahmessageid", | 81 expected_url = base::StringPrintf("%smessage?code=blahmessageid", |
82 expected_url_base.c_str()); | 82 expected_url_base.c_str()); |
83 EXPECT_EQ(expected_url, url.spec()); | 83 EXPECT_EQ(expected_url, url.spec()); |
84 | 84 |
85 url = CloudPrintHelpers::GetUrlForGetAuthCode( | 85 url = CloudPrintHelpers::GetUrlForGetAuthCode( |
86 server_base_url, | 86 server_base_url, |
87 "fooclientid.apps.googleusercontent.com", | 87 "fooclientid.apps.googleusercontent.com", |
88 "test_proxy"); | 88 "test_proxy"); |
89 expected_url = base::StringPrintf( | 89 expected_url = base::StringPrintf( |
90 "%screaterobot?oauth_client_id=fooclientid.apps.googleusercontent.com&" | 90 "%screaterobot?oauth_client_id=fooclientid.apps.googleusercontent.com&" |
91 "proxy=test_proxy", expected_url_base.c_str()); | 91 "proxy=test_proxy", expected_url_base.c_str()); |
92 EXPECT_EQ(expected_url, url.spec()); | 92 EXPECT_EQ(expected_url, url.spec()); |
93 } | 93 } |
94 | 94 |
95 } // namespace | 95 } // namespace |
96 | 96 |
97 TEST(CloudPrintHelpersTest, URLGetters) { | 97 TEST(CloudPrintHelpersTest, URLGetters) { |
98 CheckURLs(GURL("https://www.google.com/cloudprint")); | 98 CheckURLs(GURL("https://www.google.com/cloudprint")); |
99 CheckURLs(GURL("https://www.google.com/cloudprint/")); | 99 CheckURLs(GURL("https://www.google.com/cloudprint/")); |
100 CheckURLs(GURL("http://www.myprinterserver.com")); | 100 CheckURLs(GURL("http://www.myprinterserver.com")); |
101 CheckURLs(GURL("http://www.myprinterserver.com/")); | 101 CheckURLs(GURL("http://www.myprinterserver.com/")); |
102 } | 102 } |
103 | 103 |
OLD | NEW |