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

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

Issue 13428008: [Spellcheck] Record the number of words in the custom dictionary when the custom dictionary is load… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: responding to comments Created 7 years, 8 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
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_host_metrics.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 histogram = 60 histogram =
61 StatisticsRecorder::FindHistogram("SpellCheck.Enabled"); 61 StatisticsRecorder::FindHistogram("SpellCheck.Enabled");
62 ASSERT_TRUE(histogram != NULL); 62 ASSERT_TRUE(histogram != NULL);
63 samples = histogram->SnapshotSamples(); 63 samples = histogram->SnapshotSamples();
64 samples->Subtract(*baseline); 64 samples->Subtract(*baseline);
65 EXPECT_EQ(0, samples->GetCount(0)); 65 EXPECT_EQ(0, samples->GetCount(0));
66 EXPECT_EQ(1, samples->GetCount(1)); 66 EXPECT_EQ(1, samples->GetCount(1));
67 } 67 }
68 68
69 TEST_F(SpellcheckHostMetricsTest, CustomWordStats) { 69 TEST_F(SpellcheckHostMetricsTest, CustomWordStats) {
70 metrics()->RecordCustomWordCountStats(123); 70 SpellCheckHostMetrics::RecordCustomWordCountStats(123);
71 71
72 HistogramBase* histogram = 72 HistogramBase* histogram =
73 StatisticsRecorder::FindHistogram("SpellCheck.CustomWords"); 73 StatisticsRecorder::FindHistogram("SpellCheck.CustomWords");
74 ASSERT_TRUE(histogram != NULL); 74 ASSERT_TRUE(histogram != NULL);
75 scoped_ptr<HistogramSamples> baseline = histogram->SnapshotSamples(); 75 scoped_ptr<HistogramSamples> baseline = histogram->SnapshotSamples();
76 76
77 metrics()->RecordCustomWordCountStats(23); 77 SpellCheckHostMetrics::RecordCustomWordCountStats(23);
78 histogram = 78 histogram =
79 StatisticsRecorder::FindHistogram("SpellCheck.CustomWords"); 79 StatisticsRecorder::FindHistogram("SpellCheck.CustomWords");
80 ASSERT_TRUE(histogram != NULL); 80 ASSERT_TRUE(histogram != NULL);
81 scoped_ptr<HistogramSamples> samples = histogram->SnapshotSamples(); 81 scoped_ptr<HistogramSamples> samples = histogram->SnapshotSamples();
82 82
83 samples->Subtract(*baseline); 83 samples->Subtract(*baseline);
84 EXPECT_EQ(23,samples->sum()); 84 EXPECT_EQ(23,samples->sum());
85 } 85 }
86 86
87 TEST_F(SpellcheckHostMetricsTest, RecordWordCountsDiscardsDuplicates) { 87 TEST_F(SpellcheckHostMetricsTest, RecordWordCountsDiscardsDuplicates) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 metrics()->RecordSpellingServiceStats(true); 148 metrics()->RecordSpellingServiceStats(true);
149 149
150 histogram = 150 histogram =
151 StatisticsRecorder::FindHistogram(kMetricName); 151 StatisticsRecorder::FindHistogram(kMetricName);
152 ASSERT_TRUE(histogram != NULL); 152 ASSERT_TRUE(histogram != NULL);
153 samples = histogram->SnapshotSamples(); 153 samples = histogram->SnapshotSamples();
154 samples->Subtract(*baseline); 154 samples->Subtract(*baseline);
155 EXPECT_EQ(0, samples->GetCount(0)); 155 EXPECT_EQ(0, samples->GetCount(0));
156 EXPECT_EQ(1, samples->GetCount(1)); 156 EXPECT_EQ(1, samples->GetCount(1));
157 } 157 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_host_metrics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698