Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 3 | * Copyright 2016 gRPC authors. |
Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 4 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 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 |
Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 8 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 10 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame^] | 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. |
Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 16 | * |
| 17 | */ |
| 18 | |
| 19 | #ifndef GRPC_TEST_CPP_INTEROP_HTTP2_CLIENT_H |
| 20 | #define GRPC_TEST_CPP_INTEROP_HTTP2_CLIENT_H |
| 21 | |
| 22 | #include <memory> |
| 23 | |
| 24 | #include <grpc++/channel.h> |
| 25 | #include <grpc/grpc.h> |
yang-g | d0084c2 | 2017-03-06 11:23:35 -0800 | [diff] [blame] | 26 | #include "src/proto/grpc/testing/messages.pb.h" |
Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 27 | #include "src/proto/grpc/testing/test.grpc.pb.h" |
| 28 | |
| 29 | namespace grpc { |
| 30 | namespace testing { |
| 31 | |
| 32 | class Http2Client { |
| 33 | public: |
| 34 | explicit Http2Client(std::shared_ptr<Channel> channel); |
| 35 | ~Http2Client() {} |
| 36 | |
| 37 | bool DoRstAfterHeader(); |
| 38 | bool DoRstAfterData(); |
| 39 | bool DoRstDuringData(); |
| 40 | bool DoGoaway(); |
| 41 | bool DoPing(); |
| 42 | bool DoMaxStreams(); |
| 43 | |
| 44 | private: |
| 45 | class ServiceStub { |
| 46 | public: |
| 47 | ServiceStub(std::shared_ptr<Channel> channel); |
| 48 | |
| 49 | TestService::Stub* Get(); |
| 50 | |
| 51 | private: |
| 52 | std::unique_ptr<TestService::Stub> stub_; |
| 53 | std::shared_ptr<Channel> channel_; |
| 54 | }; |
| 55 | |
| 56 | void MaxStreamsWorker(std::shared_ptr<grpc::Channel> channel); |
| 57 | bool AssertStatusCode(const Status& s, StatusCode expected_code); |
Eric Gribkoff | 11a4ed8 | 2017-03-01 10:33:07 -0800 | [diff] [blame] | 58 | Status SendUnaryCall(SimpleResponse* response); |
| 59 | SimpleRequest BuildDefaultRequest(); |
Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 60 | ServiceStub serviceStub_; |
| 61 | std::shared_ptr<Channel> channel_; |
Eric Gribkoff | 11a4ed8 | 2017-03-01 10:33:07 -0800 | [diff] [blame] | 62 | SimpleRequest defaultRequest_; |
Eric Gribkoff | c344e87 | 2017-01-09 10:53:50 -0800 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | } // namespace testing |
| 66 | } // namespace grpc |
| 67 | |
| 68 | #endif // GRPC_TEST_CPP_INTEROP_HTTP2_CLIENT_H |