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

Side by Side Diff: media/blink/multibuffer_unittest.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 must_read_whole_file_(false), 139 must_read_whole_file_(false),
140 writers_created_(0), 140 writers_created_(0),
141 rnd_(rnd) {} 141 rnd_(rnd) {}
142 142
143 void SetMaxWriters(size_t max_writers) { max_writers_ = max_writers; } 143 void SetMaxWriters(size_t max_writers) { max_writers_ = max_writers; }
144 144
145 void CheckPresentState() { 145 void CheckPresentState() {
146 IntervalMap<MultiBufferBlockId, int32_t> tmp; 146 IntervalMap<MultiBufferBlockId, int32_t> tmp;
147 for (DataMap::iterator i = data_.begin(); i != data_.end(); ++i) { 147 for (DataMap::iterator i = data_.begin(); i != data_.end(); ++i) {
148 CHECK(i->second); // Null poineters are not allowed in data_ 148 CHECK(i->second); // Null poineters are not allowed in data_
149 CHECK_NE(!!pinned_[i->first], lru_->Contains(this, i->first)) 149 CHECK_NE(!!pinned_[i->first], lru_->Contains(this, i->first));
150 << " i->first = " << i->first;
151 tmp.IncrementInterval(i->first, i->first + 1, 1); 150 tmp.IncrementInterval(i->first, i->first + 1, 1);
152 } 151 }
153 IntervalMap<MultiBufferBlockId, int32_t>::const_iterator tmp_iterator = 152 IntervalMap<MultiBufferBlockId, int32_t>::const_iterator tmp_iterator =
154 tmp.begin(); 153 tmp.begin();
155 IntervalMap<MultiBufferBlockId, int32_t>::const_iterator present_iterator = 154 IntervalMap<MultiBufferBlockId, int32_t>::const_iterator present_iterator =
156 present_.begin(); 155 present_.begin();
157 while (tmp_iterator != tmp.end() && present_iterator != present_.end()) { 156 while (tmp_iterator != tmp.end() && present_iterator != present_.end()) {
158 EXPECT_EQ(tmp_iterator.interval_begin(), 157 EXPECT_EQ(tmp_iterator.interval_begin(),
159 present_iterator.interval_begin()); 158 present_iterator.interval_begin());
160 EXPECT_EQ(tmp_iterator.interval_end(), present_iterator.interval_end()); 159 EXPECT_EQ(tmp_iterator.interval_end(), present_iterator.interval_end());
161 EXPECT_EQ(tmp_iterator.value(), present_iterator.value()); 160 EXPECT_EQ(tmp_iterator.value(), present_iterator.value());
162 ++tmp_iterator; 161 ++tmp_iterator;
163 ++present_iterator; 162 ++present_iterator;
164 } 163 }
165 EXPECT_TRUE(tmp_iterator == tmp.end()); 164 EXPECT_TRUE(tmp_iterator == tmp.end());
166 EXPECT_TRUE(present_iterator == present_.end()); 165 EXPECT_TRUE(present_iterator == present_.end());
167 } 166 }
168 167
169 void CheckLRUState() { 168 void CheckLRUState() {
170 for (DataMap::iterator i = data_.begin(); i != data_.end(); ++i) { 169 for (DataMap::iterator i = data_.begin(); i != data_.end(); ++i) {
171 CHECK(i->second); // Null poineters are not allowed in data_ 170 CHECK(i->second); // Null poineters are not allowed in data_
172 CHECK_NE(!!pinned_[i->first], lru_->Contains(this, i->first)) 171 // i->first = |i->first|.
173 << " i->first = " << i->first; 172 CHECK_NE(!!pinned_[i->first], lru_->Contains(this, i->first));
174 CHECK_EQ(1, present_[i->first]) << " i->first = " << i->first; 173 // i->first = |i->first|
174 CHECK_EQ(1, present_[i->first]);
175 } 175 }
176 } 176 }
177 177
178 void SetFileSize(size_t file_size) { file_size_ = file_size; } 178 void SetFileSize(size_t file_size) { file_size_ = file_size; }
179 179
180 void SetMaxBlocksAfterDefer(int32_t max_blocks_after_defer) { 180 void SetMaxBlocksAfterDefer(int32_t max_blocks_after_defer) {
181 max_blocks_after_defer_ = max_blocks_after_defer; 181 max_blocks_after_defer_ = max_blocks_after_defer;
182 } 182 }
183 183
184 void SetMustReadWholeFile(bool must_read_whole_file) { 184 void SetMustReadWholeFile(bool must_read_whole_file) {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 multibuffer_.CheckLRUState(); 567 multibuffer_.CheckLRUState();
568 } 568 }
569 multibuffer_.CheckPresentState(); 569 multibuffer_.CheckPresentState();
570 while (!read_helpers.empty()) { 570 while (!read_helpers.empty()) {
571 delete read_helpers.back(); 571 delete read_helpers.back();
572 read_helpers.pop_back(); 572 read_helpers.pop_back();
573 } 573 }
574 } 574 }
575 575
576 } // namespace media 576 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698