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

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

Issue 1394803004: Don't use base::MessageLoop::{Quit,QuitClosure} in remoting/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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/pseudotcp_adapter.h" 5 #include "remoting/protocol/pseudotcp_adapter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 EXPECT_EQ(0, memcmp(output_buffer_->data(), 178 EXPECT_EQ(0, memcmp(output_buffer_->data(),
179 input_buffer_->StartOfBuffer(), kTestDataSize)); 179 input_buffer_->StartOfBuffer(), kTestDataSize));
180 } 180 }
181 181
182 protected: 182 protected:
183 virtual ~TCPChannelTester() {} 183 virtual ~TCPChannelTester() {}
184 184
185 void Done() { 185 void Done() {
186 done_ = true; 186 done_ = true;
187 message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); 187 message_loop_->PostTask(FROM_HERE,
188 base::MessageLoop::QuitWhenIdleClosure());
188 } 189 }
189 190
190 void DoStart() { 191 void DoStart() {
191 InitBuffers(); 192 InitBuffers();
192 DoRead(); 193 DoRead();
193 DoWrite(); 194 DoWrite();
194 } 195 }
195 196
196 void InitBuffers() { 197 void InitBuffers() {
197 output_buffer_ = new net::DrainableIOBuffer( 198 output_buffer_ = new net::DrainableIOBuffer(
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 tester->CheckResults(); 365 tester->CheckResults();
365 } 366 }
366 367
367 class DeleteOnConnected { 368 class DeleteOnConnected {
368 public: 369 public:
369 DeleteOnConnected(base::MessageLoop* message_loop, 370 DeleteOnConnected(base::MessageLoop* message_loop,
370 scoped_ptr<PseudoTcpAdapter>* adapter) 371 scoped_ptr<PseudoTcpAdapter>* adapter)
371 : message_loop_(message_loop), adapter_(adapter) {} 372 : message_loop_(message_loop), adapter_(adapter) {}
372 void OnConnected(int error) { 373 void OnConnected(int error) {
373 adapter_->reset(); 374 adapter_->reset();
374 message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); 375 message_loop_->PostTask(FROM_HERE,
376 base::MessageLoop::QuitWhenIdleClosure());
375 } 377 }
376 base::MessageLoop* message_loop_; 378 base::MessageLoop* message_loop_;
377 scoped_ptr<PseudoTcpAdapter>* adapter_; 379 scoped_ptr<PseudoTcpAdapter>* adapter_;
378 }; 380 };
379 381
380 TEST_F(PseudoTcpAdapterTest, DeleteOnConnected) { 382 TEST_F(PseudoTcpAdapterTest, DeleteOnConnected) {
381 // This test verifies that deleting the adapter mid-callback doesn't lead 383 // This test verifies that deleting the adapter mid-callback doesn't lead
382 // to deleted structures being touched as the stack unrolls, so the failure 384 // to deleted structures being touched as the stack unrolls, so the failure
383 // mode is a crash rather than a normal test failure. 385 // mode is a crash rather than a normal test failure.
384 net::TestCompletionCallback client_connect_cb; 386 net::TestCompletionCallback client_connect_cb;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 423
422 tester->Start(); 424 tester->Start();
423 message_loop_.Run(); 425 message_loop_.Run();
424 tester->CheckResults(); 426 tester->CheckResults();
425 } 427 }
426 428
427 } // namespace 429 } // namespace
428 430
429 } // namespace protocol 431 } // namespace protocol
430 } // namespace remoting 432 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/monitored_video_stub_unittest.cc ('k') | remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698