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

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

Issue 5010001: COM replaced with RPC for firing events in broker.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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') | ceee/ie/broker/broker_rpc_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ceee/ie/broker/broker_rpc_client.h"
6 #include "ceee/ie/broker/broker_rpc_server.h"
7
8 #include <atlbase.h>
9 #include "broker_rpc_lib.h" // NOLINT
10 #include "ceee/ie/broker/broker_rpc_utils.h"
11 #include "ceee/ie/common/ceee_module_util.h"
12 #include "ceee/testing/utils/mock_static.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 using testing::_;
17 using testing::StrEq;
18 using testing::StrictMock;
19 using testing::Return;
20
21 namespace {
22
23 using testing::_;
24
25 MOCK_STATIC_CLASS_BEGIN(BrokerRpcMock)
26 MOCK_STATIC_INIT_BEGIN(BrokerRpcMock)
27 MOCK_STATIC_INIT(GetRpcEndPointAddress);
28 MOCK_STATIC_INIT(BrokerRpcServer_FireEvent)
29 MOCK_STATIC_INIT_END()
30 MOCK_STATIC0(std::wstring, , GetRpcEndPointAddress);
31 MOCK_STATIC3(void, , BrokerRpcServer_FireEvent, handle_t, BSTR, BSTR);
32 MOCK_STATIC_CLASS_END(BrokerRpcMock)
33
34 class BrokerRpcTest : public testing::Test {
35 protected:
36 virtual void SetUp() {
37 EXPECT_CALL(broker_rpc_mock_, GetRpcEndPointAddress())
38 .WillRepeatedly(Return(L"BrokerRpcTestEP"));
39 }
40
41 virtual void TearDown() {
42 }
43
44 BrokerRpcMock broker_rpc_mock_;
45 };
46
47 TEST_F(BrokerRpcTest, ConnectNoServer) {
48 BrokerRpcClient client;
49 ASSERT_FALSE(client.is_connected());
50 ASSERT_FALSE(client.Connect());
51 ASSERT_FALSE(client.is_connected());
52 }
53
54 TEST_F(BrokerRpcTest, Connect) {
55 BrokerRpcServer server;
56 ASSERT_FALSE(server.is_started());
57 ASSERT_TRUE(server.Start());
58 ASSERT_TRUE(server.is_started());
59 BrokerRpcClient client;
60 ASSERT_TRUE(client.Connect());
61 ASSERT_TRUE(client.is_connected());
62 }
63
64 TEST_F(BrokerRpcTest, FireEvent) {
65 BrokerRpcServer server;
66 ASSERT_TRUE(server.Start());
67
68 BrokerRpcClient client;
69 ASSERT_TRUE(client.Connect());
70
71 CComBSTR event_name = L"event_name";
72 CComBSTR event_args = L"event_args";
73
74 EXPECT_CALL(broker_rpc_mock_, BrokerRpcServer_FireEvent(_,
75 StrEq(event_name.m_str), StrEq(event_args.m_str)))
76 .Times(1);
77
78 ASSERT_TRUE(client.FireEvent(event_name, event_args));
79 }
80
81 } // namespace
OLDNEW
« no previous file with comments | « ceee/ie/broker/broker_rpc_server.cc ('k') | ceee/ie/broker/broker_rpc_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698