Hid test-only functions from surface/call.h

pull/3692/head
David Garcia Quintas 9 years ago
parent 64824bebea
commit 0c331880d0
  1. 3
      BUILD
  2. 1
      build.yaml
  3. 2
      gRPC.podspec
  4. 12
      src/core/surface/call.c
  5. 10
      src/core/surface/call.h
  6. 65
      src/core/surface/call_test_only.h
  7. 11
      test/core/end2end/tests/compressed_payload.c
  8. 6
      test/cpp/interop/client_helper.h
  9. 6
      test/cpp/interop/server_helper.cc
  10. 1
      tools/doxygen/Doxyfile.core.internal
  11. 4
      tools/run_tests/sources_and_headers.json
  12. 1
      vsprojects/vcxproj/grpc/grpc.vcxproj
  13. 3
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  14. 1
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  15. 3
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters

@ -223,6 +223,7 @@ cc_library(
"src/core/surface/api_trace.h",
"src/core/surface/byte_buffer_queue.h",
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
@ -509,6 +510,7 @@ cc_library(
"src/core/surface/api_trace.h",
"src/core/surface/byte_buffer_queue.h",
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
@ -1296,6 +1298,7 @@ objc_library(
"src/core/surface/api_trace.h",
"src/core/surface/byte_buffer_queue.h",
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",

@ -183,6 +183,7 @@ filegroups:
- src/core/surface/api_trace.h
- src/core/surface/byte_buffer_queue.h
- src/core/surface/call.h
- src/core/surface/call_test_only.h
- src/core/surface/channel.h
- src/core/surface/completion_queue.h
- src/core/surface/event_string.h

@ -227,6 +227,7 @@ Pod::Spec.new do |s|
'src/core/surface/api_trace.h',
'src/core/surface/byte_buffer_queue.h',
'src/core/surface/call.h',
'src/core/surface/call_test_only.h',
'src/core/surface/channel.h',
'src/core/surface/completion_queue.h',
'src/core/surface/event_string.h',
@ -518,6 +519,7 @@ Pod::Spec.new do |s|
'src/core/surface/api_trace.h',
'src/core/surface/byte_buffer_queue.h',
'src/core/surface/call.h',
'src/core/surface/call_test_only.h',
'src/core/surface/channel.h',
'src/core/surface/completion_queue.h',
'src/core/surface/event_string.h',

@ -521,7 +521,7 @@ static void set_compression_algorithm(grpc_call *call,
call->compression_algorithm = algo;
}
grpc_compression_algorithm grpc_call_get_compression_algorithm(
grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm(
grpc_call *call) {
grpc_compression_algorithm algorithm;
gpr_mu_lock(&call->mu);
@ -561,11 +561,15 @@ static void set_encodings_accepted_by_peer(
}
}
gpr_uint32 grpc_call_get_encodings_accepted_by_peer(grpc_call *call) {
return call->encodings_accepted_by_peer;
gpr_uint32 grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call) {
gpr_uint32 encodings_accepted_by_peer;
gpr_mu_lock(&call->mu);
encodings_accepted_by_peer = call->encodings_accepted_by_peer;
gpr_mu_unlock(&call->mu);
return encodings_accepted_by_peer;
}
gpr_uint32 grpc_call_get_message_flags(grpc_call *call) {
gpr_uint32 grpc_call_test_only_get_message_flags(grpc_call *call) {
gpr_uint32 flags;
gpr_mu_lock(&call->mu);
flags = call->incoming_message_flags;

@ -169,16 +169,6 @@ void *grpc_call_context_get(grpc_call *call, grpc_context_index elem);
gpr_uint8 grpc_call_is_client(grpc_call *call);
grpc_compression_algorithm grpc_call_get_compression_algorithm(grpc_call *call);
gpr_uint32 grpc_call_get_message_flags(grpc_call *call);
/** Returns a bitset for the encodings (compression algorithms) supported by \a
* call's peer.
*
* To be indexed by grpc_compression_algorithm enum values. */
gpr_uint32 grpc_call_get_encodings_accepted_by_peer(grpc_call *call);
#ifdef __cplusplus
}
#endif

@ -0,0 +1,65 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_INTERNAL_CORE_SURFACE_CALL_TEST_ONLY_H
#define GRPC_INTERNAL_CORE_SURFACE_CALL_TEST_ONLY_H
#include <grpc/grpc.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Return the compression algorithm from \a call.
*
* \warning This function should \b only be used in test code. */
grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm(
grpc_call *call);
/** Return the message flags from \a call.
*
* \warning This function should \b only be used in test code. */
gpr_uint32 grpc_call_test_only_get_message_flags(grpc_call *call);
/** Returns a bitset for the encodings (compression algorithms) supported by \a
* call's peer.
*
* To be indexed by grpc_compression_algorithm enum values. */
gpr_uint32 grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call);
#ifdef __cplusplus
}
#endif
#endif /* GRPC_INTERNAL_CORE_SURFACE_CALL_TEST_ONLY_H */

@ -46,7 +46,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "src/core/channel/channel_args.h"
#include "src/core/channel/compress_filter.h"
#include "src/core/surface/call.h"
#include "src/core/surface/call_test_only.h"
enum { TIMEOUT = 200000 };
@ -196,12 +196,13 @@ static void request_with_payload_template(
cq_expect_completion(cqv, tag(101), 1);
cq_verify(cqv);
GPR_ASSERT(GPR_BITCOUNT(grpc_call_get_encodings_accepted_by_peer(s)) == 3);
GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s),
GPR_ASSERT(
GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer(s)) == 3);
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_NONE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s),
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_DEFLATE) != 0);
GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s),
GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s),
GRPC_COMPRESS_GZIP) != 0);
op = ops;

