Skip to content
Snippets Groups Projects
Commit 2814b514 authored by Mahak Mukhi's avatar Mahak Mukhi
Browse files

formatting

parent 13d85d49
No related branches found
No related tags found
No related merge requests found
...@@ -2331,7 +2331,7 @@ $(GENDIR)/src/proto/grpc/testing/echo.pb.cc: src/proto/grpc/testing/echo.proto $ ...@@ -2331,7 +2331,7 @@ $(GENDIR)/src/proto/grpc/testing/echo.pb.cc: src/proto/grpc/testing/echo.proto $
$(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc: src/proto/grpc/testing/echo.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc: src/proto/grpc/testing/echo.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=generate_mock_code=true:$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $<
endif endif
   
ifeq ($(NO_PROTOC),true) ifeq ($(NO_PROTOC),true)
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
#include <stdint.h> #include <stdint.h>
#include <gmock/gmock.h>
#include <grpc++/impl/codegen/call.h> #include <grpc++/impl/codegen/call.h>
#include <grpc++/support/async_stream.h> #include <grpc++/support/async_stream.h>
#include <grpc++/support/async_unary_call.h> #include <grpc++/support/async_unary_call.h>
#include <grpc++/support/sync_stream.h> #include <grpc++/support/sync_stream.h>
#include <gmock/gmock.h>
namespace grpc { namespace grpc {
namespace testing { namespace testing {
......
...@@ -1408,7 +1408,8 @@ grpc::string GetSourceEpilogue(grpc_generator::File *file, ...@@ -1408,7 +1408,8 @@ grpc::string GetSourceEpilogue(grpc_generator::File *file,
} }
// TODO(mmukhi): Make sure we need parameters or not. // TODO(mmukhi): Make sure we need parameters or not.
grpc::string GetMockPrologue(grpc_generator::File *file, const Parameters & /*params*/ ) { grpc::string GetMockPrologue(grpc_generator::File *file,
const Parameters & /*params*/) {
grpc::string output; grpc::string output;
{ {
// Scope the output stream so it closes and finalizes output to the string. // Scope the output stream so it closes and finalizes output to the string.
...@@ -1434,7 +1435,8 @@ grpc::string GetMockPrologue(grpc_generator::File *file, const Parameters & /*pa ...@@ -1434,7 +1435,8 @@ grpc::string GetMockPrologue(grpc_generator::File *file, const Parameters & /*pa
} }
// TODO(mmukhi): Add client-stream and completion-queue headers. // TODO(mmukhi): Add client-stream and completion-queue headers.
grpc::string GetMockIncludes(grpc_generator::File *file, const Parameters &params) { grpc::string GetMockIncludes(grpc_generator::File *file,
const Parameters &params) {
grpc::string output; grpc::string output;
{ {
// Scope the output stream so it closes and finalizes output to the string. // Scope the output stream so it closes and finalizes output to the string.
...@@ -1442,9 +1444,8 @@ grpc::string GetMockIncludes(grpc_generator::File *file, const Parameters &param ...@@ -1442,9 +1444,8 @@ grpc::string GetMockIncludes(grpc_generator::File *file, const Parameters &param
std::map<grpc::string, grpc::string> vars; std::map<grpc::string, grpc::string> vars;
static const char *headers_strs[] = { static const char *headers_strs[] = {
"grpc++/impl/codegen/async_stream.h", "grpc++/impl/codegen/async_stream.h",
"grpc++/impl/codegen/sync_stream.h", "grpc++/impl/codegen/sync_stream.h", "gmock/gmock.h",
"gmock/gmock.h",
}; };
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs)); std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
PrintIncludes(printer.get(), headers, params); PrintIncludes(printer.get(), headers, params);
...@@ -1452,7 +1453,7 @@ grpc::string GetMockIncludes(grpc_generator::File *file, const Parameters &param ...@@ -1452,7 +1453,7 @@ grpc::string GetMockIncludes(grpc_generator::File *file, const Parameters &param
if (!file->package().empty()) { if (!file->package().empty()) {
std::vector<grpc::string> parts = file->package_parts(); std::vector<grpc::string> parts = file->package_parts();
for(auto part = parts.begin(); part != parts.end(); part++) { for (auto part = parts.begin(); part != parts.end(); part++) {
vars["part"] = *part; vars["part"] = *part;
printer->Print(vars, "namespace $part$ {\n"); printer->Print(vars, "namespace $part$ {\n");
} }
...@@ -1475,36 +1476,33 @@ void PrintMockClientMethods(grpc_generator::Printer *printer, ...@@ -1475,36 +1476,33 @@ void PrintMockClientMethods(grpc_generator::Printer *printer,
*vars, *vars,
"MOCK_METHOD3($Method$, ::grpc::Status(::grpc::ClientContext* context, " "MOCK_METHOD3($Method$, ::grpc::Status(::grpc::ClientContext* context, "
"const $Request$& request, $Response$* response));\n"); "const $Request$& request, $Response$* response));\n");
printer->Print( printer->Print(*vars,
*vars, "MOCK_METHOD3(Async$Method$Raw, "
"MOCK_METHOD3(Async$Method$Raw, " "::grpc::ClientAsyncResponseReaderInterface< $Response$>*"
"::grpc::ClientAsyncResponseReaderInterface< $Response$>*" "(::grpc::ClientContext* context, const $Request$& request, "
"(::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq));\n");
"::grpc::CompletionQueue* cq));\n");
} else if (ClientOnlyStreaming(method)) { } else if (ClientOnlyStreaming(method)) {
printer->Print( printer->Print(
*vars, *vars,
"MOCK_METHOD2($Method$Raw, " "MOCK_METHOD2($Method$Raw, "
"::grpc::ClientWriterInterface< $Request$>*" "::grpc::ClientWriterInterface< $Request$>*"
"(::grpc::ClientContext* context, $Response$* response));\n"); "(::grpc::ClientContext* context, $Response$* response));\n");
printer->Print( printer->Print(*vars,
*vars, "MOCK_METHOD4(Async$Method$Raw, "
"MOCK_METHOD4(Async$Method$Raw, " "::grpc::ClientAsyncWriterInterface< $Request$>*"
"::grpc::ClientAsyncWriterInterface< $Request$>*" "(::grpc::ClientContext* context, $Response$* response, "
"(::grpc::ClientContext* context, $Response$* response, " "::grpc::CompletionQueue* cq, void* tag));\n");
"::grpc::CompletionQueue* cq, void* tag));\n");
} else if (ServerOnlyStreaming(method)) { } else if (ServerOnlyStreaming(method)) {
printer->Print( printer->Print(
*vars, *vars,
"MOCK_METHOD2($Method$Raw, " "MOCK_METHOD2($Method$Raw, "
"::grpc::ClientReaderInterface< $Response$>*" "::grpc::ClientReaderInterface< $Response$>*"
"(::grpc::ClientContext* context, const $Request$& request));\n"); "(::grpc::ClientContext* context, const $Request$& request));\n");
printer->Print( printer->Print(*vars,
*vars, "MOCK_METHOD4(Async$Method$Raw, "
"MOCK_METHOD4(Async$Method$Raw, " "::grpc::ClientAsyncReaderInterface< $Response$>*"
"::grpc::ClientAsyncReaderInterface< $Response$>*" "(::grpc::ClientContext* context, const $Request$& request, "
"(::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag));\n");
"::grpc::CompletionQueue* cq, void* tag));\n");
} else if (method->BidiStreaming()) { } else if (method->BidiStreaming()) {
printer->Print( printer->Print(
*vars, *vars,
...@@ -1521,8 +1519,8 @@ void PrintMockClientMethods(grpc_generator::Printer *printer, ...@@ -1521,8 +1519,8 @@ void PrintMockClientMethods(grpc_generator::Printer *printer,
} }
void PrintMockService(grpc_generator::Printer *printer, void PrintMockService(grpc_generator::Printer *printer,
const grpc_generator::Service *service, const grpc_generator::Service *service,
std::map<grpc::string, grpc::string> *vars) { std::map<grpc::string, grpc::string> *vars) {
(*vars)["Service"] = service->name(); (*vars)["Service"] = service->name();
printer->Print(service->GetLeadingComments("//").c_str()); printer->Print(service->GetLeadingComments("//").c_str());
...@@ -1540,7 +1538,6 @@ void PrintMockService(grpc_generator::Printer *printer, ...@@ -1540,7 +1538,6 @@ void PrintMockService(grpc_generator::Printer *printer,
} }
printer->Outdent(); printer->Outdent();
printer->Print("};\n"); printer->Print("};\n");
} }
grpc::string GetMockServices(grpc_generator::File *file, grpc::string GetMockServices(grpc_generator::File *file,
...@@ -1557,12 +1554,12 @@ grpc::string GetMockServices(grpc_generator::File *file, ...@@ -1557,12 +1554,12 @@ grpc::string GetMockServices(grpc_generator::File *file,
vars["Package"].append("."); vars["Package"].append(".");
} }
if(!params.services_namespace.empty()) { if (!params.services_namespace.empty()) {
vars["services_namespace"] = params.services_namespace; vars["services_namespace"] = params.services_namespace;
printer->Print(vars, "\nnamespace $services_namespace$ {\n\n"); printer->Print(vars, "\nnamespace $services_namespace$ {\n\n");
} }
for (int i =0; i < file->service_count(); i++) { for (int i = 0; i < file->service_count(); i++) {
PrintMockService(printer.get(), file->service(i).get(), &vars); PrintMockService(printer.get(), file->service(i).get(), &vars);
printer->Print("\n"); printer->Print("\n");
} }
...@@ -1574,13 +1571,14 @@ grpc::string GetMockServices(grpc_generator::File *file, ...@@ -1574,13 +1571,14 @@ grpc::string GetMockServices(grpc_generator::File *file,
return output; return output;
} }
grpc::string GetMockEpilogue(grpc_generator::File *file, const Parameters & /*params*/) { grpc::string GetMockEpilogue(grpc_generator::File *file,
const Parameters & /*params*/) {
grpc::string temp; grpc::string temp;
if (!file->package().empty()) { if (!file->package().empty()) {
std::vector<grpc::string> parts = file->package_parts(); std::vector<grpc::string> parts = file->package_parts();
for (auto part = parts.begin(); part != parts.end(); part++){ for (auto part = parts.begin(); part != parts.end(); part++) {
temp.append("} // namespace "); temp.append("} // namespace ");
temp.append(*part); temp.append(*part);
temp.append("\n"); temp.append("\n");
......
...@@ -65,6 +65,8 @@ struct Parameters { ...@@ -65,6 +65,8 @@ struct Parameters {
bool use_system_headers; bool use_system_headers;
// Prefix to any grpc include // Prefix to any grpc include
grpc::string grpc_search_path; grpc::string grpc_search_path;
// Generate GMOCK code to facilitate unit testing.
bool generate_mock_code;
}; };
// Return the prologue of the generated header file. // Return the prologue of the generated header file.
...@@ -101,35 +103,35 @@ grpc::string GetSourceEpilogue(grpc_generator::File *file, ...@@ -101,35 +103,35 @@ grpc::string GetSourceEpilogue(grpc_generator::File *file,
// Return the prologue of the generated mock file. // Return the prologue of the generated mock file.
grpc::string GetMockPrologue(grpc_generator::File *file, grpc::string GetMockPrologue(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
// Return the includes needed for generated mock file. // Return the includes needed for generated mock file.
grpc::string GetMockIncludes(grpc_generator::File *file, grpc::string GetMockIncludes(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
// Return the services for generated mock file. // Return the services for generated mock file.
grpc::string GetMockServices(grpc_generator::File* file, grpc::string GetMockServices(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
// Return the epilogue of generated mock file. // Return the epilogue of generated mock file.
grpc::string GetMockEpilogue(grpc_generator::File* file, grpc::string GetMockEpilogue(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
// Return the prologue of the generated mock file. // Return the prologue of the generated mock file.
grpc::string GetMockPrologue(grpc_generator::File *file, grpc::string GetMockPrologue(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
// Return the includes needed for generated mock file. // Return the includes needed for generated mock file.
grpc::string GetMockIncludes(grpc_generator::File *file, grpc::string GetMockIncludes(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
// Return the services for generated mock file. // Return the services for generated mock file.
grpc::string GetMockServices(grpc_generator::File* file, grpc::string GetMockServices(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
// Return the epilogue of generated mock file. // Return the epilogue of generated mock file.
grpc::string GetMockEpilogue(grpc_generator::File* file, grpc::string GetMockEpilogue(grpc_generator::File *file,
const Parameters &params); const Parameters &params);
} // namespace grpc_cpp_generator } // namespace grpc_cpp_generator
......
...@@ -62,6 +62,7 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ...@@ -62,6 +62,7 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
grpc_cpp_generator::Parameters generator_parameters; grpc_cpp_generator::Parameters generator_parameters;
generator_parameters.use_system_headers = true; generator_parameters.use_system_headers = true;
generator_parameters.generate_mock_code = false;
ProtoBufFile pbfile(file); ProtoBufFile pbfile(file);
...@@ -85,6 +86,13 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ...@@ -85,6 +86,13 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
} }
} else if (param[0] == "grpc_search_path") { } else if (param[0] == "grpc_search_path") {
generator_parameters.grpc_search_path = param[1]; generator_parameters.grpc_search_path = param[1];
} else if (param[0] == "generate_mock_code") {
if (param[1] == "true") {
generator_parameters.generate_mock_code = true;
} else if (param[1] != "false") {
*error = grpc::string("Invalid parameter: ") + *parameter_string;
return false;
}
} else { } else {
*error = grpc::string("Unknown parameter: ") + *parameter_string; *error = grpc::string("Unknown parameter: ") + *parameter_string;
return false; return false;
...@@ -114,6 +122,9 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ...@@ -114,6 +122,9 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
grpc::protobuf::io::CodedOutputStream source_coded_out(source_output.get()); grpc::protobuf::io::CodedOutputStream source_coded_out(source_output.get());
source_coded_out.WriteRaw(source_code.data(), source_code.size()); source_coded_out.WriteRaw(source_code.data(), source_code.size());
if (!generator_parameters.generate_mock_code) {
return true;
}
grpc::string mock_code = grpc::string mock_code =
grpc_cpp_generator::GetMockPrologue(&pbfile, generator_parameters) + grpc_cpp_generator::GetMockPrologue(&pbfile, generator_parameters) +
grpc_cpp_generator::GetMockIncludes(&pbfile, generator_parameters) + grpc_cpp_generator::GetMockIncludes(&pbfile, generator_parameters) +
......
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015, Google Inc.
* All rights reserved. * All rights reserved.
* *
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <climits> #include <climits>
#include <thread> #include <thread>
#include <gmock/gmock.h>
#include <grpc++/channel.h> #include <grpc++/channel.h>
#include <grpc++/client_context.h> #include <grpc++/client_context.h>
#include <grpc++/create_channel.h> #include <grpc++/create_channel.h>
...@@ -45,7 +46,6 @@ ...@@ -45,7 +46,6 @@
#include <grpc/support/thd.h> #include <grpc/support/thd.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <grpc++/test/mock_stream.h> #include <grpc++/test/mock_stream.h>
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#include "test/core/util/port.h" #include "test/core/util/port.h"
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
#include<iostream> #include <iostream>
using namespace std; using namespace std;
using grpc::testing::EchoRequest; using grpc::testing::EchoRequest;
...@@ -98,8 +98,8 @@ class FakeClient { ...@@ -98,8 +98,8 @@ class FakeClient {
grpc::string msg("hello"); grpc::string msg("hello");
grpc::string exp(msg); grpc::string exp(msg);
std::unique_ptr<ClientWriterInterface<EchoRequest>> std::unique_ptr<ClientWriterInterface<EchoRequest>> cstream =
cstream = stub_->RequestStream(&context, &response); stub_->RequestStream(&context, &response);
request.set_message(msg); request.set_message(msg);
EXPECT_TRUE(cstream->Write(request)); EXPECT_TRUE(cstream->Write(request));
...@@ -122,8 +122,8 @@ class FakeClient { ...@@ -122,8 +122,8 @@ class FakeClient {
request.set_message("hello world"); request.set_message("hello world");
ClientContext context; ClientContext context;
std::unique_ptr<ClientReaderInterface<EchoResponse>> std::unique_ptr<ClientReaderInterface<EchoResponse>> cstream =
cstream = stub_->ResponseStream(&context, request); stub_->ResponseStream(&context, request);
grpc::string exp = ""; grpc::string exp = "";
EXPECT_TRUE(cstream->Read(&response)); EXPECT_TRUE(cstream->Read(&response));
...@@ -197,8 +197,7 @@ class TestServiceImpl : public EchoTestService::Service { ...@@ -197,8 +197,7 @@ class TestServiceImpl : public EchoTestService::Service {
return Status::OK; return Status::OK;
} }
Status ResponseStream(ServerContext* context, Status ResponseStream(ServerContext* context, const EchoRequest* request,
const EchoRequest* request,
ServerWriter<EchoResponse>* writer) { ServerWriter<EchoResponse>* writer) {
EchoResponse response; EchoResponse response;
vector<grpc::string> tokens = split(request->message()); vector<grpc::string> tokens = split(request->message());
...@@ -221,23 +220,22 @@ class TestServiceImpl : public EchoTestService::Service { ...@@ -221,23 +220,22 @@ class TestServiceImpl : public EchoTestService::Service {
} }
return Status::OK; return Status::OK;
} }
private: private:
const vector<grpc::string> split(const grpc::string& input) { const vector<grpc::string> split(const grpc::string& input) {
grpc::string buff(""); grpc::string buff("");
vector<grpc::string> result; vector<grpc::string> result;
for (auto n:input) { for (auto n : input) {
if (n != ' ') { if (n != ' ') {
buff += n; buff += n;
continue; continue;
} }
if (buff == "") if (buff == "") continue;
continue;
result.push_back(buff); result.push_back(buff);
buff = ""; buff = "";
} }
if (buff != "") if (buff != "") result.push_back(buff);
result.push_back(buff);
return result; return result;
} }
...@@ -280,7 +278,9 @@ TEST_F(MockTest, SimpleRpc) { ...@@ -280,7 +278,9 @@ TEST_F(MockTest, SimpleRpc) {
MockEchoTestServiceStub stub; MockEchoTestServiceStub stub;
EchoResponse resp; EchoResponse resp;
resp.set_message("hello world"); resp.set_message("hello world");
EXPECT_CALL(stub, Echo(_, _, _)).Times(AtLeast(1)).WillOnce(DoAll(SetArgPointee<2>(resp), Return(Status::OK))); EXPECT_CALL(stub, Echo(_, _, _))
.Times(AtLeast(1))
.WillOnce(DoAll(SetArgPointee<2>(resp), Return(Status::OK)));
client.ResetStub(&stub); client.ResetStub(&stub);
client.DoEcho(); client.DoEcho();
} }
...@@ -299,7 +299,8 @@ TEST_F(MockTest, ClientStream) { ...@@ -299,7 +299,8 @@ TEST_F(MockTest, ClientStream) {
EXPECT_CALL(*w, WritesDone()); EXPECT_CALL(*w, WritesDone());
EXPECT_CALL(*w, Finish()).WillOnce(Return(Status::OK)); EXPECT_CALL(*w, Finish()).WillOnce(Return(Status::OK));
EXPECT_CALL(stub, RequestStreamRaw(_, _)).WillOnce(DoAll(SetArgPointee<1>(resp), Return(w))); EXPECT_CALL(stub, RequestStreamRaw(_, _))
.WillOnce(DoAll(SetArgPointee<1>(resp), Return(w)));
client.ResetStub(&stub); client.ResetStub(&stub);
client.DoRequestStream(); client.DoRequestStream();
} }
...@@ -316,10 +317,10 @@ TEST_F(MockTest, ServerStream) { ...@@ -316,10 +317,10 @@ TEST_F(MockTest, ServerStream) {
EchoResponse resp2; EchoResponse resp2;
resp2.set_message("world"); resp2.set_message("world");
EXPECT_CALL(*r, Read(_)). EXPECT_CALL(*r, Read(_))
WillOnce(DoAll(SetArgPointee<0>(resp1), Return(true))). .WillOnce(DoAll(SetArgPointee<0>(resp1), Return(true)))
WillOnce(DoAll(SetArgPointee<0>(resp2), Return(true))). .WillOnce(DoAll(SetArgPointee<0>(resp2), Return(true)))
WillOnce(Return(false)); .WillOnce(Return(false));
EXPECT_CALL(*r, Finish()).WillOnce(Return(Status::OK)); EXPECT_CALL(*r, Finish()).WillOnce(Return(Status::OK));
EXPECT_CALL(stub, ResponseStreamRaw(_, _)).WillOnce(Return(r)); EXPECT_CALL(stub, ResponseStreamRaw(_, _)).WillOnce(Return(r));
...@@ -328,9 +329,7 @@ TEST_F(MockTest, ServerStream) { ...@@ -328,9 +329,7 @@ TEST_F(MockTest, ServerStream) {
client.DoResponseStream(); client.DoResponseStream();
} }
ACTION_P(copy, msg) { ACTION_P(copy, msg) { arg0->set_message(msg->message()); }
arg0->set_message(msg->message());
}
TEST_F(MockTest, BidiStream) { TEST_F(MockTest, BidiStream) {
ResetStub(); ResetStub();
...@@ -340,12 +339,14 @@ TEST_F(MockTest, BidiStream) { ...@@ -340,12 +339,14 @@ TEST_F(MockTest, BidiStream) {
auto rw = new MockClientReaderWriter<EchoRequest, EchoResponse>(); auto rw = new MockClientReaderWriter<EchoRequest, EchoResponse>();
EchoRequest msg; EchoRequest msg;
EXPECT_CALL(*rw, Write(_, _)).Times(3).WillRepeatedly(DoAll(SaveArg<0>(&msg), Return(true))); EXPECT_CALL(*rw, Write(_, _))
EXPECT_CALL(*rw, Read(_)). .Times(3)
WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true))). .WillRepeatedly(DoAll(SaveArg<0>(&msg), Return(true)));
WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true))). EXPECT_CALL(*rw, Read(_))
WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true))). .WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true)))
WillOnce(Return(false)); .WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true)))
.WillOnce(DoAll(WithArg<0>(copy(&msg)), Return(true)))
.WillOnce(Return(false));
EXPECT_CALL(*rw, WritesDone()); EXPECT_CALL(*rw, WritesDone());
EXPECT_CALL(*rw, Finish()).WillOnce(Return(Status::OK)); EXPECT_CALL(*rw, Finish()).WillOnce(Return(Status::OK));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment