OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "chrome/browser/metrics/metrics_log.h" | 9 #include "chrome/browser/metrics/metrics_log.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 }; | 206 }; |
207 | 207 |
208 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { | 208 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { |
209 std::string hash_string = MetricsLog::CreateHash(cases[i].input); | 209 std::string hash_string = MetricsLog::CreateHash(cases[i].input); |
210 | 210 |
211 // Convert to hex string | 211 // Convert to hex string |
212 // We're only checking the first 8 bytes, because that's what | 212 // We're only checking the first 8 bytes, because that's what |
213 // the metrics server uses. | 213 // the metrics server uses. |
214 std::string hash_hex = "0x"; | 214 std::string hash_hex = "0x"; |
215 for (size_t j = 0; j < 8; j++) { | 215 for (size_t j = 0; j < 8; j++) { |
216 StringAppendF(&hash_hex, "%02x", | 216 base::StringAppendF(&hash_hex, "%02x", |
217 static_cast<uint8>(hash_string.data()[j])); | 217 static_cast<uint8>(hash_string.data()[j])); |
218 } | 218 } |
219 EXPECT_EQ(cases[i].output, hash_hex); | 219 EXPECT_EQ(cases[i].output, hash_hex); |
220 } | 220 } |
221 }; | 221 }; |
OLD | NEW |