aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-11-16 09:02:58 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2017-11-16 09:02:58 -0800
commitb2aa06ae990e82b5c7f573f282b7bcfef7093d54 (patch)
tree3823d5a2c06eb094ac2b9f3fc57fd704ff0937bf /test
parent9006013267a00f214390e8a0cfc6311d8e999f17 (diff)
Reviewer feedback: friend func not clasS
Diffstat (limited to 'test')
-rw-r--r--test/core/iomgr/timer_list_test.cc8
-rw-r--r--test/core/transport/connectivity_state_test.cc3
-rw-r--r--test/core/util/tracer_peer.cc20
-rw-r--r--test/core/util/tracer_peer.h5
4 files changed, 15 insertions, 21 deletions
diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc
index 6aec1ec13d..73be93511b 100644
--- a/test/core/iomgr/timer_list_test.cc
+++ b/test/core/iomgr/timer_list_test.cc
@@ -49,8 +49,8 @@ static void add_test(void) {
gpr_log(GPR_INFO, "add_test");
grpc_timer_list_init(&exec_ctx);
- grpc_tracer_peer_enable_flag(&grpc_timer_trace);
- grpc_tracer_peer_enable_flag(&grpc_timer_check_trace);
+ grpc_core::testing::grpc_tracer_peer_enable_flag(&grpc_timer_trace);
+ grpc_core::testing::grpc_tracer_peer_enable_flag(&grpc_timer_check_trace);
memset(cb_called, 0, sizeof(cb_called));
grpc_millis start = grpc_exec_ctx_now(&exec_ctx);
@@ -118,8 +118,8 @@ void destruction_test(void) {
exec_ctx.now_is_valid = true;
exec_ctx.now = 0;
grpc_timer_list_init(&exec_ctx);
- grpc_tracer_peer_enable_flag(&grpc_timer_trace);
- grpc_tracer_peer_enable_flag(&grpc_timer_check_trace);
+ grpc_core::testing::grpc_tracer_peer_enable_flag(&grpc_timer_trace);
+ grpc_core::testing::grpc_tracer_peer_enable_flag(&grpc_timer_check_trace);
memset(cb_called, 0, sizeof(cb_called));
grpc_timer_init(
diff --git a/test/core/transport/connectivity_state_test.cc b/test/core/transport/connectivity_state_test.cc
index 1eab6d7ea2..e4d27950ec 100644
--- a/test/core/transport/connectivity_state_test.cc
+++ b/test/core/transport/connectivity_state_test.cc
@@ -137,7 +137,8 @@ static void test_subscribe_with_failure_then_destroy(void) {
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
- grpc_tracer_peer_enable_flag(&grpc_connectivity_state_trace);
+ grpc_core::testing::grpc_tracer_peer_enable_flag(
+ &grpc_connectivity_state_trace);
test_connectivity_state_name();
test_check();
test_subscribe_then_unsubscribe();
diff --git a/test/core/util/tracer_peer.cc b/test/core/util/tracer_peer.cc
index 6c18430f89..acb770515f 100644
--- a/test/core/util/tracer_peer.cc
+++ b/test/core/util/tracer_peer.cc
@@ -21,21 +21,11 @@
#include "src/core/lib/debug/trace.h"
namespace grpc_core {
-
-// This class is a friend of TraceFlag, and can be used to manually turn on
-// certain tracers for tests.
-class TraceFlagPeer {
- public:
- TraceFlagPeer(TraceFlag* flag) : flag_(flag) {}
- void enable() { flag_->set_enabled(1); }
- void disable() { flag_->set_enabled(0); }
-
- private:
- TraceFlag* flag_;
-};
-} // namespace grpc_core
+namespace testing {
void grpc_tracer_peer_enable_flag(grpc_core::TraceFlag* flag) {
- grpc_core::TraceFlagPeer peer(flag);
- peer.enable();
+ flag->set_enabled(1);
}
+
+} // namespace testing
+} // namespace grpc_core
diff --git a/test/core/util/tracer_peer.h b/test/core/util/tracer_peer.h
index e8a5f6c31a..0b6c6dd685 100644
--- a/test/core/util/tracer_peer.h
+++ b/test/core/util/tracer_peer.h
@@ -21,9 +21,12 @@
namespace grpc_core {
class TraceFlag;
-}
+namespace testing {
// enables the TraceFlag passed to it. Used for testing purposes.
void grpc_tracer_peer_enable_flag(grpc_core::TraceFlag* flag);
+} // namespace testing
+} // namespace grpc_core
+
#endif /* GRPC_TEST_CORE_UTIL_TRACER_PEER_H */