OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <fcntl.h> | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/logging.h" | |
9 #include "blimp/test/fake_engine/fake_engine.h" | |
10 #include "blimp/test/fake_engine/proto/logging.grpc.pb.h" | |
11 | |
12 #include "third_party/grpc/include/grpc++/grpc++.h" | |
13 | |
14 namespace blimp { | |
15 | |
16 // The Fake Engine currently after starting just sends a test log request. | |
17 int Main() { | |
18 FakeEngine fake_engine; | |
19 fake_engine.Start(); | |
20 | |
21 Logging::Stub* logging_stub = fake_engine.GetLoggingStub(); | |
22 | |
23 LogRequest request; | |
24 LogResponse response; | |
25 | |
26 request.set_message("test log message"); | |
27 | |
28 grpc::ClientContext context; | |
29 grpc::Status status = logging_stub->Log(&context, request, &response); | |
30 | |
31 if (!status.ok()) { | |
32 LOG(ERROR) << "Log RPC failed: " << status.error_code() << ": " | |
33 << status.error_message(); | |
34 exit(-1); | |
35 } | |
36 LOG(INFO) << "Log RPC success"; | |
37 | |
38 fake_engine.WaitForShutdown(); | |
39 return 0; | |
40 } | |
41 | |
42 } // namespace blimp | |
43 | |
44 int main(int argc, const char** argv) { | |
45 base::CommandLine::Init(argc, argv); | |
46 return blimp::Main(); | |
47 } | |
OLD | NEW |