aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-02-09 16:55:51 -0800
committerGravatar Muxi Yan <mxyan@google.com>2017-02-09 16:55:51 -0800
commit14c76cf2c9fe416530b248c0d817295ce6069ffd (patch)
tree48e368b5b6b4a5ca2a26dfb46026870755ecacf9 /src/objective-c
parent5bd16b70133ba3901ed39eb867c34522fdf5778f (diff)
Warning and control the rest of interfaces in GRPCCall+Tests as well
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.h9
-rw-r--r--src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.m18
2 files changed, 27 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.h b/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.h
index 0325f5a192..92c718a749 100644
--- a/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.h
+++ b/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.h
@@ -45,6 +45,9 @@
*
* Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
* more than one invocation of the methods of this category.
+ *
+ * This function is for internal testing of gRPC only. It is not part of gRPC's public interface.
+ * Do not use in production. To enable, set the preprocessor flag GRPC_TEST_OBJC.
*/
+ (void)useTestCertsPath:(NSString *)certsPath
testName:(NSString *)testName
@@ -55,12 +58,18 @@
*
* Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
* more than one invocation of the methods of this category.
+ *
+ * This function is for internal testing of gRPC only. It is not part of gRPC's public interface.
+ * Do not use in production. To enable, set the preprocessor flag GRPC_TEST_OBJC.
*/
+ (void)useInsecureConnectionsForHost:(NSString *)host;
/**
* Resets all host configurations to their default values, and flushes all connections from the
* cache.
+ *
+ * This function is for internal testing of gRPC only. It is not part of gRPC's public interface.
+ * Do not use in production. To enable, set the preprocessor flag GRPC_TEST_OBJC.
*/
+ (void)resetHostSettings;
diff --git a/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.m b/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.m
index 5109480bef..40bd2a9c80 100644
--- a/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.m
+++ b/src/objective-c/GRPCClient/internal_testing/GRPCCall+Tests.m
@@ -41,6 +41,7 @@
+ (void)useTestCertsPath:(NSString *)certsPath
testName:(NSString *)testName
forHost:(NSString *)host {
+#ifdef GRPC_TEST_OBJC
if (!host || !certsPath || !testName) {
[NSException raise:NSInvalidArgumentException format:@"host, path and name must be provided."];
}
@@ -55,15 +56,32 @@
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
[hostConfig setTLSPEMRootCerts:certs withPrivateKey:nil withCertChain:nil error:nil];
hostConfig.hostNameOverride = testName;
+#else
+ NSLog(@"This function is for internal testing of gRPC only. "
+ "It is not part of gRPC's public interface. Do not use in production. "
+ "To enable, set the preprocessor flag GRPC_TEST_OBJC.");
+#endif
}
+ (void)useInsecureConnectionsForHost:(NSString *)host {
+#ifdef GRPC_TEST_OBJC
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
hostConfig.secure = NO;
+#else
+ NSLog(@"This function is for internal testing of gRPC only. "
+ "It is not part of gRPC's public interface. Do not use in production. "
+ "To enable, set the preprocessor flag GRPC_TEST_OBJC.");
+#endif
}
+ (void)resetHostSettings {
+#ifdef GRPC_TEST_OBJC
[GRPCHost resetAllHostSettings];
+#else
+ NSLog(@"This function is for internal testing of gRPC only. "
+ "It is not part of gRPC's public interface. Do not use in production. "
+ "To enable, set the preprocessor flag GRPC_TEST_OBJC.");
+#endif
}
+ (void)enableOpBatchLog:(BOOL)enabled {