Index: base/test/unit_test.cc |
diff --git a/base/test/unit_test.cc b/base/test/unit_test.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0447432ce2b6a5db8b1825bf7865e6a70ef16612 |
--- /dev/null |
+++ b/base/test/unit_test.cc |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/test/unit_test.h" |
+ |
+#include "base/at_exit.h" |
+#include "base/logging.h" |
+ |
+namespace base { |
+ |
+UnitTest::UnitTest() { |
+} |
+ |
+UnitTest::~UnitTest() { |
+} |
+ |
+void UnitTest::SetUp() { |
+ base::ShadowingAtExitManager at_exit_manager; |
+ initial_top_manager_ = at_exit_manager.next_manager_; |
+ at_exit_stack_size_ = initial_top_manager_->stack_.size(); |
+} |
+ |
+void UnitTest::TearDown() { |
+ base::ShadowingAtExitManager at_exit_manager; |
+ base::AtExitManager* new_top_manager = at_exit_manager.next_manager_; |
+ size_t new_stack_size = new_top_manager->stack_.size(); |
+ |
+ if (initial_top_manager_ != new_top_manager) { |
+ LOG(WARNING) << "AtExitManager stack changed depth across test."; |
+ } else if (new_stack_size != at_exit_stack_size_) { |
+ LOG(WARNING) << "Test added items to the AtExitManager list."; |
+ } |
+} |
+ |
+} // namespace base |