| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.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/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 | 15 |
| 16 class StatisticsRecorderTest : public testing::Test { | 16 class StatisticsRecorderTest : public testing::Test { |
| 17 protected: | 17 protected: |
| 18 virtual void SetUp() { | 18 void SetUp() override { |
| 19 // Each test will have a clean state (no Histogram / BucketRanges | 19 // Each test will have a clean state (no Histogram / BucketRanges |
| 20 // registered). | 20 // registered). |
| 21 InitializeStatisticsRecorder(); | 21 InitializeStatisticsRecorder(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 virtual void TearDown() { | 24 void TearDown() override { UninitializeStatisticsRecorder(); } |
| 25 UninitializeStatisticsRecorder(); | |
| 26 } | |
| 27 | 25 |
| 28 void InitializeStatisticsRecorder() { | 26 void InitializeStatisticsRecorder() { |
| 29 statistics_recorder_ = new StatisticsRecorder(); | 27 statistics_recorder_ = new StatisticsRecorder(); |
| 30 } | 28 } |
| 31 | 29 |
| 32 void UninitializeStatisticsRecorder() { | 30 void UninitializeStatisticsRecorder() { |
| 33 delete statistics_recorder_; | 31 delete statistics_recorder_; |
| 34 statistics_recorder_ = NULL; | 32 statistics_recorder_ = NULL; |
| 35 } | 33 } |
| 36 | 34 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 306 |
| 309 json.clear(); | 307 json.clear(); |
| 310 UninitializeStatisticsRecorder(); | 308 UninitializeStatisticsRecorder(); |
| 311 | 309 |
| 312 // No data should be returned. | 310 // No data should be returned. |
| 313 json = StatisticsRecorder::ToJSON(query); | 311 json = StatisticsRecorder::ToJSON(query); |
| 314 EXPECT_TRUE(json.empty()); | 312 EXPECT_TRUE(json.empty()); |
| 315 } | 313 } |
| 316 | 314 |
| 317 } // namespace base | 315 } // namespace base |
| OLD | NEW |