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

Side by Side Diff: base/test/unit_test.cc

Issue 10582012: For unit tests, track additions to AtExitManager and warn. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/test/unit_test.h"
6
7 #include "base/at_exit.h"
8 #include "base/logging.h"
9
10 namespace base {
11
12 UnitTest::UnitTest() {
13 }
14
15 UnitTest::~UnitTest() {
16 }
17
18 void UnitTest::SetUp() {
19 base::ShadowingAtExitManager at_exit_manager;
20 initial_top_manager_ = at_exit_manager.next_manager_;
21 at_exit_stack_size_ = initial_top_manager_->stack_.size();
22 }
23
24 void UnitTest::TearDown() {
25 base::ShadowingAtExitManager at_exit_manager;
26 base::AtExitManager* new_top_manager = at_exit_manager.next_manager_;
27 size_t new_stack_size = new_top_manager->stack_.size();
28
29 if (initial_top_manager_ != new_top_manager) {
30 LOG(WARNING) << "AtExitManager stack changed depth across test.";
31 } else if (new_stack_size != at_exit_stack_size_) {
32 LOG(WARNING) << "Test added items to the AtExitManager list.";
33 }
34 }
35
36 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698