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

Side by Side Diff: third_party/WebKit/Source/wtf/DequeTest.cpp

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... 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 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 private: 169 private:
170 int m_i; 170 int m_i;
171 int* m_destructNumber; 171 int* m_destructNumber;
172 }; 172 };
173 173
174 template <typename OwnPtrDeque> 174 template <typename OwnPtrDeque>
175 void ownPtrTest() { 175 void ownPtrTest() {
176 int destructNumber = 0; 176 int destructNumber = 0;
177 OwnPtrDeque deque; 177 OwnPtrDeque deque;
178 deque.append(wrapUnique(new DestructCounter(0, &destructNumber))); 178 deque.append(WTF::wrapUnique(new DestructCounter(0, &destructNumber)));
179 deque.append(wrapUnique(new DestructCounter(1, &destructNumber))); 179 deque.append(WTF::wrapUnique(new DestructCounter(1, &destructNumber)));
180 EXPECT_EQ(2u, deque.size()); 180 EXPECT_EQ(2u, deque.size());
181 181
182 std::unique_ptr<DestructCounter>& counter0 = deque.first(); 182 std::unique_ptr<DestructCounter>& counter0 = deque.first();
183 EXPECT_EQ(0, counter0->get()); 183 EXPECT_EQ(0, counter0->get());
184 int counter1 = deque.last()->get(); 184 int counter1 = deque.last()->get();
185 EXPECT_EQ(1, counter1); 185 EXPECT_EQ(1, counter1);
186 EXPECT_EQ(0, destructNumber); 186 EXPECT_EQ(0, destructNumber);
187 187
188 size_t index = 0; 188 size_t index = 0;
189 for (auto iter = deque.begin(); iter != deque.end(); ++iter) { 189 for (auto iter = deque.begin(); iter != deque.end(); ++iter) {
(...skipping 24 matching lines...) Expand all
214 EXPECT_EQ(counter1, ownCounter1->get()); 214 EXPECT_EQ(counter1, ownCounter1->get());
215 EXPECT_EQ(0u, deque.size()); 215 EXPECT_EQ(0u, deque.size());
216 EXPECT_EQ(1, destructNumber); 216 EXPECT_EQ(1, destructNumber);
217 217
218 ownCounter1.reset(); 218 ownCounter1.reset();
219 EXPECT_EQ(2, destructNumber); 219 EXPECT_EQ(2, destructNumber);
220 220
221 size_t count = 1025; 221 size_t count = 1025;
222 destructNumber = 0; 222 destructNumber = 0;
223 for (size_t i = 0; i < count; ++i) 223 for (size_t i = 0; i < count; ++i)
224 deque.prepend(wrapUnique(new DestructCounter(i, &destructNumber))); 224 deque.prepend(WTF::wrapUnique(new DestructCounter(i, &destructNumber)));
225 225
226 // Deque relocation must not destruct std::unique_ptr element. 226 // Deque relocation must not destruct std::unique_ptr element.
227 EXPECT_EQ(0, destructNumber); 227 EXPECT_EQ(0, destructNumber);
228 EXPECT_EQ(count, deque.size()); 228 EXPECT_EQ(count, deque.size());
229 229
230 OwnPtrDeque copyDeque; 230 OwnPtrDeque copyDeque;
231 deque.swap(copyDeque); 231 deque.swap(copyDeque);
232 EXPECT_EQ(0, destructNumber); 232 EXPECT_EQ(0, destructNumber);
233 EXPECT_EQ(count, copyDeque.size()); 233 EXPECT_EQ(count, copyDeque.size());
234 EXPECT_EQ(0u, deque.size()); 234 EXPECT_EQ(0u, deque.size());
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 { 599 {
600 int i = 1; 600 int i = 1;
601 for (int v : deque) 601 for (int v : deque)
602 EXPECT_EQ(i + 2, v); 602 EXPECT_EQ(i + 2, v);
603 } 603 }
604 } 604 }
605 605
606 } // anonymous namespace 606 } // anonymous namespace
607 607
608 } // namespace WTF 608 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | third_party/WebKit/Source/wtf/FilePrintStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698