OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/chrome/test/app/histogram_test_util.h" | 5 #import "ios/chrome/test/app/histogram_test_util.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
11 #include "base/metrics/histogram_samples.h" | 11 #include "base/metrics/histogram_samples.h" |
12 #include "base/metrics/metrics_hashes.h" | 12 #include "base/metrics/metrics_hashes.h" |
13 #include "base/metrics/sample_map.h" | 13 #include "base/metrics/sample_map.h" |
14 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 | 16 |
| 17 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 18 #error "This file requires ARC support." |
| 19 #endif |
| 20 |
17 namespace { | 21 namespace { |
18 base::HistogramBase* FindHistogram(const std::string& name, | 22 base::HistogramBase* FindHistogram(const std::string& name, |
19 FailureBlock failure_block) { | 23 FailureBlock failure_block) { |
20 base::HistogramBase* histogram = | 24 base::HistogramBase* histogram = |
21 base::StatisticsRecorder::FindHistogram(name); | 25 base::StatisticsRecorder::FindHistogram(name); |
22 if (!histogram && failure_block) { | 26 if (!histogram && failure_block) { |
23 failure_block([NSString | 27 failure_block([NSString |
24 stringWithFormat:@"Histogram %s does not exist", name.c_str()]); | 28 stringWithFormat:@"Histogram %s does not exist", name.c_str()]); |
25 } | 29 } |
26 return histogram; | 30 return histogram; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 failure_block( | 182 failure_block( |
179 [NSString stringWithFormat:@"Histogram \"%s\" doe not have the " | 183 [NSString stringWithFormat:@"Histogram \"%s\" doe not have the " |
180 "right total number of samples(%d). It has " | 184 "right total number of samples(%d). It has " |
181 "(%d).", | 185 "(%d).", |
182 name.c_str(), expected_count, actual_count]); | 186 name.c_str(), expected_count, actual_count]); |
183 } | 187 } |
184 return NO; | 188 return NO; |
185 } | 189 } |
186 | 190 |
187 } // namespace chrome_test_util | 191 } // namespace chrome_test_util |
OLD | NEW |