OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/common/cloud_print/cloud_print_helpers.h" | 5 #include "chrome/common/cloud_print/cloud_print_helpers.h" |
6 | 6 |
7 #include "base/md5.h" | 7 #include "base/md5.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "chrome/common/chrome_version_info.h" | 10 #include "chrome/common/chrome_version_info.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 CheckURLs(GURL("http://www.myprinterserver.com")); | 76 CheckURLs(GURL("http://www.myprinterserver.com")); |
77 CheckURLs(GURL("http://www.myprinterserver.com/")); | 77 CheckURLs(GURL("http://www.myprinterserver.com/")); |
78 } | 78 } |
79 | 79 |
80 TEST(CloudPrintHelpersTest, GetHashOfPrinterTags) { | 80 TEST(CloudPrintHelpersTest, GetHashOfPrinterTags) { |
81 PrinterTags printer_tags; | 81 PrinterTags printer_tags; |
82 printer_tags["tag1"] = std::string("value1"); | 82 printer_tags["tag1"] = std::string("value1"); |
83 printer_tags["tag2"] = std::string("value2"); | 83 printer_tags["tag2"] = std::string("value2"); |
84 | 84 |
85 chrome::VersionInfo version_info; | 85 chrome::VersionInfo version_info; |
86 std::string expected_list_string = StringPrintf( | 86 std::string expected_list_string = base::StringPrintf( |
87 "chrome_version%ssystem_name%ssystem_version%stag1value1tag2value2", | 87 "chrome_version%ssystem_name%ssystem_version%stag1value1tag2value2", |
88 version_info.CreateVersionString().c_str(), | 88 version_info.CreateVersionString().c_str(), |
89 base::SysInfo::OperatingSystemName().c_str(), | 89 base::SysInfo::OperatingSystemName().c_str(), |
90 base::SysInfo::OperatingSystemVersion().c_str()); | 90 base::SysInfo::OperatingSystemVersion().c_str()); |
91 EXPECT_EQ(base::MD5String(expected_list_string), | 91 EXPECT_EQ(base::MD5String(expected_list_string), |
92 GetHashOfPrinterTags(printer_tags)); | 92 GetHashOfPrinterTags(printer_tags)); |
93 } | 93 } |
94 | 94 |
95 TEST(CloudPrintHelpersTest, GetPostDataForPrinterTags) { | 95 TEST(CloudPrintHelpersTest, GetPostDataForPrinterTags) { |
96 PrinterTags printer_tags; | 96 PrinterTags printer_tags; |
(...skipping 26 matching lines...) Expand all Loading... |
123 std::string("__test__tagshash"))); | 123 std::string("__test__tagshash"))); |
124 } | 124 } |
125 | 125 |
126 TEST(CloudPrintHelpersTest, GetCloudPrintAuthHeader) { | 126 TEST(CloudPrintHelpersTest, GetCloudPrintAuthHeader) { |
127 std::string test_auth("testauth"); | 127 std::string test_auth("testauth"); |
128 EXPECT_EQ("Authorization: OAuth testauth", | 128 EXPECT_EQ("Authorization: OAuth testauth", |
129 GetCloudPrintAuthHeader(test_auth)); | 129 GetCloudPrintAuthHeader(test_auth)); |
130 } | 130 } |
131 | 131 |
132 } // namespace cloud_print | 132 } // namespace cloud_print |
OLD | NEW |