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

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: Rebase. Created 8 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 | 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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 message_loop_.RunAllPending(); 1067 message_loop_.RunAllPending();
1068 1068
1069 ExpectNoSignal(); 1069 ExpectNoSignal();
1070 1070
1071 DoSSLCloseOpenedNoError(); 1071 DoSSLCloseOpenedNoError();
1072 } 1072 }
1073 1073
1074 } // namespace 1074 } // namespace
1075 1075
1076 } // namespace notifier 1076 } // namespace notifier
OLDNEW
« no previous file with comments | « crypto/symmetric_key_win.cc ('k') | native_client_sdk/src/build_tools/debug_server/debug_stub/transport_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698