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

Side by Side Diff: sync/util/data_type_histogram_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 | « sync/util/data_type_histogram.cc ('k') | sync/util/encryptor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sync/util/data_type_histogram.h"
6
7 #include "base/metrics/statistics_recorder.h"
8 #include "base/time/time.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace syncer {
12 namespace {
13
14 class DataTypeHistogramTest : public testing::Test {
15 public:
16 void SetUp() override {
17 base::StatisticsRecorder::Initialize();
18 }
19 };
20
21 // Create a histogram of type LOCAL_HISTOGRAM_COUNTS for each model type.
22 // Nothing should break.
23 TEST(DataTypeHistogramTest, BasicCount) {
24 for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) {
25 ModelType type = ModelTypeFromInt(i);
26 #define PER_DATA_TYPE_MACRO(type_str) \
27 LOCAL_HISTOGRAM_COUNTS("BasicCountPrefix" type_str "Suffix", 1);
28 SYNC_DATA_TYPE_HISTOGRAM(type);
29 #undef PER_DATA_TYPE_MACRO
30 }
31 }
32
33 // Create a histogram of type SYNC_FREQ_HISTOGRAM for each model type. Nothing
34 // should break.
35 TEST(DataTypeHistogramTest, BasicFreq) {
36 for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) {
37 ModelType type = ModelTypeFromInt(i);
38 #define PER_DATA_TYPE_MACRO(type_str) \
39 SYNC_FREQ_HISTOGRAM("BasicFreqPrefix" type_str "Suffix", \
40 base::TimeDelta::FromSeconds(1));
41 SYNC_DATA_TYPE_HISTOGRAM(type);
42 #undef PER_DATA_TYPE_MACRO
43 }
44 }
45
46 // Create a histogram of type UMA_HISTOGRAM_ENUMERATION for each model type.
47 // Nothing should break.
48 TEST(DataTypeHistogramTest, BasicEnum) {
49 enum HistTypes {
50 TYPE_1,
51 TYPE_2,
52 TYPE_COUNT,
53 };
54 for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) {
55 ModelType type = ModelTypeFromInt(i);
56 #define PER_DATA_TYPE_MACRO(type_str) \
57 UMA_HISTOGRAM_ENUMERATION("BasicEnumPrefix" type_str "Suffix", \
58 (i % 2 ? TYPE_1 : TYPE_2), TYPE_COUNT);
59 SYNC_DATA_TYPE_HISTOGRAM(type);
60 #undef PER_DATA_TYPE_MACRO
61 }
62 }
63
64 } // namespace
65 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/util/data_type_histogram.cc ('k') | sync/util/encryptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698