Commit a57ea917 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Add a cmdline switch to disable failure output from the Sync FakeServer

In case of test failure, Sync's FakeServer outputs a log of all
requests, which can be helpful in debugging. However in other cases,
the output can be annoying - lots of text to scroll over to get to the
actual failed expectation message.
So this CL adds a commandline switch
--disable-fake-server-failure-output to disable the verbose output, for
use in local testing/debugging.

Bug: none
Change-Id: Iaf07e79681eac1e961f0a530b6cac45548cf8742
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2104051
Auto-Submit: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750901}
parent 87cacf06
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <set> #include <set>
#include <utility> #include <utility>
#include "base/command_line.h"
#include "base/guid.h" #include "base/guid.h"
#include "base/hash/hash.h" #include "base/hash/hash.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
...@@ -607,6 +608,10 @@ base::WeakPtr<FakeServer> FakeServer::AsWeakPtr() { ...@@ -607,6 +608,10 @@ base::WeakPtr<FakeServer> FakeServer::AsWeakPtr() {
void FakeServer::LogForTestFailure(const base::Location& location, void FakeServer::LogForTestFailure(const base::Location& location,
const std::string& title, const std::string& title,
const std::string& body) { const std::string& body) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
"disable-fake-server-failure-output")) {
return;
}
gtest_scoped_traces_.push_back(std::make_unique<testing::ScopedTrace>( gtest_scoped_traces_.push_back(std::make_unique<testing::ScopedTrace>(
location.file_name(), location.line_number(), location.file_name(), location.line_number(),
base::StringPrintf("--- %s %d (reverse chronological order) ---\n%s", base::StringPrintf("--- %s %d (reverse chronological order) ---\n%s",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment