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

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

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/util/data_type_histogram.h ('k') | chrome/browser/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 "chrome/browser/sync/util/data_type_histogram.h"
6
7 #include "base/time.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace browser_sync {
11 namespace {
12
13 class DataTypeHistogramTest : public testing::Test {
14 };
15
16 // Create a histogram of type HISTOGRAM_COUNTS for each model type. Nothing
17 // should break.
18 TEST(DataTypeHistogramTest, BasicCount) {
19 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
20 i <= syncable::LAST_REAL_MODEL_TYPE; ++i) {
21 syncable::ModelType type = syncable::ModelTypeFromInt(i);
22 #define PER_DATA_TYPE_MACRO(type_str) \
23 HISTOGRAM_COUNTS("Prefix" type_str "Suffix", 1);
24 SYNC_DATA_TYPE_HISTOGRAM(type);
25 #undef PER_DATA_TYPE_MACRO
26 }
27 }
28
29 // Create a histogram of type SYNC_FREQ_HISTOGRAM for each model type. Nothing
30 // should break.
31 TEST(DataTypeHistogramTest, BasicFreq) {
32 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
33 i <= syncable::LAST_REAL_MODEL_TYPE; ++i) {
34 syncable::ModelType type = syncable::ModelTypeFromInt(i);
35 #define PER_DATA_TYPE_MACRO(type_str) \
36 SYNC_FREQ_HISTOGRAM("Prefix" type_str "Suffix", \
37 base::TimeDelta::FromSeconds(1));
38 SYNC_DATA_TYPE_HISTOGRAM(type);
39 #undef PER_DATA_TYPE_MACRO
40 }
41 }
42
43 // Create a histogram of type UMA_HISTOGRAM_ENUMERATION for each model type.
44 // Nothing should break.
45 TEST(DataTypeHistogramTest, BasicEnum) {
46 enum HistTypes {
47 TYPE_1,
48 TYPE_2,
49 TYPE_COUNT,
50 };
51 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
52 i <= syncable::LAST_REAL_MODEL_TYPE; ++i) {
53 syncable::ModelType type = syncable::ModelTypeFromInt(i);
54 #define PER_DATA_TYPE_MACRO(type_str) \
55 UMA_HISTOGRAM_ENUMERATION("Prefix" type_str "Suffix", \
56 (i % 2 ? TYPE_1 : TYPE_2), TYPE_COUNT);
57 SYNC_DATA_TYPE_HISTOGRAM(type);
58 #undef PER_DATA_TYPE_MACRO
59 }
60 }
61
62 } // namespace
63 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/util/data_type_histogram.h ('k') | chrome/browser/sync/util/encryptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698