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

Unified Diff: net/test/scoped_mock_log.cc

Issue 966423003: Moving ScopedMockLog from net/test to base/test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@separate-port-range
Patch Set: Addressed Ricardo's code review feedback. Created 5 years, 10 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 | « net/test/scoped_mock_log.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/scoped_mock_log.cc
diff --git a/net/test/scoped_mock_log.cc b/net/test/scoped_mock_log.cc
deleted file mode 100644
index 3bc99cb3d42b005e91af466f10224cd018c080d5..0000000000000000000000000000000000000000
--- a/net/test/scoped_mock_log.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 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 "net/test/scoped_mock_log.h"
-
-#include "base/logging.h"
-
-namespace net {
-namespace test {
-
-// static
-ScopedMockLog* ScopedMockLog::g_instance_ = NULL;
-
-ScopedMockLog::ScopedMockLog() : is_capturing_logs_(false) {}
-
-ScopedMockLog::~ScopedMockLog() {
- if (is_capturing_logs_) {
- StopCapturingLogs();
- }
-}
-
-void ScopedMockLog::StartCapturingLogs() {
- // We don't use CHECK(), which can generate a new LOG message, and
- // thus can confuse ScopedMockLog objects or other registered
- // LogSinks.
- RAW_CHECK(!is_capturing_logs_);
- RAW_CHECK(!g_instance_);
-
- is_capturing_logs_ = true;
- g_instance_ = this;
- previous_handler_ = logging::GetLogMessageHandler();
- logging::SetLogMessageHandler(LogMessageHandler);
-}
-
-void ScopedMockLog::StopCapturingLogs() {
- // We don't use CHECK(), which can generate a new LOG message, and
- // thus can confuse ScopedMockLog objects or other registered
- // LogSinks.
- RAW_CHECK(is_capturing_logs_);
- RAW_CHECK(g_instance_ == this);
-
- is_capturing_logs_ = false;
- logging::SetLogMessageHandler(previous_handler_);
- g_instance_ = NULL;
-}
-
-// static
-bool ScopedMockLog::LogMessageHandler(int severity,
- const char* file,
- int line,
- size_t message_start,
- const std::string& str) {
- return g_instance_->Log(severity, file, line, message_start, str);
-}
-
-} // namespace test
-} // namespace net
« no previous file with comments | « net/test/scoped_mock_log.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698