| OLD | NEW |
| 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/statistics_delta_reader.h" | 13 #include "base/test/statistics_delta_reader.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() : loop_(base::MessageLoop::TYPE_DEFAULT) { | 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 virtual void SetUp() OVERRIDE { |
| 31 metrics_.reset(new SpellCheckHostMetrics); | 31 metrics_.reset(new SpellCheckHostMetrics); |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 base::StatisticsDeltaReader statistics_delta_reader2; | 126 base::StatisticsDeltaReader statistics_delta_reader2; |
| 127 | 127 |
| 128 metrics()->RecordSpellingServiceStats(true); | 128 metrics()->RecordSpellingServiceStats(true); |
| 129 | 129 |
| 130 samples = | 130 samples = |
| 131 statistics_delta_reader2.GetHistogramSamplesSinceCreation(kMetricName); | 131 statistics_delta_reader2.GetHistogramSamplesSinceCreation(kMetricName); |
| 132 EXPECT_EQ(0, samples->GetCount(0)); | 132 EXPECT_EQ(0, samples->GetCount(0)); |
| 133 EXPECT_EQ(1, samples->GetCount(1)); | 133 EXPECT_EQ(1, samples->GetCount(1)); |
| 134 } | 134 } |
| OLD | NEW |