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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc

Issue 4164011: Integrate ETW with VLOG logging. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « ceee/testing/utils/test_utils.cc ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Unit tests for the SafeBrowsing storage system. 5 // Unit tests for the SafeBrowsing storage system.
6 6
7 #include "app/sql/connection.h" 7 #include "app/sql/connection.h"
8 #include "app/sql/statement.h" 8 #include "app/sql/statement.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 ScopedLogMessageIgnorer() { 44 ScopedLogMessageIgnorer() {
45 logging::SetLogMessageHandler(&LogMessageIgnorer); 45 logging::SetLogMessageHandler(&LogMessageIgnorer);
46 } 46 }
47 ~ScopedLogMessageIgnorer() { 47 ~ScopedLogMessageIgnorer() {
48 // TODO(shess): Would be better to verify whether anyone else 48 // TODO(shess): Would be better to verify whether anyone else
49 // changed it, and then restore it to the previous value. 49 // changed it, and then restore it to the previous value.
50 logging::SetLogMessageHandler(NULL); 50 logging::SetLogMessageHandler(NULL);
51 } 51 }
52 52
53 private: 53 private:
54 static bool LogMessageIgnorer(int severity, const std::string& str) { 54 static bool LogMessageIgnorer(int severity, const char* file, int line,
55 size_t message_start, const std::string& str) {
55 // Intercept FATAL, strip the stack backtrace, and log it without 56 // Intercept FATAL, strip the stack backtrace, and log it without
56 // the crash part. 57 // the crash part.
57 if (severity == logging::LOG_FATAL) { 58 if (severity == logging::LOG_FATAL) {
58 size_t newline = str.find('\n'); 59 size_t newline = str.find('\n');
59 if (newline != std::string::npos) { 60 if (newline != std::string::npos) {
60 const std::string msg = str.substr(0, newline + 1); 61 const std::string msg = str.substr(0, newline + 1);
61 fprintf(stderr, "%s", msg.c_str()); 62 fprintf(stderr, "%s", msg.c_str());
62 fflush(stderr); 63 fflush(stderr);
63 } 64 }
64 return true; 65 return true;
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 EXPECT_FALSE(file_util::PathExists(database_filename_)); 1152 EXPECT_FALSE(file_util::PathExists(database_filename_));
1152 1153
1153 // Run the update again successfully. 1154 // Run the update again successfully.
1154 EXPECT_TRUE(database_->UpdateStarted(&lists)); 1155 EXPECT_TRUE(database_->UpdateStarted(&lists));
1155 database_->InsertChunks(safe_browsing_util::kMalwareList, chunks); 1156 database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
1156 database_->UpdateFinished(true); 1157 database_->UpdateFinished(true);
1157 EXPECT_TRUE(file_util::PathExists(database_filename_)); 1158 EXPECT_TRUE(file_util::PathExists(database_filename_));
1158 1159
1159 database_.reset(); 1160 database_.reset();
1160 } 1161 }
OLDNEW
« no previous file with comments | « ceee/testing/utils/test_utils.cc ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698