1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/metrics/metrics_hashes.h"
7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h"
9 #include "testing/gtest/include/gtest/gtest.h"
13 // Make sure our ID hashes are the same as what we see on the server side.
14 TEST(MetricsUtilTest
, HashMetricName
) {
19 {"Back", "0x0557fa923dcee4d0"},
20 {"Forward", "0x67d2f6740a8eaebf"},
21 {"NewTab", "0x290eb683f96572f1"},
24 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(cases
); ++i
) {
25 uint64 hash
= HashMetricName(cases
[i
].input
);
26 std::string hash_hex
= base::StringPrintf("0x%016" PRIx64
, hash
);
27 EXPECT_EQ(cases
[i
].output
, hash_hex
);
31 } // namespace metrics