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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 11 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
Index: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index 31168452cfb31436e51ab2a77745223911145e36..5b7c4c610ca7e077ad4670aa36eef310100fd5df 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -210,39 +210,6 @@ std::unique_ptr<SBChunkData> AddChunkHashedIpValue(int chunk_number,
&full_hash, sizeof(full_hash), std::vector<int>());
}
-// Prevent DCHECK from killing tests.
-// TODO(shess): Pawel disputes the use of this, so the test which uses
-// it is DISABLED. http://crbug.com/56448
-class ScopedLogMessageIgnorer {
- public:
- ScopedLogMessageIgnorer() {
- logging::SetLogMessageHandler(&LogMessageIgnorer);
- }
- ~ScopedLogMessageIgnorer() {
- // TODO(shess): Would be better to verify whether anyone else
- // changed it, and then restore it to the previous value.
- logging::SetLogMessageHandler(NULL);
- }
-
- private:
- static bool LogMessageIgnorer(int severity, const char* file, int line,
- size_t message_start, const std::string& str) {
- // Intercept FATAL, strip the stack backtrace, and log it without
- // the crash part.
- if (severity == logging::LOG_FATAL) {
- size_t newline = str.find('\n');
- if (newline != std::string::npos) {
- const std::string msg = str.substr(0, newline + 1);
- fprintf(stderr, "%s", msg.c_str());
- fflush(stderr);
- }
- return true;
- }
-
- return false;
- }
-};
-
} // namespace
class SafeBrowsingDatabaseTest : public PlatformTest {
@@ -1172,7 +1139,7 @@ TEST_F(SafeBrowsingDatabaseTest, HashCaching) {
// Test that corrupt databases are appropriately handled, even if the
// corruption is detected in the midst of the update.
-// TODO(shess): Disabled until ScopedLogMessageIgnorer resolved.
+// TODO(shess): Disabled until DCHECK killing is resolved.
// http://crbug.com/56448
TEST_F(SafeBrowsingDatabaseTest, DISABLED_FileCorruptionHandling) {
// Re-create the database in a captive message loop so that we can
@@ -1207,8 +1174,10 @@ TEST_F(SafeBrowsingDatabaseTest, DISABLED_FileCorruptionHandling) {
fclose(fp);
{
- // The following code will cause DCHECKs, so suppress the crashes.
- ScopedLogMessageIgnorer ignorer;
+ // The following code will cause DCHECKs.
+ // There's no way to prevent DCHECK from killing tests.
+ // TODO(shess): Pawel disputes the use of using (removed) LogMessageHandler
+ // to hijack the message, so this test is DISABLED. http://crbug.com/56448
// Start an update. The insert will fail due to corruption.
ASSERT_TRUE(database_->UpdateStarted(&lists));
« no previous file with comments | « chrome/browser/media/webrtc/webrtc_browsertest_base.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698