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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_host_metrics_unittest.cc

Issue 684613002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/spellchecker/spellcheck_host_metrics.h" 5 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram_samples.h" 10 #include "base/metrics/histogram_samples.h"
11 #include "base/metrics/statistics_recorder.h" 11 #include "base/metrics/statistics_recorder.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/test/histogram_tester.h" 13 #include "base/test/histogram_tester.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 // For version specific disabled tests below (http://crbug.com/230534). 17 // For version specific disabled tests below (http://crbug.com/230534).
18 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
19 #endif 19 #endif
20 20
21 class SpellcheckHostMetricsTest : public testing::Test { 21 class SpellcheckHostMetricsTest : public testing::Test {
22 public: 22 public:
23 SpellcheckHostMetricsTest() { 23 SpellcheckHostMetricsTest() {
24 } 24 }
25 25
26 static void SetUpTestCase() { 26 static void SetUpTestCase() {
27 base::StatisticsRecorder::Initialize(); 27 base::StatisticsRecorder::Initialize();
28 } 28 }
29 29
30 virtual void SetUp() override { 30 void SetUp() override { metrics_.reset(new SpellCheckHostMetrics); }
31 metrics_.reset(new SpellCheckHostMetrics);
32 }
33 31
34 SpellCheckHostMetrics* metrics() { return metrics_.get(); } 32 SpellCheckHostMetrics* metrics() { return metrics_.get(); }
35 void RecordWordCountsForTesting() { metrics_->RecordWordCounts(); } 33 void RecordWordCountsForTesting() { metrics_->RecordWordCounts(); }
36 34
37 private: 35 private:
38 base::MessageLoop loop_; 36 base::MessageLoop loop_;
39 scoped_ptr<SpellCheckHostMetrics> metrics_; 37 scoped_ptr<SpellCheckHostMetrics> metrics_;
40 }; 38 };
41 39
42 TEST_F(SpellcheckHostMetricsTest, RecordEnabledStats) { 40 TEST_F(SpellcheckHostMetricsTest, RecordEnabledStats) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 103
106 histogram_tester1.ExpectBucketCount(kMetricName, 0, 1); 104 histogram_tester1.ExpectBucketCount(kMetricName, 0, 1);
107 histogram_tester1.ExpectBucketCount(kMetricName, 1, 0); 105 histogram_tester1.ExpectBucketCount(kMetricName, 1, 0);
108 106
109 base::HistogramTester histogram_tester2; 107 base::HistogramTester histogram_tester2;
110 108
111 metrics()->RecordSpellingServiceStats(true); 109 metrics()->RecordSpellingServiceStats(true);
112 histogram_tester2.ExpectBucketCount(kMetricName, 0, 0); 110 histogram_tester2.ExpectBucketCount(kMetricName, 0, 0);
113 histogram_tester2.ExpectBucketCount(kMetricName, 1, 1); 111 histogram_tester2.ExpectBucketCount(kMetricName, 1, 1);
114 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698