Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: base/metrics/metrics_hashes_unittest.cc

Issue 1476633003: Move HashMetricName to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed unittest Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/metrics/metrics_hashes.cc ('k') | chrome/browser/about_flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "components/metrics/metrics_hashes.h" 5 #include "base/metrics/metrics_hashes.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/macros.h"
8 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace metrics { 12 namespace base {
12 13
13 // Make sure our ID hashes are the same as what we see on the server side. 14 // Make sure our ID hashes are the same as what we see on the server side.
14 TEST(MetricsUtilTest, HashMetricName) { 15 TEST(MetricsUtilTest, HashMetricName) {
15 static const struct { 16 static const struct {
16 std::string input; 17 std::string input;
17 std::string output; 18 std::string output;
18 } cases[] = { 19 } cases[] = {
19 {"Back", "0x0557fa923dcee4d0"}, 20 {"Back", "0x0557fa923dcee4d0"},
20 {"Forward", "0x67d2f6740a8eaebf"}, 21 {"Forward", "0x67d2f6740a8eaebf"},
21 {"NewTab", "0x290eb683f96572f1"}, 22 {"NewTab", "0x290eb683f96572f1"},
22 }; 23 };
23 24
24 for (size_t i = 0; i < arraysize(cases); ++i) { 25 for (size_t i = 0; i < arraysize(cases); ++i) {
25 uint64 hash = HashMetricName(cases[i].input); 26 uint64_t hash = HashMetricName(cases[i].input);
26 std::string hash_hex = base::StringPrintf("0x%016" PRIx64, hash); 27 std::string hash_hex = base::StringPrintf("0x%016" PRIx64, hash);
27 EXPECT_EQ(cases[i].output, hash_hex); 28 EXPECT_EQ(cases[i].output, hash_hex);
28 } 29 }
29 } 30 }
30 31
31 } // namespace metrics 32 } // namespace metrics
OLDNEW
« no previous file with comments | « base/metrics/metrics_hashes.cc ('k') | chrome/browser/about_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698