OLD | NEW |
| (Empty) |
1 // Copyright 2006-2009 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 // | |
16 #ifndef OMAHA_STATSREPORT_AGGREGATOR_UNITTEST_H__ | |
17 #define OMAHA_STATSREPORT_AGGREGATOR_UNITTEST_H__ | |
18 | |
19 #include "metrics.h" | |
20 #include "omaha/third_party/gtest/include/gtest/gtest.h" | |
21 | |
22 /// Test fixture shared among aggregator unit tests | |
23 class MetricsAggregatorTest: public testing::Test { | |
24 public: | |
25 #define INIT_METRIC(type, name) name##_(#name, &coll_) | |
26 #define DECL_METRIC(type, name) stats_report::type##Metric name##_ | |
27 | |
28 MetricsAggregatorTest() : | |
29 INIT_METRIC(Count, c1), | |
30 INIT_METRIC(Count, c2), | |
31 INIT_METRIC(Timing, t1), | |
32 INIT_METRIC(Timing, t2), | |
33 INIT_METRIC(Integer, i1), | |
34 INIT_METRIC(Integer, i2), | |
35 INIT_METRIC(Bool, b1), | |
36 INIT_METRIC(Bool, b2) { | |
37 } | |
38 | |
39 enum { | |
40 kNumCounts = 2, | |
41 kNumTimings = 2, | |
42 kNumIntegers = 2, | |
43 kNumBools = 2 | |
44 }; | |
45 | |
46 stats_report::MetricCollection coll_; | |
47 DECL_METRIC(Count, c1); | |
48 DECL_METRIC(Count, c2); | |
49 DECL_METRIC(Timing, t1); | |
50 DECL_METRIC(Timing, t2); | |
51 DECL_METRIC(Integer, i1); | |
52 DECL_METRIC(Integer, i2); | |
53 DECL_METRIC(Bool, b1); | |
54 DECL_METRIC(Bool, b2); | |
55 | |
56 #undef INIT_METRIC | |
57 #undef DECL_METRIC | |
58 | |
59 virtual void SetUp() { | |
60 coll_.Initialize(); | |
61 } | |
62 | |
63 virtual void TearDown() { | |
64 coll_.Uninitialize(); | |
65 } | |
66 }; | |
67 | |
68 #endif // OMAHA_STATSREPORT_AGGREGATOR_UNITTEST_H__ | |
OLD | NEW |