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

Unified Diff: blimp/net/blimp_message_demultiplexer_unittest.cc

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Import multiplexer changes from 1434533005 Created 5 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
Index: blimp/net/blimp_message_demultiplexer_unittest.cc
diff --git a/blimp/net/blimp_message_demultiplexer_unittest.cc b/blimp/net/blimp_message_demultiplexer_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f13e1f8ce195098260179950fb4599322dfe7664
--- /dev/null
+++ b/blimp/net/blimp_message_demultiplexer_unittest.cc
@@ -0,0 +1,52 @@
+// Copyright 2015 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.
+//
+// Uniitest for data encryption functions.
+
+#include "blimp/net/blimp_message_demultiplexer.h"
+
+#include "base/logging.h"
+#include "blimp/net/test_common.h"
+#include "net/base/net_errors.h"
+#include "net/base/test_completion_callback.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::_;
+using testing::InvokeArgument;
+using testing::Ref;
+using testing::Return;
+using testing::SaveArg;
+
+namespace blimp {
+
+TEST(BlimpMessageDemultiplexerTest, AllInteractions) {
Wez 2015/11/12 00:12:54 As noted on the other unittests in this CL, it's b
Kevin M 2015/11/12 01:53:16 Done.
+ BlimpMessage input_msg;
+ BlimpMessage compositor_msg;
+ input_msg.set_type(BlimpMessage::INPUT);
+ compositor_msg.set_type(BlimpMessage::COMPOSITOR);
+
+ MockBlimpMessageProcessor receiver1;
+ MockBlimpMessageProcessor receiver2;
+ net::CompletionCallback captured_cb;
+ EXPECT_CALL(receiver1, ProcessMessage(Ref(input_msg), _))
+ .WillOnce(SaveArg<1>(&captured_cb));
+ EXPECT_CALL(receiver2, ProcessMessage(Ref(compositor_msg), _))
+ .WillOnce(SaveArg<1>(&captured_cb));
+
+ BlimpMessageDemultiplexer demux;
+ demux.AddProcessor(BlimpMessage::INPUT, &receiver1);
+ demux.AddProcessor(BlimpMessage::COMPOSITOR, &receiver2);
+
+ net::TestCompletionCallback cb1;
+ demux.ProcessMessage(input_msg, cb1.callback());
+ captured_cb.Run(net::OK);
+ EXPECT_EQ(net::OK, cb1.WaitForResult());
+ net::TestCompletionCallback cb2;
+ demux.ProcessMessage(compositor_msg, cb2.callback());
+ captured_cb.Run(net::ERR_FAILED);
+ EXPECT_EQ(net::ERR_FAILED, cb2.WaitForResult());
+}
+
+} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698