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

Side by Side Diff: jingle/notifier/base/chrome_async_socket_unittest.cc

Issue 9716020: Add base::HostToNetXX() & NetToHostXX(), and use them to replace htonX() & ntohX() in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch a few remaining call-sites. Created 8 years, 9 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 "jingle/notifier/base/chrome_async_socket.h" 5 #include "jingle/notifier/base/chrome_async_socket.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bool has_pending_read_; 94 bool has_pending_read_;
95 95
96 std::deque<net::MockWrite> writes_; 96 std::deque<net::MockWrite> writes_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(AsyncSocketDataProvider); 98 DISALLOW_COPY_AND_ASSIGN(AsyncSocketDataProvider);
99 }; 99 };
100 100
101 // Takes a 32-bit integer in host byte order and converts it to a 101 // Takes a 32-bit integer in host byte order and converts it to a
102 // net::IPAddressNumber. 102 // net::IPAddressNumber.
103 net::IPAddressNumber Uint32ToIPAddressNumber(uint32 ip) { 103 net::IPAddressNumber Uint32ToIPAddressNumber(uint32 ip) {
104 uint32 ip_nbo = htonl(ip); 104 uint32 ip_nbo = base::HostToNet32(ip);
105 const unsigned char* const ip_start = 105 const unsigned char* const ip_start =
106 reinterpret_cast<const unsigned char*>(&ip_nbo); 106 reinterpret_cast<const unsigned char*>(&ip_nbo);
107 return net::IPAddressNumber(ip_start, ip_start + (sizeof ip_nbo)); 107 return net::IPAddressNumber(ip_start, ip_start + (sizeof ip_nbo));
108 } 108 }
109 109
110 net::AddressList SocketAddressToAddressList( 110 net::AddressList SocketAddressToAddressList(
111 const talk_base::SocketAddress& address) { 111 const talk_base::SocketAddress& address) {
112 DCHECK_NE(address.ip(), 0U); 112 DCHECK_NE(address.ip(), 0U);
113 return net::AddressList::CreateFromIPAddress( 113 return net::AddressList::CreateFromIPAddress(
114 Uint32ToIPAddressNumber(address.ip()), address.port()); 114 Uint32ToIPAddressNumber(address.ip()), address.port());
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 message_loop_.RunAllPending(); 1066 message_loop_.RunAllPending();
1067 1067
1068 ExpectNoSignal(); 1068 ExpectNoSignal();
1069 1069
1070 DoSSLCloseOpenedNoError(); 1070 DoSSLCloseOpenedNoError();
1071 } 1071 }
1072 1072
1073 } // namespace 1073 } // namespace
1074 1074
1075 } // namespace notifier 1075 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698