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

Unified Diff: ceee/ie/broker/broker_rpc_unittest.cc

Issue 4508002: COM replaced with RPC for firing events in broker. (Closed) Base URL: svn://svn.chromium.org/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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/ie/broker/broker_rpc_unittest.cc
===================================================================
--- ceee/ie/broker/broker_rpc_unittest.cc (revision 0)
+++ ceee/ie/broker/broker_rpc_unittest.cc (revision 0)
@@ -0,0 +1,81 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ceee/ie/broker/broker_rpc_client.h"
+#include "ceee/ie/broker/broker_rpc_server.h"
+
+#include <atlbase.h>
+#include "broker_rpc_lib.h" // NOLINT
+#include "ceee/ie/broker/broker_rpc_utils.h"
+#include "ceee/ie/common/ceee_module_util.h"
+#include "ceee/testing/utils/mock_static.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::_;
+using testing::StrEq;
+using testing::StrictMock;
+using testing::Return;
+
+namespace {
+
+using testing::_;
+
+MOCK_STATIC_CLASS_BEGIN(BrokerRpcMock)
+ MOCK_STATIC_INIT_BEGIN(BrokerRpcMock)
+ MOCK_STATIC_INIT(GetRpcEndPointAddress);
+ MOCK_STATIC_INIT(BrokerRpcServer_FireEvent)
+ MOCK_STATIC_INIT_END()
+ MOCK_STATIC0(std::wstring, , GetRpcEndPointAddress);
+ MOCK_STATIC3(void, , BrokerRpcServer_FireEvent, handle_t, BSTR, BSTR);
+MOCK_STATIC_CLASS_END(BrokerRpcMock)
+
+class BrokerRpcTest : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ EXPECT_CALL(broker_rpc_mock_, GetRpcEndPointAddress())
+ .WillRepeatedly(Return(L"BrokerRpcTestEP"));
+ }
+
+ virtual void TearDown() {
+ }
+
+ BrokerRpcMock broker_rpc_mock_;
+};
+
+TEST_F(BrokerRpcTest, ConnectNoServer) {
+ BrokerRpcClient client;
+ ASSERT_FALSE(client.is_connected());
+ ASSERT_FALSE(client.Connect());
+ ASSERT_FALSE(client.is_connected());
+}
+
+TEST_F(BrokerRpcTest, Connect) {
+ BrokerRpcServer server;
+ ASSERT_FALSE(server.is_started());
+ ASSERT_TRUE(server.Start());
+ ASSERT_TRUE(server.is_started());
+ BrokerRpcClient client;
+ ASSERT_TRUE(client.Connect());
+ ASSERT_TRUE(client.is_connected());
+}
+
+TEST_F(BrokerRpcTest, FireEvent) {
+ BrokerRpcServer server;
+ ASSERT_TRUE(server.Start());
+
+ BrokerRpcClient client;
+ ASSERT_TRUE(client.Connect());
+
+ CComBSTR event_name = L"event_name";
+ CComBSTR event_args = L"event_args";
+
+ EXPECT_CALL(broker_rpc_mock_, BrokerRpcServer_FireEvent(_,
+ StrEq(event_name.m_str), StrEq(event_args.m_str)))
+ .Times(1);
+
+ ASSERT_TRUE(client.FireEvent(event_name, event_args));
+}
+
+} // namespace
Property changes on: ceee\ie\broker\broker_rpc_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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