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

Side by Side Diff: components/translate/core/common/translate_metrics_unittest.cc

Issue 378253002: Fix translate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/translate/core/common/translate_metrics.h" 5 #include "components/translate/core/common/translate_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/metrics/histogram.h" 9 #include "base/metrics/histogram.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 "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/platform_test.h" 13 #include "testing/platform_test.h"
14 14
15 using base::HistogramBase; 15 using base::HistogramBase;
16 using base::HistogramSamples; 16 using base::HistogramSamples;
17 using base::SampleCountIterator; 17 using base::SampleCountIterator;
18 using base::StatisticsRecorder; 18 using base::StatisticsRecorder;
19 using base::TimeTicks; 19 using base::TimeTicks;
20 20
21 namespace translate {
22
21 namespace { 23 namespace {
22 24
23 const int kTrue = 1; 25 const int kTrue = 1;
24 const int kFalse = 0; 26 const int kFalse = 0;
25 27
26 class MetricsRecorder { 28 class MetricsRecorder {
27 public: 29 public:
28 explicit MetricsRecorder(const char* key) : key_(key) { 30 explicit MetricsRecorder(const char* key) : key_(key) {
29 StatisticsRecorder::Initialize(); 31 StatisticsRecorder::Initialize();
30 32
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 TEST(TranslateMetricsTest, ReportLanguageDetectionTime) { 277 TEST(TranslateMetricsTest, ReportLanguageDetectionTime) {
276 MetricsRecorder recorder( 278 MetricsRecorder recorder(
277 translate::GetMetricsName(translate::UMA_LANGUAGE_DETECTION)); 279 translate::GetMetricsName(translate::UMA_LANGUAGE_DETECTION));
278 recorder.CheckTotalCount(0); 280 recorder.CheckTotalCount(0);
279 TimeTicks begin = TimeTicks::Now(); 281 TimeTicks begin = TimeTicks::Now();
280 TimeTicks end = begin + base::TimeDelta::FromMicroseconds(9009); 282 TimeTicks end = begin + base::TimeDelta::FromMicroseconds(9009);
281 translate::ReportLanguageDetectionTime(begin, end); 283 translate::ReportLanguageDetectionTime(begin, end);
282 recorder.CheckValueInLogs(9.009); 284 recorder.CheckValueInLogs(9.009);
283 recorder.CheckTotalCount(1); 285 recorder.CheckTotalCount(1);
284 } 286 }
287
288 } // namespace translate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698