Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: ceee/ie/broker/broker_rpc_unittest.cc

Issue 5481002: Ensure that just started broker doesn't get events addressed to dead instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ceee/ie/broker/broker_rpc_server.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 using testing::_; 23 using testing::_;
24 24
25 MOCK_STATIC_CLASS_BEGIN(BrokerRpcMock) 25 MOCK_STATIC_CLASS_BEGIN(BrokerRpcMock)
26 MOCK_STATIC_INIT_BEGIN(BrokerRpcMock) 26 MOCK_STATIC_INIT_BEGIN(BrokerRpcMock)
27 MOCK_STATIC_INIT(GetRpcEndPointAddress); 27 MOCK_STATIC_INIT(GetRpcEndPointAddress);
28 MOCK_STATIC_INIT(BrokerRpcServer_FireEvent); 28 MOCK_STATIC_INIT(BrokerRpcServer_FireEvent);
29 MOCK_STATIC_INIT(BrokerRpcServer_SendUmaHistogramTimes); 29 MOCK_STATIC_INIT(BrokerRpcServer_SendUmaHistogramTimes);
30 MOCK_STATIC_INIT(BrokerRpcServer_SendUmaHistogramData); 30 MOCK_STATIC_INIT(BrokerRpcServer_SendUmaHistogramData);
31 MOCK_STATIC_INIT_END() 31 MOCK_STATIC_INIT_END()
32 MOCK_STATIC0(std::wstring, , GetRpcEndPointAddress); 32 MOCK_STATIC0(std::wstring, , GetRpcEndPointAddress);
33 MOCK_STATIC3(void, , BrokerRpcServer_FireEvent, handle_t, const char*, 33 MOCK_STATIC4(void, , BrokerRpcServer_FireEvent, handle_t, BrokerContextHandle,
34 const char*); 34 const char*, const char*);
35 MOCK_STATIC3(void, , BrokerRpcServer_SendUmaHistogramTimes, handle_t, 35 MOCK_STATIC3(void, , BrokerRpcServer_SendUmaHistogramTimes, handle_t,
36 const char*, int); 36 const char*, int);
37 MOCK_STATIC6(void, , BrokerRpcServer_SendUmaHistogramData, handle_t, 37 MOCK_STATIC6(void, , BrokerRpcServer_SendUmaHistogramData, handle_t,
38 const char*, int, int, int, int); 38 const char*, int, int, int, int);
39 MOCK_STATIC_CLASS_END(BrokerRpcMock) 39 MOCK_STATIC_CLASS_END(BrokerRpcMock)
40 40
41 class BrokerRpcTest : public testing::Test { 41 class BrokerRpcTest : public testing::Test {
42 protected: 42 protected:
43 virtual void SetUp() { 43 virtual void SetUp() {
44 EXPECT_CALL(broker_rpc_mock_, GetRpcEndPointAddress()) 44 EXPECT_CALL(broker_rpc_mock_, GetRpcEndPointAddress())
(...skipping 27 matching lines...) Expand all
72 BrokerRpcServer server; 72 BrokerRpcServer server;
73 ASSERT_TRUE(server.Start()); 73 ASSERT_TRUE(server.Start());
74 74
75 BrokerRpcClient client; 75 BrokerRpcClient client;
76 ASSERT_HRESULT_SUCCEEDED(client.Connect(false)); 76 ASSERT_HRESULT_SUCCEEDED(client.Connect(false));
77 77
78 const char* name = "name"; 78 const char* name = "name";
79 const char* args = "args"; 79 const char* args = "args";
80 80
81 EXPECT_CALL(broker_rpc_mock_, 81 EXPECT_CALL(broker_rpc_mock_,
82 BrokerRpcServer_FireEvent(_, StrEq(name), StrEq(args))) 82 BrokerRpcServer_FireEvent(_, _, StrEq(name), StrEq(args)))
83 .Times(1); 83 .Times(1);
84 84
85 ASSERT_HRESULT_SUCCEEDED(client.FireEvent(name, args)); 85 ASSERT_HRESULT_SUCCEEDED(client.FireEvent(name, args));
86 86
87 EXPECT_CALL(broker_rpc_mock_, 87 EXPECT_CALL(broker_rpc_mock_,
88 BrokerRpcServer_SendUmaHistogramTimes(_, StrEq(name), 321)) 88 BrokerRpcServer_SendUmaHistogramTimes(_, StrEq(name), 321))
89 .Times(1); 89 .Times(1);
90 ASSERT_HRESULT_SUCCEEDED(client.SendUmaHistogramTimes(name, 321)); 90 ASSERT_HRESULT_SUCCEEDED(client.SendUmaHistogramTimes(name, 321));
91 91
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 } // namespace 98 } // namespace
OLDNEW
« no previous file with comments | « ceee/ie/broker/broker_rpc_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698