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

Side by Side Diff: chrome/common/translate/translate_common_metrics_unittest.cc

Issue 18820002: Remove ENABLE_LANGUAGE_DETECTION (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug fix: mis-rebased Created 7 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
« no previous file with comments | « chrome/common/translate/translate_common_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/translate/translate_common_metrics.h" 5 #include "chrome/common/translate/translate_common_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"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 EXPECT_EQ(0, recorder.GetCount(kTrue)); 281 EXPECT_EQ(0, recorder.GetCount(kTrue));
282 EXPECT_EQ(0, recorder.GetCount(kFalse)); 282 EXPECT_EQ(0, recorder.GetCount(kFalse));
283 TranslateCommonMetrics::ReportSimilarLanguageMatch(true); 283 TranslateCommonMetrics::ReportSimilarLanguageMatch(true);
284 EXPECT_EQ(1, recorder.GetCount(kTrue)); 284 EXPECT_EQ(1, recorder.GetCount(kTrue));
285 EXPECT_EQ(0, recorder.GetCount(kFalse)); 285 EXPECT_EQ(0, recorder.GetCount(kFalse));
286 TranslateCommonMetrics::ReportSimilarLanguageMatch(false); 286 TranslateCommonMetrics::ReportSimilarLanguageMatch(false);
287 EXPECT_EQ(1, recorder.GetCount(kTrue)); 287 EXPECT_EQ(1, recorder.GetCount(kTrue));
288 EXPECT_EQ(1, recorder.GetCount(kFalse)); 288 EXPECT_EQ(1, recorder.GetCount(kFalse));
289 } 289 }
290 290
291 #if defined(ENABLE_LANGUAGE_DETECTION)
292
293 TEST(TranslateCommonMetricsTest, ReportLanguageDetectionTime) { 291 TEST(TranslateCommonMetricsTest, ReportLanguageDetectionTime) {
294 MetricsRecorder recorder(TranslateCommonMetrics::GetMetricsName( 292 MetricsRecorder recorder(TranslateCommonMetrics::GetMetricsName(
295 TranslateCommonMetrics::UMA_LANGUAGE_DETECTION)); 293 TranslateCommonMetrics::UMA_LANGUAGE_DETECTION));
296 recorder.CheckTotalCount(0); 294 recorder.CheckTotalCount(0);
297 TimeTicks begin = TimeTicks::Now(); 295 TimeTicks begin = TimeTicks::Now();
298 TimeTicks end = begin + base::TimeDelta::FromMicroseconds(9009); 296 TimeTicks end = begin + base::TimeDelta::FromMicroseconds(9009);
299 TranslateCommonMetrics::ReportLanguageDetectionTime(begin, end); 297 TranslateCommonMetrics::ReportLanguageDetectionTime(begin, end);
300 recorder.CheckValueInLogs(9.009); 298 recorder.CheckValueInLogs(9.009);
301 recorder.CheckTotalCount(1); 299 recorder.CheckTotalCount(1);
302 } 300 }
303
304 #endif // defined(ENABLE_LANGUAGE_DETECTION)
OLDNEW
« no previous file with comments | « chrome/common/translate/translate_common_metrics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698