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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | 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 "chrome/browser/extensions/api/socket/udp_socket.h" 5 #include "chrome/browser/extensions/api/socket/udp_socket.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 static void OnCompleted(int bytes_read, 26 static void OnCompleted(int bytes_read,
27 scoped_refptr<net::IOBuffer> io_buffer, 27 scoped_refptr<net::IOBuffer> io_buffer,
28 const std::string& address, 28 const std::string& address,
29 int port) { 29 int port) {
30 // Do nothing; don't care. 30 // Do nothing; don't care.
31 } 31 }
32 32
33 TEST(UDPSocketUnitTest, TestUDPSocketRecvFrom) { 33 TEST(UDPSocketUnitTest, TestUDPSocketRecvFrom) {
34 MessageLoopForIO io_loop; // for RecvFrom to do its threaded work. 34 base::MessageLoopForIO io_loop; // for RecvFrom to do its threaded work.
35 UDPSocket socket("abcdefghijklmnopqrst"); 35 UDPSocket socket("abcdefghijklmnopqrst");
36 36
37 // Confirm that we can call two RecvFroms in quick succession without 37 // Confirm that we can call two RecvFroms in quick succession without
38 // triggering crbug.com/146606. 38 // triggering crbug.com/146606.
39 socket.Connect("127.0.0.1", 40000, base::Bind(&OnConnected)); 39 socket.Connect("127.0.0.1", 40000, base::Bind(&OnConnected));
40 socket.RecvFrom(4096, base::Bind(&OnCompleted)); 40 socket.RecvFrom(4096, base::Bind(&OnCompleted));
41 socket.RecvFrom(4096, base::Bind(&OnCompleted)); 41 socket.RecvFrom(4096, base::Bind(&OnCompleted));
42 } 42 }
43 43
44 } // namespace extensions 44 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698