OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <queue> | 5 #include <queue> |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 base::CancelableCallback<void()> callback(base::Bind(&MDnsTest::Stop, | 528 base::CancelableCallback<void()> callback(base::Bind(&MDnsTest::Stop, |
529 base::Unretained(this))); | 529 base::Unretained(this))); |
530 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 530 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
531 FROM_HERE, callback.callback(), time_period); | 531 FROM_HERE, callback.callback(), time_period); |
532 | 532 |
533 base::MessageLoop::current()->Run(); | 533 base::MessageLoop::current()->Run(); |
534 callback.Cancel(); | 534 callback.Cancel(); |
535 } | 535 } |
536 | 536 |
537 void MDnsTest::Stop() { | 537 void MDnsTest::Stop() { |
538 base::MessageLoop::current()->Quit(); | 538 base::MessageLoop::current()->QuitWhenIdle(); |
539 } | 539 } |
540 | 540 |
541 TEST_F(MDnsTest, PassiveListeners) { | 541 TEST_F(MDnsTest, PassiveListeners) { |
542 StrictMock<MockListenerDelegate> delegate_privet; | 542 StrictMock<MockListenerDelegate> delegate_privet; |
543 StrictMock<MockListenerDelegate> delegate_printer; | 543 StrictMock<MockListenerDelegate> delegate_printer; |
544 | 544 |
545 PtrRecordCopyContainer record_privet; | 545 PtrRecordCopyContainer record_privet; |
546 PtrRecordCopyContainer record_printer; | 546 PtrRecordCopyContainer record_printer; |
547 | 547 |
548 scoped_ptr<MDnsListener> listener_privet = test_client_->CreateListener( | 548 scoped_ptr<MDnsListener> listener_privet = test_client_->CreateListener( |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 SendToInternal(sample_packet_, "224.0.0.251:5353", _)) | 1314 SendToInternal(sample_packet_, "224.0.0.251:5353", _)) |
1315 .Times(0); | 1315 .Times(0); |
1316 // Expect call for the second IPv6 packed. | 1316 // Expect call for the second IPv6 packed. |
1317 EXPECT_CALL(*socket_ipv6_, | 1317 EXPECT_CALL(*socket_ipv6_, |
1318 SendToInternal(sample_packet_, "[ff02::fb]:5353", _)) | 1318 SendToInternal(sample_packet_, "[ff02::fb]:5353", _)) |
1319 .WillOnce(Return(OK)); | 1319 .WillOnce(Return(OK)); |
1320 callback.Run(OK); | 1320 callback.Run(OK); |
1321 } | 1321 } |
1322 | 1322 |
1323 } // namespace net | 1323 } // namespace net |
OLD | NEW |