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

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

Issue 2163023002: Unify usage of logging/assert macros in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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/weak_ptr.h" 5 #include "base/memory/weak_ptr.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // Main thread creates an arrow referencing the Target. 556 // Main thread creates an arrow referencing the Target.
557 Arrow* arrow = new Arrow(); 557 Arrow* arrow = new Arrow();
558 arrow->target = target.AsWeakPtr(); 558 arrow->target = target.AsWeakPtr();
559 559
560 // Background can delete arrow (as well as the WeakPtr inside). 560 // Background can delete arrow (as well as the WeakPtr inside).
561 BackgroundThread background; 561 BackgroundThread background;
562 background.Start(); 562 background.Start();
563 background.DeleteArrow(arrow); 563 background.DeleteArrow(arrow);
564 } 564 }
565 565
566 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST 566 #if DCHECK_IS_ON() && GTEST_HAS_DEATH_TEST
567 567
568 TEST(WeakPtrDeathTest, WeakPtrCopyDoesNotChangeThreadBinding) { 568 TEST(WeakPtrDeathTest, WeakPtrCopyDoesNotChangeThreadBinding) {
569 // The default style "fast" does not support multi-threaded tests 569 // The default style "fast" does not support multi-threaded tests
570 // (introduces deadlock on Linux). 570 // (introduces deadlock on Linux).
571 ::testing::FLAGS_gtest_death_test_style = "threadsafe"; 571 ::testing::FLAGS_gtest_death_test_style = "threadsafe";
572 572
573 BackgroundThread background; 573 BackgroundThread background;
574 background.Start(); 574 background.Start();
575 575
576 // Main thread creates a Target object. 576 // Main thread creates a Target object.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 background.Start(); 672 background.Start();
673 background.DeleteTarget(target.release()); 673 background.DeleteTarget(target.release());
674 674
675 // Main thread attempts to dereference the target, violating thread binding. 675 // Main thread attempts to dereference the target, violating thread binding.
676 ASSERT_DEATH(arrow.target.get(), ""); 676 ASSERT_DEATH(arrow.target.get(), "");
677 } 677 }
678 678
679 #endif 679 #endif
680 680
681 } // namespace base 681 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698