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

Side by Side Diff: blimp/net/blimp_message_dispatcher_unittest.cc

Issue 1324263003: Blimp: create MessageDispatcher class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blimp-protos
Patch Set: Resolve naming collision for "net" Created 5 years, 2 months 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
« no previous file with comments | « blimp/net/blimp_message_dispatcher.cc ('k') | blimp/net/blimp_message_receiver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 // Uniitest for data encryption functions.
6
7 #include "blimp/net/blimp_message_dispatcher.h"
8
9 #include "base/logging.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 using testing::Ref;
14 using testing::Return;
15
16 namespace blimp {
17
18 class MockReceiver : public BlimpMessageReceiver {
19 public:
20 MockReceiver() {}
21 ~MockReceiver() override {}
22
23 MOCK_METHOD1(OnBlimpMessage, net::Error(const BlimpMessage& message));
24 };
25
26 TEST(BlimpMessageDispatcherTest, AllInteractions) {
27 BlimpMessage input_msg;
28 BlimpMessage compositor_msg;
29 input_msg.set_type(BlimpMessage::INPUT);
30 compositor_msg.set_type(BlimpMessage::COMPOSITOR);
31
32 MockReceiver receiver1;
33 MockReceiver receiver2;
34 EXPECT_CALL(receiver1, OnBlimpMessage(Ref(input_msg)))
35 .WillOnce(Return(net::OK));
36 EXPECT_CALL(receiver2, OnBlimpMessage(Ref(compositor_msg)))
37 .WillOnce(Return(net::ERR_FAILED));
38
39 BlimpMessageDispatcher dispatcher;
40 dispatcher.AddReceiver(BlimpMessage::INPUT, &receiver1);
41 dispatcher.AddReceiver(BlimpMessage::COMPOSITOR, &receiver2);
42 EXPECT_EQ(net::OK, dispatcher.OnBlimpMessage(input_msg));
43 EXPECT_EQ(net::ERR_FAILED, dispatcher.OnBlimpMessage(compositor_msg));
44 }
45
46 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/blimp_message_dispatcher.cc ('k') | blimp/net/blimp_message_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698