[Spellcheck] Prevent re-recording of non-changed values.
The values recorded in RecordWordCounts() are all strictly monotonic. As such,
re-recording them if they haven't changed distorts our metrics.
Also added framework for unittests for metrics object, plus some basic tests.
[email protected]
[email protected]
BUG=none
Review URL: https://chromiumcodereview.appspot.com/11419178
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169804 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/spellchecker/spellcheck_host_metrics.h b/chrome/browser/spellchecker/spellcheck_host_metrics.h
index d8c9629..14644931 100644
--- a/chrome/browser/spellchecker/spellcheck_host_metrics.h
+++ b/chrome/browser/spellchecker/spellcheck_host_metrics.h
@@ -56,6 +56,7 @@
void RecordSuggestionStats(int delta);
private:
+ friend class SpellcheckHostMetricsTest;
void OnHistogramTimerExpired();
// Records various counters without changing their values.
@@ -63,12 +64,23 @@
// Number of corrected words of checked words.
int misspelled_word_count_;
+ int last_misspelled_word_count_;
+
// Number of checked words.
int spellchecked_word_count_;
+ int last_spellchecked_word_count_;
+
// Number of suggestion list showings.
int suggestion_show_count_;
+ int last_suggestion_show_count_;
+
// Number of misspelled words replaced by a user.
int replaced_word_count_;
+ int last_replaced_word_count_;
+
+ // Last recorded number of unique words.
+ int last_unique_word_count_;
+
// Time when first spellcheck happened.
base::TimeTicks start_time_;
// Set of checked words in the hashed form.