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

Side by Side Diff: net/base/fuzzer_test_support.cc

Issue 2649203002: Disable noisy logging for //net fuzz targets. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/i18n/icu_util.h" 6 #include "base/i18n/icu_util.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 10
11 namespace { 11 namespace {
12 12
13 // Set up globals that a number of network tests use. 13 // Set up globals that a number of network tests use.
14 // 14 //
15 // Note that in general static initializers are not allowed, however this is 15 // Note that in general static initializers are not allowed, however this is
16 // just being used by test code. 16 // just being used by test code.
17 struct InitGlobals { 17 struct InitGlobals {
18 InitGlobals() { 18 InitGlobals() {
19 // Set up ICU. ICU is used internally by GURL, which is used throughout the 19 // Set up ICU. ICU is used internally by GURL, which is used throughout the
20 // //net code. Initializing ICU is important to prevent fuzztests from 20 // //net code. Initializing ICU is important to prevent fuzztests from
21 // asserting when handling non-ASCII urls. 21 // asserting when handling non-ASCII urls.
22 CHECK(base::i18n::InitializeICU()); 22 CHECK(base::i18n::InitializeICU());
23 23
24 // Prevent every call to get a Histogram* from leaking memory. Instead, only 24 // Prevent every call to get a Histogram* from leaking memory. Instead, only
25 // the fist call to get each Histogram* leaks memory. 25 // the fist call to get each Histogram* leaks memory.
26 base::StatisticsRecorder::Initialize(); 26 base::StatisticsRecorder::Initialize();
27
28 // Disable noisy logging as per "libFuzzer in Chrome" documentation:
29 // testing/libfuzzer/getting_started.md#Disable-noisy-error-message-logging.
30 logging::SetMinLogLevel(logging::LOG_FATAL);
27 } 31 }
28 32
29 // A number of tests use async code which depends on there being a message 33 // A number of tests use async code which depends on there being a message
30 // loop. Setting one up here allows tests to reuse the message loop between 34 // loop. Setting one up here allows tests to reuse the message loop between
31 // runs. 35 // runs.
32 base::MessageLoopForIO message_loop; 36 base::MessageLoopForIO message_loop;
33 37
34 base::AtExitManager at_exit_manager; 38 base::AtExitManager at_exit_manager;
35 }; 39 };
36 40
37 InitGlobals* init_globals = new InitGlobals(); 41 InitGlobals* init_globals = new InitGlobals();
38 42
39 } // namespace 43 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698