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

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

Issue 11364031: remoting: Update calls froms RunAllPending() to RunUntilIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/buffered_socket_writer.h" 5 #include "remoting/protocol/buffered_socket_writer.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Verify that it stops writing after the first error. 153 // Verify that it stops writing after the first error.
154 TEST_F(BufferedSocketWriterTest, TestWriteErrorSync) { 154 TEST_F(BufferedSocketWriterTest, TestWriteErrorSync) {
155 socket_->set_write_limit(kWriteChunkSize); 155 socket_->set_write_limit(kWriteChunkSize);
156 writer_->Write(test_buffer_, base::Closure()); 156 writer_->Write(test_buffer_, base::Closure());
157 socket_->set_async_write(true); 157 socket_->set_async_write(true);
158 writer_->Write(test_buffer_2_, 158 writer_->Write(test_buffer_2_,
159 base::Bind(&BufferedSocketWriterTest::Unexpected, 159 base::Bind(&BufferedSocketWriterTest::Unexpected,
160 base::Unretained(this))); 160 base::Unretained(this)));
161 socket_->set_next_write_error(net::ERR_FAILED); 161 socket_->set_next_write_error(net::ERR_FAILED);
162 socket_->set_async_write(false); 162 socket_->set_async_write(false);
163 message_loop_.RunAllPending(); 163 message_loop_.RunUntilIdle();
164 EXPECT_EQ(net::ERR_FAILED, write_error_); 164 EXPECT_EQ(net::ERR_FAILED, write_error_);
165 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()), 165 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()),
166 socket_->written_data().size()); 166 socket_->written_data().size());
167 } 167 }
168 168
169 // Verify that it stops writing after the first error. 169 // Verify that it stops writing after the first error.
170 TEST_F(BufferedSocketWriterTest, TestWriteErrorAsync) { 170 TEST_F(BufferedSocketWriterTest, TestWriteErrorAsync) {
171 socket_->set_write_limit(kWriteChunkSize); 171 socket_->set_write_limit(kWriteChunkSize);
172 writer_->Write(test_buffer_, base::Closure()); 172 writer_->Write(test_buffer_, base::Closure());
173 socket_->set_async_write(true); 173 socket_->set_async_write(true);
174 writer_->Write(test_buffer_2_, 174 writer_->Write(test_buffer_2_,
175 base::Bind(&BufferedSocketWriterTest::Unexpected, 175 base::Bind(&BufferedSocketWriterTest::Unexpected,
176 base::Unretained(this))); 176 base::Unretained(this)));
177 socket_->set_next_write_error(net::ERR_FAILED); 177 socket_->set_next_write_error(net::ERR_FAILED);
178 message_loop_.RunAllPending(); 178 message_loop_.RunUntilIdle();
179 EXPECT_EQ(net::ERR_FAILED, write_error_); 179 EXPECT_EQ(net::ERR_FAILED, write_error_);
180 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()), 180 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()),
181 socket_->written_data().size()); 181 socket_->written_data().size());
182 } 182 }
183 183
184 } // namespace protocol 184 } // namespace protocol
185 } // namespace remoting 185 } // namespace remoting
186 186
OLDNEW
« no previous file with comments | « remoting/jingle_glue/iq_sender_unittest.cc ('k') | remoting/protocol/channel_multiplexer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698