aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/common
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2018-12-17 08:52:20 -0800
committerGravatar yang-g <yangg@google.com>2018-12-17 08:52:20 -0800
commit038a71d826f02d06397e1132f2ec1d071e90f08c (patch)
tree43afe8c684c43faae9fa0445009187ebbe643e93 /test/cpp/common
parentbd5d86935f6fdefd22e12eab5c64e7cb1ba7d7bc (diff)
parentb250f34b1225cde1bb19496c5cc5d66e40111052 (diff)
Merge remote-tracking branch 'upstream/master' into gpr_test_util_to_grpc_test_util
Diffstat (limited to 'test/cpp/common')
-rw-r--r--test/cpp/common/auth_property_iterator_test.cc17
-rw-r--r--test/cpp/common/secure_auth_context_test.cc14
2 files changed, 17 insertions, 14 deletions
diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc
index 9634555e4b..5a2844d518 100644
--- a/test/cpp/common/auth_property_iterator_test.cc
+++ b/test/cpp/common/auth_property_iterator_test.cc
@@ -40,15 +40,14 @@ class TestAuthPropertyIterator : public AuthPropertyIterator {
class AuthPropertyIteratorTest : public ::testing::Test {
protected:
void SetUp() override {
- ctx_ = grpc_auth_context_create(nullptr);
- grpc_auth_context_add_cstring_property(ctx_, "name", "chapi");
- grpc_auth_context_add_cstring_property(ctx_, "name", "chapo");
- grpc_auth_context_add_cstring_property(ctx_, "foo", "bar");
- EXPECT_EQ(1,
- grpc_auth_context_set_peer_identity_property_name(ctx_, "name"));
+ ctx_ = grpc_core::MakeRefCounted<grpc_auth_context>(nullptr);
+ grpc_auth_context_add_cstring_property(ctx_.get(), "name", "chapi");
+ grpc_auth_context_add_cstring_property(ctx_.get(), "name", "chapo");
+ grpc_auth_context_add_cstring_property(ctx_.get(), "foo", "bar");
+ EXPECT_EQ(1, grpc_auth_context_set_peer_identity_property_name(ctx_.get(),
+ "name"));
}
- void TearDown() override { grpc_auth_context_release(ctx_); }
- grpc_auth_context* ctx_;
+ grpc_core::RefCountedPtr<grpc_auth_context> ctx_;
};
TEST_F(AuthPropertyIteratorTest, DefaultCtor) {
@@ -59,7 +58,7 @@ TEST_F(AuthPropertyIteratorTest, DefaultCtor) {
TEST_F(AuthPropertyIteratorTest, GeneralTest) {
grpc_auth_property_iterator c_iter =
- grpc_auth_context_property_iterator(ctx_);
+ grpc_auth_context_property_iterator(ctx_.get());
const grpc_auth_property* property =
grpc_auth_property_iterator_next(&c_iter);
TestAuthPropertyIterator iter(property, &c_iter);
diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc
index 6461f49743..03b3a9fdd8 100644
--- a/test/cpp/common/secure_auth_context_test.cc
+++ b/test/cpp/common/secure_auth_context_test.cc
@@ -33,7 +33,7 @@ class SecureAuthContextTest : public ::testing::Test {};
// Created with nullptr
TEST_F(SecureAuthContextTest, EmptyContext) {
- SecureAuthContext context(nullptr, true);
+ SecureAuthContext context(nullptr);
EXPECT_TRUE(context.GetPeerIdentity().empty());
EXPECT_TRUE(context.GetPeerIdentityPropertyName().empty());
EXPECT_TRUE(context.FindPropertyValues("").empty());
@@ -42,8 +42,10 @@ TEST_F(SecureAuthContextTest, EmptyContext) {
}
TEST_F(SecureAuthContextTest, Properties) {
- grpc_auth_context* ctx = grpc_auth_context_create(nullptr);
- SecureAuthContext context(ctx, true);
+ grpc_core::RefCountedPtr<grpc_auth_context> ctx =
+ grpc_core::MakeRefCounted<grpc_auth_context>(nullptr);
+ SecureAuthContext context(ctx.get());
+ ctx.reset();
context.AddProperty("name", "chapi");
context.AddProperty("name", "chapo");
context.AddProperty("foo", "bar");
@@ -60,8 +62,10 @@ TEST_F(SecureAuthContextTest, Properties) {
}
TEST_F(SecureAuthContextTest, Iterators) {
- grpc_auth_context* ctx = grpc_auth_context_create(nullptr);
- SecureAuthContext context(ctx, true);
+ grpc_core::RefCountedPtr<grpc_auth_context> ctx =
+ grpc_core::MakeRefCounted<grpc_auth_context>(nullptr);
+ SecureAuthContext context(ctx.get());
+ ctx.reset();
context.AddProperty("name", "chapi");
context.AddProperty("name", "chapo");
context.AddProperty("foo", "bar");