@ -38,7 +38,7 @@
#include <grpc++/channel.h>
#include "src/core/surface/call.h"
#include "src/core/surface/call_test_only.h"
namespace grpc {
namespace testing {
@ -57,11 +57,11 @@ class InteropClientContextInspector {
// Inspector methods, able to peek inside ClientContext, follow.
grpc_compression_algorithm GetCallCompressionAlgorithm() const {
return grpc_call_get_compression_algorithm(context_.call_);
return grpc_call_test_only_get_compression_algorithm(context_.call_);
}
gpr_uint32 GetMessageFlags() const {
return grpc_call_get_message_flags(context_.call_);
return grpc_call_test_only_get_message_flags(context_.call_);
}
private:

@ -38,7 +38,7 @@
#include <gflags/gflags.h>
#include <grpc++/security/server_credentials.h>
#include "src/core/surface/call.h"
#include "src/core/surface/call_test_only.h"
#include "test/core/end2end/data/ssl_test_data.h"
DECLARE_bool(use_tls);
@ -65,11 +65,11 @@ InteropServerContextInspector::InteropServerContextInspector(
grpc_compression_algorithm
InteropServerContextInspector::GetCallCompressionAlgorithm() const {
return grpc_call_get_compression_algorithm(context_.call_);
return grpc_call_test_only_get_compression_algorithm(context_.call_);
}
gpr_uint32 InteropServerContextInspector::GetEncodingsAcceptedByClient() const {
return grpc_call_get_encodings_accepted_by_peer(context_.call_);
return grpc_call_test_only_get_encodings_accepted_by_peer(context_.call_);
}
std::shared_ptr<const AuthContext>

@ -858,6 +858,7 @@ src/core/statistics/census_rpc_stats.h \
src/core/surface/api_trace.h \
src/core/surface/byte_buffer_queue.h \
src/core/surface/call.h \
src/core/surface/call_test_only.h \
src/core/surface/channel.h \
src/core/surface/completion_queue.h \
src/core/surface/event_string.h \

@ -12365,6 +12365,7 @@
"src/core/surface/api_trace.h",
"src/core/surface/byte_buffer_queue.h",
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
@ -12607,6 +12608,7 @@
"src/core/surface/call.h",
"src/core/surface/call_details.c",
"src/core/surface/call_log_batch.c",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.c",
"src/core/surface/channel.h",
"src/core/surface/channel_connectivity.c",
@ -12861,6 +12863,7 @@
"src/core/surface/api_trace.h",
"src/core/surface/byte_buffer_queue.h",
"src/core/surface/call.h",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
@ -13073,6 +13076,7 @@
"src/core/surface/call.h",
"src/core/surface/call_details.c",
"src/core/surface/call_log_batch.c",
"src/core/surface/call_test_only.h",
"src/core/surface/channel.c",
"src/core/surface/channel.h",
"src/core/surface/channel_connectivity.c",

@ -344,6 +344,7 @@
<ClInclude Include="..\..\..\src\core\surface\api_trace.h" />
<ClInclude Include="..\..\..\src\core\surface\byte_buffer_queue.h" />
<ClInclude Include="..\..\..\src\core\surface\call.h" />
<ClInclude Include="..\..\..\src\core\surface\call_test_only.h" />
<ClInclude Include="..\..\..\src\core\surface\channel.h" />
<ClInclude Include="..\..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\..\src\core\surface\event_string.h" />

@ -743,6 +743,9 @@
<ClInclude Include="..\..\..\src\core\surface\call.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\surface\call_test_only.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\surface\channel.h">
<Filter>src\core\surface</Filter>
</ClInclude>

@ -323,6 +323,7 @@
<ClInclude Include="..\..\..\src\core\surface\api_trace.h" />
<ClInclude Include="..\..\..\src\core\surface\byte_buffer_queue.h" />
<ClInclude Include="..\..\..\src\core\surface\call.h" />
<ClInclude Include="..\..\..\src\core\surface\call_test_only.h" />
<ClInclude Include="..\..\..\src\core\surface\channel.h" />
<ClInclude Include="..\..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\..\src\core\surface\event_string.h" />

@ -641,6 +641,9 @@
<ClInclude Include="..\..\..\src\core\surface\call.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\surface\call_test_only.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\core\surface\channel.h">
<Filter>src\core\surface</Filter>
</ClInclude>

Loading…
Cancel
Save