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

Side by Side Diff: base/metrics/sample_map_unittest.cc

Issue 2162053006: Move EXPECT_DCHECK_DEATH from base/task_scheduler and use it in relevant base/ tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge up to r408965 Created 4 years, 4 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
« no previous file with comments | « base/metrics/persistent_sample_map_unittest.cc ('k') | base/metrics/sample_vector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/metrics/sample_map.h" 5 #include "base/metrics/sample_map.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/test/gtest_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace base { 12 namespace base {
12 namespace { 13 namespace {
13 14
14 TEST(SampleMapTest, AccumulateTest) { 15 TEST(SampleMapTest, AccumulateTest) {
15 SampleMap samples(1); 16 SampleMap samples(1);
16 17
17 samples.Accumulate(1, 100); 18 samples.Accumulate(1, 100);
18 samples.Accumulate(2, 200); 19 samples.Accumulate(2, 200);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 138
138 it->Get(&min, &max, &count); 139 it->Get(&min, &max, &count);
139 EXPECT_EQ(15, min); 140 EXPECT_EQ(15, min);
140 EXPECT_EQ(16, max); 141 EXPECT_EQ(16, max);
141 EXPECT_EQ(3, count); 142 EXPECT_EQ(3, count);
142 143
143 it->Next(); 144 it->Next();
144 EXPECT_TRUE(it->Done()); 145 EXPECT_TRUE(it->Done());
145 } 146 }
146 147
147 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST
148
149 TEST(SampleMapIteratorDeathTest, IterateDoneTest) { 148 TEST(SampleMapIteratorDeathTest, IterateDoneTest) {
150 SampleMap samples(1); 149 SampleMap samples(1);
151 150
152 std::unique_ptr<SampleCountIterator> it = samples.Iterator(); 151 std::unique_ptr<SampleCountIterator> it = samples.Iterator();
153 152
154 EXPECT_TRUE(it->Done()); 153 EXPECT_TRUE(it->Done());
155 154
156 HistogramBase::Sample min; 155 HistogramBase::Sample min;
157 HistogramBase::Sample max; 156 HistogramBase::Sample max;
158 HistogramBase::Count count; 157 HistogramBase::Count count;
159 EXPECT_DEATH(it->Get(&min, &max, &count), ""); 158 EXPECT_DCHECK_DEATH(it->Get(&min, &max, &count), "");
160 159
161 EXPECT_DEATH(it->Next(), ""); 160 EXPECT_DCHECK_DEATH(it->Next(), "");
162 161
163 samples.Accumulate(1, 100); 162 samples.Accumulate(1, 100);
164 it = samples.Iterator(); 163 it = samples.Iterator();
165 EXPECT_FALSE(it->Done()); 164 EXPECT_FALSE(it->Done());
166 } 165 }
167 166
168 #endif
169 // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST
170
171 } // namespace 167 } // namespace
172 } // namespace base 168 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/persistent_sample_map_unittest.cc ('k') | base/metrics/sample_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698