client_context_test_peer.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2021 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCPP_TEST_CLIENT_CONTEXT_TEST_PEER_H
20 #define GRPCPP_TEST_CLIENT_CONTEXT_TEST_PEER_H
21 
22 #include <map>
23 
24 #include <grpcpp/client_context.h>
25 
26 namespace grpc {
27 namespace testing {
28 
31  public:
33 
37  const std::string& value) {
39  std::pair<std::string, std::string>(key, value));
41  ctx_->recv_initial_metadata_.map()->clear();
42  for (const auto& item : server_initial_metadata_storage_) {
43  ctx_->recv_initial_metadata_.map()->insert(
44  std::pair<grpc::string_ref, grpc::string_ref>(
45  item.first.c_str(),
46  grpc::string_ref(item.second.data(), item.second.size())));
47  }
48  }
49 
50  std::multimap<std::string, std::string> GetSendInitialMetadata() const {
52  }
53 
54  private:
55  ClientContext* const ctx_; // not owned
56  std::multimap<std::string, std::string> server_initial_metadata_storage_;
57 };
58 
59 } // namespace testing
60 } // namespace grpc
61 
62 #endif // GRPCPP_TEST_CLIENT_CONTEXT_TEST_PEER_H
grpc::ClientContext::send_initial_metadata_
std::multimap< std::string, std::string > send_initial_metadata_
Definition: grpcpp/impl/codegen/client_context.h:502
grpc::testing::ClientContextTestPeer::server_initial_metadata_storage_
std::multimap< std::string, std::string > server_initial_metadata_storage_
Definition: client_context_test_peer.h:56
grpc::string_ref
Definition: grpcpp/impl/codegen/string_ref.h:43
testing
Definition: aws_request_signer_test.cc:25
ctx
Definition: benchmark-async.c:30
grpc
Definition: grpcpp/alarm.h:33
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc::testing::ClientContextTestPeer::GetSendInitialMetadata
std::multimap< std::string, std::string > GetSendInitialMetadata() const
Definition: client_context_test_peer.h:50
grpc::testing::ClientContextTestPeer::AddServerInitialMetadata
void AddServerInitialMetadata(const std::string &key, const std::string &value)
Definition: client_context_test_peer.h:36
grpc::ClientContext::recv_initial_metadata_
grpc::internal::MetadataMap recv_initial_metadata_
Definition: grpcpp/impl/codegen/client_context.h:503
grpc::ClientContext::initial_metadata_received_
bool initial_metadata_received_
Definition: grpcpp/impl/codegen/client_context.h:490
grpc::testing::ClientContextTestPeer
A test-only class to access private members and methods of ClientContext.
Definition: client_context_test_peer.h:30
grpc::testing::ClientContextTestPeer::ClientContextTestPeer
ClientContextTestPeer(ClientContext *const ctx)
Definition: client_context_test_peer.h:32
grpc::ClientContext
Definition: grpcpp/impl/codegen/client_context.h:195
value
const char * value
Definition: hpack_parser_table.cc:165
client_context.h
key
const char * key
Definition: hpack_parser_table.cc:164
grpc::testing::ClientContextTestPeer::ctx_
ClientContext *const ctx_
Definition: client_context_test_peer.h:55
grpc::internal::MetadataMap::map
std::multimap< grpc::string_ref, grpc::string_ref > * map()
Definition: grpcpp/impl/codegen/metadata_map.h:68


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:47