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

Unified Diff: base/test/test_suite.cc

Issue 10834010: Revert 144488 - For unit tests, track additions to AtExitManager and warn. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/test_suite.h ('k') | base/test/test_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_suite.cc
===================================================================
--- base/test/test_suite.cc (revision 148403)
+++ base/test/test_suite.cc (working copy)
@@ -17,7 +17,6 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/test/multiprocess_test.h"
-#include "base/test/test_switches.h"
#include "base/test/test_timeouts.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -78,46 +77,6 @@
} // namespace
-namespace base {
-
-class TestWatchAtExitManager : public testing::EmptyTestEventListener {
- public:
- TestWatchAtExitManager() { }
- ~TestWatchAtExitManager() { }
-
- virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
- initial_top_manager_ = AtExitManager::current();
- at_exit_stack_size_ = initial_top_manager_->CallbackStackSize();
- }
-
- virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
- AtExitManager* new_top_manager = AtExitManager::current();
- size_t new_stack_size = new_top_manager->CallbackStackSize();
-
- if (initial_top_manager_ != new_top_manager) {
- ADD_FAILURE() << "The current AtExitManager has changed across the "
- "test " << test_info.test_case_name() << "." << test_info.name() <<
- " most likely because one was created without being destroyed.";
- } else if (new_stack_size != at_exit_stack_size_) {
- // TODO(scottbyer): clean up all the errors that result from this and
- // turn this into a test failure with
- // ADD_FAILURE(). http://crbug.com/133403
- LOG(WARNING) <<
- "AtExitManager: items were added to the callback list by " <<
- test_info.test_case_name() << "." << test_info.name() <<
- ". Global state should be cleaned up before a test exits.";
- }
- }
-
- private:
- AtExitManager* initial_top_manager_;
- size_t at_exit_stack_size_;
-
- DISALLOW_COPY_AND_ASSIGN(TestWatchAtExitManager);
-};
-
-} // namespace base
-
const char TestSuite::kStrictFailureHandling[] = "strict_failure_handling";
TestSuite::TestSuite(int argc, char** argv) : initialized_command_line_(false) {
@@ -219,12 +178,6 @@
listeners.Append(new TestClientInitializer);
}
-void TestSuite::WatchAtExitManager() {
- testing::TestEventListeners& listeners =
- testing::UnitTest::GetInstance()->listeners();
- listeners.Append(new TestWatchAtExitManager);
-}
-
// Don't add additional code to this method. Instead add it to
// Initialize(). See bug 6436.
int TestSuite::Run() {
@@ -349,15 +302,6 @@
CatchMaybeTests();
ResetCommandLine();
- // Don't watch for AtExit items being added if we're running as a child
- // process (e.g., browser_tests or interactive_ui_tests).
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSingleProcessTestsFlag) &&
- !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSingleProcessChromeFlag)) {
- WatchAtExitManager();
- }
-
TestTimeouts::Initialize();
}
« no previous file with comments | « base/test/test_suite.h ('k') | base/test/test_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698