diff options
author | maxbogue <maxbogue@chromium.org> | 2014-11-24 15:05:40 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-24 23:06:03 +0000 |
commit | cfa7093b5171b9aa3027d9d017ce79e64740527b (patch) | |
tree | ee8e8d7edcb82c18494b9da90ddd2134886f45dd /sync/util | |
parent | 971235610c0142f602b87c4e9c5d3770409fad4a (diff) | |
download | chromium_src-cfa7093b5171b9aa3027d9d017ce79e64740527b.zip chromium_src-cfa7093b5171b9aa3027d9d017ce79e64740527b.tar.gz chromium_src-cfa7093b5171b9aa3027d9d017ce79e64740527b.tar.bz2 |
Add UMA counting for Sync Attachments response codes.
sync/util/data_type_histogram_unittest.cc had to be edited
because it initialized different types of histograms with
identical names. Previously this did not crash because the
tests had failed to invoke StatisticsRecorder::Initialize().
The HistogramTester this CL introduces in the attachments
unittests does that initialization, so things broke in fun
and unexpected ways.
BUG=436134
Review URL: https://codereview.chromium.org/728323003
Cr-Commit-Position: refs/heads/master@{#305514}
Diffstat (limited to 'sync/util')
-rw-r--r-- | sync/util/data_type_histogram_unittest.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sync/util/data_type_histogram_unittest.cc b/sync/util/data_type_histogram_unittest.cc index df65735..7dc2bf2 100644 --- a/sync/util/data_type_histogram_unittest.cc +++ b/sync/util/data_type_histogram_unittest.cc @@ -4,6 +4,7 @@ #include "sync/util/data_type_histogram.h" +#include "base/metrics/statistics_recorder.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" @@ -11,6 +12,10 @@ namespace syncer { namespace { class DataTypeHistogramTest : public testing::Test { + public: + void SetUp() override { + base::StatisticsRecorder::Initialize(); + } }; // Create a histogram of type LOCAL_HISTOGRAM_COUNTS for each model type. @@ -19,7 +24,7 @@ TEST(DataTypeHistogramTest, BasicCount) { for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) { ModelType type = ModelTypeFromInt(i); #define PER_DATA_TYPE_MACRO(type_str) \ - LOCAL_HISTOGRAM_COUNTS("Prefix" type_str "Suffix", 1); + LOCAL_HISTOGRAM_COUNTS("BasicCountPrefix" type_str "Suffix", 1); SYNC_DATA_TYPE_HISTOGRAM(type); #undef PER_DATA_TYPE_MACRO } @@ -31,7 +36,7 @@ TEST(DataTypeHistogramTest, BasicFreq) { for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) { ModelType type = ModelTypeFromInt(i); #define PER_DATA_TYPE_MACRO(type_str) \ - SYNC_FREQ_HISTOGRAM("Prefix" type_str "Suffix", \ + SYNC_FREQ_HISTOGRAM("BasicFreqPrefix" type_str "Suffix", \ base::TimeDelta::FromSeconds(1)); SYNC_DATA_TYPE_HISTOGRAM(type); #undef PER_DATA_TYPE_MACRO @@ -49,7 +54,7 @@ TEST(DataTypeHistogramTest, BasicEnum) { for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) { ModelType type = ModelTypeFromInt(i); #define PER_DATA_TYPE_MACRO(type_str) \ - UMA_HISTOGRAM_ENUMERATION("Prefix" type_str "Suffix", \ + UMA_HISTOGRAM_ENUMERATION("BasicEnumPrefix" type_str "Suffix", \ (i % 2 ? TYPE_1 : TYPE_2), TYPE_COUNT); SYNC_DATA_TYPE_HISTOGRAM(type); #undef PER_DATA_TYPE_MACRO |