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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/ui/webui/ntp/ntp_user_data_logger.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/common/ntp_logging_events.h" 11 #include "chrome/common/ntp_logging_events.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace { 14 namespace {
15 15
16 class TestNTPUserDataLogger : public NTPUserDataLogger { 16 class TestNTPUserDataLogger : public NTPUserDataLogger {
17 public: 17 public:
18 TestNTPUserDataLogger() : NTPUserDataLogger(NULL) {} 18 TestNTPUserDataLogger() : NTPUserDataLogger(NULL) {}
19 virtual ~TestNTPUserDataLogger() {} 19 ~TestNTPUserDataLogger() override {}
20 }; 20 };
21 21
22 base::HistogramBase::Count GetTotalCount(const std::string& histogram_name) { 22 base::HistogramBase::Count GetTotalCount(const std::string& histogram_name) {
23 base::HistogramBase* histogram = base::StatisticsRecorder::FindHistogram( 23 base::HistogramBase* histogram = base::StatisticsRecorder::FindHistogram(
24 histogram_name); 24 histogram_name);
25 // Return 0 if history is uninitialized. 25 // Return 0 if history is uninitialized.
26 return histogram ? histogram->SnapshotSamples()->TotalCount() : 0; 26 return histogram ? histogram->SnapshotSamples()->TotalCount() : 0;
27 } 27 }
28 28
29 base::HistogramBase::Count GetBinCount(const std::string& histogram_name, 29 base::HistogramBase::Count GetBinCount(const std::string& histogram_name,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 logger.LogMostVisitedNavigation(5, base::ASCIIToUTF16("")); 148 logger.LogMostVisitedNavigation(5, base::ASCIIToUTF16(""));
149 EXPECT_EQ(3, GetTotalCount("NewTabPage.MostVisited")); 149 EXPECT_EQ(3, GetTotalCount("NewTabPage.MostVisited"));
150 EXPECT_EQ(1, GetBinCount("NewTabPage.MostVisited.foobar", 1)); 150 EXPECT_EQ(1, GetBinCount("NewTabPage.MostVisited.foobar", 1));
151 EXPECT_EQ(1, GetBinCount("NewTabPage.MostVisited.foobar", 5)); 151 EXPECT_EQ(1, GetBinCount("NewTabPage.MostVisited.foobar", 5));
152 152
153 logger.LogMostVisitedNavigation(1, base::ASCIIToUTF16("foobar")); 153 logger.LogMostVisitedNavigation(1, base::ASCIIToUTF16("foobar"));
154 EXPECT_EQ(4, GetTotalCount("NewTabPage.MostVisited")); 154 EXPECT_EQ(4, GetTotalCount("NewTabPage.MostVisited"));
155 EXPECT_EQ(2, GetBinCount("NewTabPage.MostVisited.foobar", 1)); 155 EXPECT_EQ(2, GetBinCount("NewTabPage.MostVisited.foobar", 1));
156 EXPECT_EQ(1, GetBinCount("NewTabPage.MostVisited.foobar", 5)); 156 EXPECT_EQ(1, GetBinCount("NewTabPage.MostVisited.foobar", 5));
157 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698