Removes network ostream operators.

The ostream operators does not work consistently with gtest since the
definitions would have to be included before the first include of gtest.
This is tricky to ensure and the end result is that the operators will
sometimes work and sometimes not without obvious explanations.
To avoid causing confusing behavior, this CL removes the operators
pending a better solution.

Bug: None
Change-Id: I66bead0efb7246d368359ddf9e9bfad9d67c05da
Reviewed-on: https://webrtc-review.googlesource.com/68640
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22808}
This commit is contained in:
Sebastian Jansson 2018-04-09 14:41:57 +02:00 committed by Commit Bot
parent a73f8161aa
commit 342695d068
6 changed files with 22 additions and 121 deletions

View File

@ -11,7 +11,7 @@
#include "modules/congestion_controller/bbr/windowed_filter.h"
#include "modules/congestion_controller/bbr/rtt_stats.h"
#include "modules/congestion_controller/network_control/test/network_ostream_operators.h"
#include "modules/congestion_controller/network_control/include/network_units_to_string.h"
#include "test/gtest.h"
namespace webrtc {
@ -33,11 +33,11 @@ class WindowedFilterTest : public ::testing::Test {
TimeDelta rtt_sample = TimeDelta::ms(10);
for (int i = 0; i < 5; ++i) {
windowed_min_rtt_.Update(rtt_sample, now_ms);
RTC_LOG(LS_VERBOSE) << "i: " << i << " sample: " << rtt_sample
RTC_LOG(LS_VERBOSE) << "i: " << i << " sample: " << ToString(rtt_sample)
<< " mins: "
<< " " << windowed_min_rtt_.GetBest() << " "
<< windowed_min_rtt_.GetSecondBest() << " "
<< windowed_min_rtt_.GetThirdBest();
<< " " << ToString(windowed_min_rtt_.GetBest()) << " "
<< ToString(windowed_min_rtt_.GetSecondBest()) << " "
<< ToString(windowed_min_rtt_.GetThirdBest());
now_ms += 25;
rtt_sample = rtt_sample + TimeDelta::ms(10);
}
@ -55,10 +55,11 @@ class WindowedFilterTest : public ::testing::Test {
DataRate bw_sample = DataRate::bps(1000);
for (int i = 0; i < 5; ++i) {
windowed_max_bw_.Update(bw_sample, now_ms);
RTC_LOG(LS_VERBOSE) << "i: " << i << " sample: " << bw_sample << " maxs: "
<< " " << windowed_max_bw_.GetBest() << " "
<< windowed_max_bw_.GetSecondBest() << " "
<< windowed_max_bw_.GetThirdBest();
RTC_LOG(LS_VERBOSE) << "i: " << i << " sample: " << ToString(bw_sample)
<< " maxs: "
<< " " << ToString(windowed_max_bw_.GetBest()) << " "
<< ToString(windowed_max_bw_.GetSecondBest()) << " "
<< ToString(windowed_max_bw_.GetThirdBest());
now_ms += 25;
bw_sample = DataRate::bps(bw_sample.bps() - 100);
}

View File

@ -11,7 +11,6 @@
#include "modules/congestion_controller/goog_cc/probe_controller.h"
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "modules/congestion_controller/network_control/test/network_ostream_operators.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/clock.h"
#include "test/gmock.h"

View File

@ -34,8 +34,6 @@ if (rtc_include_tests) {
"test/mock_network_control.h",
"test/network_control_tester.cc",
"test/network_control_tester.h",
"test/network_ostream_operators.cc",
"test/network_ostream_operators.h",
]
deps = [
":network_control",

View File

@ -9,7 +9,7 @@
*/
#include "modules/congestion_controller/network_control/test/network_control_tester.h"
#include "modules/congestion_controller/network_control/test/network_ostream_operators.h"
#include "modules/congestion_controller/network_control/include/network_units_to_string.h"
#include <algorithm>
@ -21,23 +21,27 @@ namespace {
void Update(NetworkControlUpdate* target, const NetworkControlUpdate& update) {
if (update.congestion_window) {
RTC_LOG(LS_INFO) << "Received window="
<< update.congestion_window->data_window << "\n";
<< ToString(update.congestion_window->data_window) << "\n";
target->congestion_window = update.congestion_window;
}
if (update.pacer_config) {
RTC_LOG(LS_INFO) << "Received pacing at:" << update.pacer_config->at_time
<< ": rate=" << update.pacer_config->data_rate() << "\n";
RTC_LOG(LS_INFO) << "Received pacing at:"
<< ToString(update.pacer_config->at_time)
<< ": rate=" << ToString(update.pacer_config->data_rate())
<< "\n";
target->pacer_config = update.pacer_config;
}
if (update.target_rate) {
RTC_LOG(LS_INFO) << "Received target at:" << update.target_rate->at_time
<< ": rate=" << update.target_rate->target_rate << "\n";
RTC_LOG(LS_INFO) << "Received target at:"
<< ToString(update.target_rate->at_time)
<< ": rate=" << ToString(update.target_rate->target_rate)
<< "\n";
target->target_rate = update.target_rate;
}
for (const auto& probe : update.probe_cluster_configs) {
target->probe_cluster_configs.push_back(probe);
RTC_LOG(LS_INFO) << "Received probe at:" << probe.at_time
<< ": target=" << probe.target_data_rate << "\n";
RTC_LOG(LS_INFO) << "Received probe at:" << ToString(probe.at_time)
<< ": target=" << ToString(probe.target_data_rate) << "\n";
}
}
} // namespace

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/congestion_controller/network_control/test/network_ostream_operators.h"
#include "modules/congestion_controller/network_control/include/network_units_to_string.h"
namespace webrtc {
std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const DataRate& value) {
return os << ToString(value);
}
std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const DataSize& value) {
return os << ToString(value);
}
std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const Timestamp& value) {
return os << ToString(value);
}
std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const TimeDelta& value) {
return os << ToString(value);
}
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const CongestionWindow& window) {
return os << "CongestionWindow(...)";
}
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const ProbeClusterConfig& config) {
return os << "ProbeClusterConfig(...)";
}
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const PacerConfig& config) {
return os << "PacerConfig(...)";
}
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const TargetTransferRate& target_rate) {
return os << "TargetTransferRate(...)";
}
} // namespace webrtc

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_NETWORK_OSTREAM_OPERATORS_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_NETWORK_OSTREAM_OPERATORS_H_
// Overloading ostream << operator is required for gtest printing.
#include <ostream> // no-presubmit-check TODO(webrtc:8982)
#include "modules/congestion_controller/network_control/include/network_types.h"
namespace webrtc {
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const DataRate& datarate);
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const DataSize& datasize);
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const Timestamp& timestamp);
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const TimeDelta& delta);
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const CongestionWindow& window);
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const ProbeClusterConfig& config);
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const PacerConfig& config);
::std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
::std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
const TargetTransferRate& target_rate);
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_NETWORK_OSTREAM_OPERATORS_H_