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

Side by Side Diff: remoting/protocol/client_video_dispatcher_unittest.cc

Issue 2146213002: Add support for dynamic channels in WebrtcTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 | « remoting/protocol/channel_dispatcher_base.cc ('k') | remoting/protocol/connection_tester.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "remoting/protocol/client_video_dispatcher.h" 5 #include "remoting/protocol/client_video_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 16 matching lines...) Expand all
27 public ChannelDispatcherBase::EventHandler { 27 public ChannelDispatcherBase::EventHandler {
28 public: 28 public:
29 ClientVideoDispatcherTest(); 29 ClientVideoDispatcherTest();
30 30
31 // VideoStub interface. 31 // VideoStub interface.
32 void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet, 32 void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet,
33 const base::Closure& done) override; 33 const base::Closure& done) override;
34 34
35 // ChannelDispatcherBase::EventHandler interface. 35 // ChannelDispatcherBase::EventHandler interface.
36 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; 36 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override;
37 void OnChannelClosed(ChannelDispatcherBase* channel_dispatcher) override;
37 38
38 protected: 39 protected:
39 void OnChannelError(int error); 40 void OnChannelError(int error);
40 41
41 void OnMessageReceived(std::unique_ptr<CompoundBuffer> buffer); 42 void OnMessageReceived(std::unique_ptr<CompoundBuffer> buffer);
42 void OnReadError(int error); 43 void OnReadError(int error);
43 44
44 base::MessageLoop message_loop_; 45 base::MessageLoop message_loop_;
45 46
46 // Set to true in OnChannelInitialized(). 47 // Set to true in OnChannelInitialized().
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 const base::Closure& done) { 90 const base::Closure& done) {
90 video_packets_.push_back(video_packet.release()); 91 video_packets_.push_back(video_packet.release());
91 packet_done_callbacks_.push_back(done); 92 packet_done_callbacks_.push_back(done);
92 } 93 }
93 94
94 void ClientVideoDispatcherTest::OnChannelInitialized( 95 void ClientVideoDispatcherTest::OnChannelInitialized(
95 ChannelDispatcherBase* channel_dispatcher) { 96 ChannelDispatcherBase* channel_dispatcher) {
96 initialized_ = true; 97 initialized_ = true;
97 } 98 }
98 99
100 void ClientVideoDispatcherTest::OnChannelClosed(
101 ChannelDispatcherBase* channel_dispatcher) {
102 // Don't expect channels to be closed.
103 FAIL();
104 }
105
99 void ClientVideoDispatcherTest::OnChannelError(int error) { 106 void ClientVideoDispatcherTest::OnChannelError(int error) {
100 // Don't expect channel creation to fail. 107 // Don't expect channel creation to fail.
101 FAIL(); 108 FAIL();
102 } 109 }
103 110
104 void ClientVideoDispatcherTest::OnMessageReceived( 111 void ClientVideoDispatcherTest::OnMessageReceived(
105 std::unique_ptr<CompoundBuffer> buffer) { 112 std::unique_ptr<CompoundBuffer> buffer) {
106 std::unique_ptr<VideoAck> ack = ParseMessage<VideoAck>(buffer.get()); 113 std::unique_ptr<VideoAck> ack = ParseMessage<VideoAck>(buffer.get());
107 EXPECT_TRUE(ack); 114 EXPECT_TRUE(ack);
108 ack_messages_.push_back(ack.release()); 115 ack_messages_.push_back(ack.release());
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 base::RunLoop().RunUntilIdle(); 220 base::RunLoop().RunUntilIdle();
214 221
215 // Verify order of Ack messages. 222 // Verify order of Ack messages.
216 ASSERT_EQ(2U, ack_messages_.size()); 223 ASSERT_EQ(2U, ack_messages_.size());
217 EXPECT_EQ(kTestFrameId, ack_messages_[0]->frame_id()); 224 EXPECT_EQ(kTestFrameId, ack_messages_[0]->frame_id());
218 EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id()); 225 EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id());
219 } 226 }
220 227
221 } // namespace protocol 228 } // namespace protocol
222 } // namespace remoting 229 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.cc ('k') | remoting/protocol/connection_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698