| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ceee/ie/broker/broker_rpc_client.h" | 5 #include "ceee/ie/broker/broker_rpc_client.h" |
| 6 #include "ceee/ie/broker/broker_rpc_server.h" | 6 #include "ceee/ie/broker/broker_rpc_server.h" |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include "broker_rpc_lib.h" // NOLINT | 9 #include "broker_rpc_lib.h" // NOLINT |
| 10 #include "ceee/ie/broker/broker_rpc_utils.h" | 10 #include "ceee/ie/broker/broker_rpc_utils.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 EXPECT_CALL(broker_rpc_mock_, | 92 EXPECT_CALL(broker_rpc_mock_, |
| 93 BrokerRpcServer_SendUmaHistogramData(_, StrEq(name), 1, 2, 3, 4)) | 93 BrokerRpcServer_SendUmaHistogramData(_, StrEq(name), 1, 2, 3, 4)) |
| 94 .Times(1); | 94 .Times(1); |
| 95 ASSERT_HRESULT_SUCCEEDED(client.SendUmaHistogramData(name, 1, 2, 3, 4)); | 95 ASSERT_HRESULT_SUCCEEDED(client.SendUmaHistogramData(name, 1, 2, 3, 4)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 class TestingBrokerRpcClient : public BrokerRpcClient { | 98 class TestingBrokerRpcClient : public BrokerRpcClient { |
| 99 public: | 99 public: |
| 100 explicit TestingBrokerRpcClient(bool allow_restarts) | 100 explicit TestingBrokerRpcClient(bool allow_restarts) |
| 101 : BrokerRpcClient(allow_restarts) {} | 101 : BrokerRpcClient(allow_restarts) {} |
| 102 MOCK_METHOD1(StartServer, HRESULT(IUnknown**)); | 102 MOCK_METHOD1(StartServer, HRESULT(ICeeeBrokerRegistrar**)); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 TEST_F(BrokerRpcTest, StartServer) { | 105 TEST_F(BrokerRpcTest, StartServer) { |
| 106 BrokerRpcServer server; | 106 BrokerRpcServer server; |
| 107 TestingBrokerRpcClient client(true); | 107 TestingBrokerRpcClient client(true); |
| 108 EXPECT_CALL(client, StartServer(_)) | 108 EXPECT_CALL(client, StartServer(_)) |
| 109 .Times(0); | 109 .Times(0); |
| 110 ASSERT_HRESULT_FAILED(client.Connect(false)); | 110 ASSERT_HRESULT_FAILED(client.Connect(false)); |
| 111 | 111 |
| 112 EXPECT_CALL(client, StartServer(_)) | 112 EXPECT_CALL(client, StartServer(_)) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 .WillOnce(DoAll(IgnoreResult(InvokeWithoutArgs(&server, | 159 .WillOnce(DoAll(IgnoreResult(InvokeWithoutArgs(&server, |
| 160 &BrokerRpcServer::Start)), | 160 &BrokerRpcServer::Start)), |
| 161 Return(RPC_S_OK))); | 161 Return(RPC_S_OK))); |
| 162 EXPECT_CALL(broker_rpc_mock_, | 162 EXPECT_CALL(broker_rpc_mock_, |
| 163 BrokerRpcServer_FireEvent(_, _, _, _)) | 163 BrokerRpcServer_FireEvent(_, _, _, _)) |
| 164 .Times(1); | 164 .Times(1); |
| 165 ASSERT_HRESULT_SUCCEEDED(client.FireEvent("A", "B")); | 165 ASSERT_HRESULT_SUCCEEDED(client.FireEvent("A", "B")); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace | 168 } // namespace |
| OLD | NEW |