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

Side by Side Diff: base/test/logging_utils.cc

Issue 2638763004: Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Add comment. Fix missed usage of SetLogAssertHandler. Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
Paweł Hajdan Jr. 2017/01/27 17:19:44 nit: 2017, no (c).
alex-ac 2017/02/11 20:12:19 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/test/logging_utils.h"
6
7 #include <utility>
8
9 namespace logging {
10
11 namespace {
12
13 // std::swap doesn't works with base::Callback.
14 void SwapHandlers(LogAssertHandlerFunction* a, LogAssertHandlerFunction* b) {
15 LogAssertHandlerFunction temp = *a;
16 *a = *b;
17 *b = temp;
18 }
19
20 } // namespace
21
22 ScopedLogAssertHandler::ScopedLogAssertHandler() {}
23
24 ScopedLogAssertHandler::ScopedLogAssertHandler(LogAssertHandlerFunction handler)
25 : handler_(handler) {
26 if (handler_)
27 SetLogAssertHandler(handler);
28 }
29
30 ScopedLogAssertHandler::~ScopedLogAssertHandler() {
31 if (handler_)
32 ResetLogAssertHandler();
33 }
34
35 ScopedLogAssertHandler::ScopedLogAssertHandler(ScopedLogAssertHandler&& other) {
36 SwapHandlers(&handler_, &other.handler_);
37 }
38
39 ScopedLogAssertHandler& ScopedLogAssertHandler::operator=(
40 ScopedLogAssertHandler&& other) {
41 ScopedLogAssertHandler temp_copy(std::move(other));
42 SwapHandlers(&handler_, &temp_copy.handler_);
43 return *this;
44 }
45
46 } // namespace logging
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698