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

Side by Side Diff: chrome/browser/extensions/api/socket/udp_socket_unittest.cc

Issue 2825963003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/extensions (Closed)
Patch Set: Created 3 years, 8 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 (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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Send a test multicast packet every second. 98 // Send a test multicast packet every second.
99 // Once the target socket received the packet, the message loop will exit. 99 // Once the target socket received the packet, the message loop will exit.
100 static void SendMulticastPacket(const base::Closure& quit_run_loop, 100 static void SendMulticastPacket(const base::Closure& quit_run_loop,
101 UDPSocket* src, 101 UDPSocket* src,
102 int result) { 102 int result) {
103 if (result == 0) { 103 if (result == 0) {
104 scoped_refptr<net::IOBuffer> data = new net::WrappedIOBuffer(test_message); 104 scoped_refptr<net::IOBuffer> data = new net::WrappedIOBuffer(test_message);
105 src->Write(data, test_message_length, base::Bind(&OnSendCompleted)); 105 src->Write(data, test_message_length, base::Bind(&OnSendCompleted));
106 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 106 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
107 FROM_HERE, base::Bind(&SendMulticastPacket, quit_run_loop, src, result), 107 FROM_HERE,
108 base::BindOnce(&SendMulticastPacket, quit_run_loop, src, result),
108 base::TimeDelta::FromSeconds(1)); 109 base::TimeDelta::FromSeconds(1));
109 } else { 110 } else {
110 quit_run_loop.Run(); 111 quit_run_loop.Run();
111 FAIL() << "Failed to connect to multicast address. Error code: " << result; 112 FAIL() << "Failed to connect to multicast address. Error code: " << result;
112 } 113 }
113 } 114 }
114 115
115 static void OnMulticastReadCompleted(const base::Closure& quit_run_loop, 116 static void OnMulticastReadCompleted(const base::Closure& quit_run_loop,
116 bool* packet_received, 117 bool* packet_received,
117 int count, 118 int count,
(...skipping 29 matching lines...) Expand all
147 // If not received within the test action timeout, quit the message loop. 148 // If not received within the test action timeout, quit the message loop.
148 io_loop.task_runner()->PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), 149 io_loop.task_runner()->PostDelayedTask(FROM_HERE, run_loop.QuitClosure(),
149 TestTimeouts::action_timeout()); 150 TestTimeouts::action_timeout());
150 151
151 run_loop.Run(); 152 run_loop.Run();
152 153
153 EXPECT_TRUE(packet_received) << "Failed to receive from multicast address"; 154 EXPECT_TRUE(packet_received) << "Failed to receive from multicast address";
154 } 155 }
155 156
156 } // namespace extensions 157 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698