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

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

Issue 1655433002: Remove done notifications from incoming message handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 17 matching lines...) Expand all
28 // VideoStub interface. 28 // VideoStub interface.
29 void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, 29 void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
30 const base::Closure& done) override; 30 const base::Closure& done) override;
31 31
32 // ChannelDispatcherBase::EventHandler interface. 32 // ChannelDispatcherBase::EventHandler interface.
33 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; 33 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override;
34 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, 34 void OnChannelError(ChannelDispatcherBase* channel_dispatcher,
35 ErrorCode error) override; 35 ErrorCode error) override;
36 36
37 protected: 37 protected:
38 void OnVideoAck(scoped_ptr<VideoAck> ack, const base::Closure& done); 38 void OnVideoAck(scoped_ptr<VideoAck> ack);
39 void OnReadError(int error); 39 void OnReadError(int error);
40 40
41 base::MessageLoop message_loop_; 41 base::MessageLoop message_loop_;
42 42
43 // Set to true in OnChannelInitialized(). 43 // Set to true in OnChannelInitialized().
44 bool initialized_; 44 bool initialized_;
45 45
46 // Client side. 46 // Client side.
47 FakeStreamChannelFactory client_channel_factory_; 47 FakeStreamChannelFactory client_channel_factory_;
48 ClientVideoDispatcher dispatcher_; 48 ClientVideoDispatcher dispatcher_;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 initialized_ = true; 90 initialized_ = true;
91 } 91 }
92 92
93 void ClientVideoDispatcherTest::OnChannelError( 93 void ClientVideoDispatcherTest::OnChannelError(
94 ChannelDispatcherBase* channel_dispatcher, 94 ChannelDispatcherBase* channel_dispatcher,
95 ErrorCode error) { 95 ErrorCode error) {
96 // Don't expect channel creation to fail. 96 // Don't expect channel creation to fail.
97 FAIL(); 97 FAIL();
98 } 98 }
99 99
100 void ClientVideoDispatcherTest::OnVideoAck(scoped_ptr<VideoAck> ack, 100 void ClientVideoDispatcherTest::OnVideoAck(scoped_ptr<VideoAck> ack) {
101 const base::Closure& done) {
102 ack_messages_.push_back(ack.release()); 101 ack_messages_.push_back(ack.release());
103 done.Run();
104 } 102 }
105 103
106 void ClientVideoDispatcherTest::OnReadError(int error) { 104 void ClientVideoDispatcherTest::OnReadError(int error) {
107 LOG(FATAL) << "Unexpected read error: " << error; 105 LOG(FATAL) << "Unexpected read error: " << error;
108 } 106 }
109 107
110 // Verify that the client can receive video packets and acks are not sent for 108 // Verify that the client can receive video packets and acks are not sent for
111 // VideoPackets that don't have frame_id field set. 109 // VideoPackets that don't have frame_id field set.
112 TEST_F(ClientVideoDispatcherTest, WithoutAcks) { 110 TEST_F(ClientVideoDispatcherTest, WithoutAcks) {
113 VideoPacket packet; 111 VideoPacket packet;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 base::RunLoop().RunUntilIdle(); 175 base::RunLoop().RunUntilIdle();
178 176
179 // Verify order of Ack messages. 177 // Verify order of Ack messages.
180 ASSERT_EQ(2U, ack_messages_.size()); 178 ASSERT_EQ(2U, ack_messages_.size());
181 EXPECT_EQ(kTestFrameId, ack_messages_[0]->frame_id()); 179 EXPECT_EQ(kTestFrameId, ack_messages_[0]->frame_id());
182 EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id()); 180 EXPECT_EQ(kTestFrameId + 1, ack_messages_[1]->frame_id());
183 } 181 }
184 182
185 } // namespace protocol 183 } // namespace protocol
186 } // namespace remoting 184 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/client_video_dispatcher.cc ('k') | remoting/protocol/host_control_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698