aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-10-11 16:05:53 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-10-11 16:05:53 -0700
commit81a6ef9d15f2cf426f6d8cadc6d3bb2a3060dee1 (patch)
tree41fe05faf2f547c5af866a080bc9c8c2816dd9a8 /test
parent2e62013f578e55ade82c5d93ac5598d307d97b21 (diff)
parentfbfb05acc8c97487d75404afe92661d1e6384dd7 (diff)
Merge github.com:grpc/grpc into direct-calls
Diffstat (limited to 'test')
-rw-r--r--test/core/security/credentials_test.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index 7043953154..2f8ffe4da6 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -46,6 +46,7 @@
#include "src/core/lib/http/httpcli.h"
#include "src/core/lib/security/credentials/composite/composite_credentials.h"
+#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "src/core/lib/security/credentials/google_default/google_default_credentials.h"
#include "src/core/lib/security/credentials/jwt/jwt_credentials.h"
#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"
@@ -411,7 +412,7 @@ static grpc_security_status check_channel_oauth2_create_security_connector(
static void test_channel_oauth2_composite_creds(void) {
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
- NULL, check_channel_oauth2_create_security_connector};
+ NULL, check_channel_oauth2_create_security_connector, NULL};
grpc_channel_credentials *channel_creds =
grpc_mock_channel_credentials_create(&vtable);
grpc_call_credentials *oauth2_creds =
@@ -495,7 +496,7 @@ check_channel_oauth2_google_iam_create_security_connector(
static void test_channel_oauth2_google_iam_composite_creds(void) {
grpc_channel_args *new_args;
grpc_channel_credentials_vtable vtable = {
- NULL, check_channel_oauth2_google_iam_create_security_connector};
+ NULL, check_channel_oauth2_google_iam_create_security_connector, NULL};
grpc_channel_credentials *channel_creds =
grpc_mock_channel_credentials_create(&vtable);
grpc_call_credentials *oauth2_creds =
@@ -1148,6 +1149,31 @@ static void test_get_well_known_google_credentials_file_path(void) {
#endif
}
+static void test_channel_creds_duplicate_without_call_creds(void) {
+ grpc_channel_credentials *channel_creds =
+ grpc_fake_transport_security_credentials_create();
+
+ grpc_channel_credentials *dup =
+ grpc_channel_credentials_duplicate_without_call_credentials(
+ channel_creds);
+ GPR_ASSERT(dup == channel_creds);
+ grpc_channel_credentials_unref(dup);
+
+ grpc_call_credentials *call_creds =
+ grpc_access_token_credentials_create("blah", NULL);
+ grpc_channel_credentials *composite_creds =
+ grpc_composite_channel_credentials_create(channel_creds, call_creds,
+ NULL);
+ grpc_call_credentials_unref(call_creds);
+ dup = grpc_channel_credentials_duplicate_without_call_credentials(
+ composite_creds);
+ GPR_ASSERT(dup == channel_creds);
+ grpc_channel_credentials_unref(dup);
+
+ grpc_channel_credentials_unref(channel_creds);
+ grpc_channel_credentials_unref(composite_creds);
+}
+
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
@@ -1182,6 +1208,7 @@ int main(int argc, char **argv) {
test_metadata_plugin_success();
test_metadata_plugin_failure();
test_get_well_known_google_credentials_file_path();
+ test_channel_creds_duplicate_without_call_creds();
grpc_shutdown();
return 0;
}