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

Side by Side Diff: base/memory/scoped_ptr_unittest.cc

Issue 722513003: Enable -Wunused-local-typedef (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month 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 | « no previous file | build/common.gypi » ('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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 inline void operator()(int* x) { delete x; } 662 inline void operator()(int* x) { delete x; }
663 }; 663 };
664 scoped_ptr<int, CustomDeleter> x(new int); 664 scoped_ptr<int, CustomDeleter> x(new int);
665 EXPECT_DEATH(x.reset(x.get()), ""); 665 EXPECT_DEATH(x.reset(x.get()), "");
666 } 666 }
667 #endif 667 #endif
668 668
669 TEST(ScopedPtrTest, SelfResetWithCustomDeleterOptOut) { 669 TEST(ScopedPtrTest, SelfResetWithCustomDeleterOptOut) {
670 // A custom deleter should be able to opt out of self-reset abort behavior. 670 // A custom deleter should be able to opt out of self-reset abort behavior.
671 struct NoOpDeleter { 671 struct NoOpDeleter {
672 #if !defined(NDEBUG)
672 typedef void AllowSelfReset; 673 typedef void AllowSelfReset;
674 #endif
673 inline void operator()(int*) {} 675 inline void operator()(int*) {}
674 }; 676 };
675 scoped_ptr<int> owner(new int); 677 scoped_ptr<int> owner(new int);
676 scoped_ptr<int, NoOpDeleter> x(owner.get()); 678 scoped_ptr<int, NoOpDeleter> x(owner.get());
677 x.reset(x.get()); 679 x.reset(x.get());
678 } 680 }
OLDNEW
« no previous file with comments | « no previous file | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698