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

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

Issue 655413002: Convert ARRAYSIZE_UNSAFE -> arraysize in chrome/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 (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 "extensions/browser/api/socket/udp_socket.h" 5 #include "extensions/browser/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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 static void OnCompleted(int bytes_read, 27 static void OnCompleted(int bytes_read,
28 scoped_refptr<net::IOBuffer> io_buffer, 28 scoped_refptr<net::IOBuffer> io_buffer,
29 const std::string& address, 29 const std::string& address,
30 int port) { 30 int port) {
31 // Do nothing; don't care. 31 // Do nothing; don't care.
32 } 32 }
33 33
34 static const char test_message[] = "$$TESTMESSAGETESTMESSAGETESTMESSAGETEST$$"; 34 static const char test_message[] = "$$TESTMESSAGETESTMESSAGETESTMESSAGETEST$$";
35 static const int test_message_length = ARRAYSIZE_UNSAFE(test_message); 35 static const int test_message_length = arraysize(test_message);
36 36
37 static void OnSendCompleted(int result) { 37 static void OnSendCompleted(int result) {
38 EXPECT_EQ(test_message_length, result); 38 EXPECT_EQ(test_message_length, result);
39 } 39 }
40 40
41 TEST(UDPSocketUnitTest, TestUDPSocketRecvFrom) { 41 TEST(UDPSocketUnitTest, TestUDPSocketRecvFrom) {
42 base::MessageLoopForIO io_loop; // For RecvFrom to do its threaded work. 42 base::MessageLoopForIO io_loop; // For RecvFrom to do its threaded work.
43 UDPSocket socket("abcdefghijklmnopqrst"); 43 UDPSocket socket("abcdefghijklmnopqrst");
44 44
45 // Confirm that we can call two RecvFroms in quick succession without 45 // Confirm that we can call two RecvFroms in quick succession without
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 io_loop.PostDelayedTask(FROM_HERE, 129 io_loop.PostDelayedTask(FROM_HERE,
130 base::Bind(&QuitMessageLoop), 130 base::Bind(&QuitMessageLoop),
131 TestTimeouts::action_timeout()); 131 TestTimeouts::action_timeout());
132 132
133 io_loop.Run(); 133 io_loop.Run();
134 134
135 EXPECT_TRUE(packet_received) << "Failed to receive from multicast address"; 135 EXPECT_TRUE(packet_received) << "Failed to receive from multicast address";
136 } 136 }
137 137
138 } // namespace extensions 138 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698