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

Unified Diff: content/public/test/browser_test_base.cc

Issue 1232973002: Crash tests when BrowserTestBase::SetUp is not called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « content/public/test/browser_test_base.h ('k') | content/public/test/content_browser_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_base.cc
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
index c5078fc19b525c20c2d024dbd88b489c8003d30c..3455988be8118171d5b64d56e4430329ccce27c6 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -137,7 +137,8 @@ extern int BrowserMain(const MainFunctionParams&);
BrowserTestBase::BrowserTestBase()
: expected_exit_code_(0),
enable_pixel_output_(false),
- use_software_compositing_(false) {
+ use_software_compositing_(false),
+ set_up_called_(false) {
#if defined(OS_MACOSX)
base::mac::SetOverrideAmIBundled(true);
#endif
@@ -167,9 +168,16 @@ BrowserTestBase::~BrowserTestBase() {
base::ThreadRestrictions::ScopedAllowWait allow_wait;
test_server_.reset(NULL);
#endif
+
+ CHECK(set_up_called_) << "SetUp was not called. This probably means that the "
+ "developer has overridden the method and not called "
+ "the superclass version. In this case, the test "
+ "does not run and reports a false positive result.";
}
void BrowserTestBase::SetUp() {
+ set_up_called_ = true;
+
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
// Override the child process connection timeout since tests can exceed that
« no previous file with comments | « content/public/test/browser_test_base.h ('k') | content/public/test/content_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698