am 2fed6caf: Merge "Libcore.os has moved to android.system.Os."
* commit '2fed6caf1a2fda1783116b9c3749d4e365fdd787': Libcore.os has moved to android.system.Os.
This commit is contained in:
@@ -19,10 +19,10 @@ package android.net.ipv6.cts;
|
|||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import libcore.io.ErrnoException;
|
import android.system.ErrnoException;
|
||||||
import libcore.io.Libcore;
|
import android.system.Os;
|
||||||
import libcore.io.StructTimeval;
|
import android.system.StructTimeval;
|
||||||
import static libcore.io.OsConstants.*;
|
import static android.system.OsConstants.*;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -84,8 +84,8 @@ public class PingTest extends AndroidTestCase {
|
|||||||
* Creates an IPv6 ping socket and sets a receive timeout of 100ms.
|
* Creates an IPv6 ping socket and sets a receive timeout of 100ms.
|
||||||
*/
|
*/
|
||||||
private FileDescriptor createPingSocket() throws ErrnoException {
|
private FileDescriptor createPingSocket() throws ErrnoException {
|
||||||
FileDescriptor s = Libcore.os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
|
FileDescriptor s = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
|
||||||
Libcore.os.setsockoptTimeval(s, SOL_SOCKET, SO_RCVTIMEO, StructTimeval.fromMillis(100));
|
Os.setsockoptTimeval(s, SOL_SOCKET, SO_RCVTIMEO, StructTimeval.fromMillis(100));
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ public class PingTest extends AndroidTestCase {
|
|||||||
int port = (int) (Math.random() * 2048);
|
int port = (int) (Math.random() * 2048);
|
||||||
|
|
||||||
// Send the packet.
|
// Send the packet.
|
||||||
int ret = Libcore.os.sendto(s, ByteBuffer.wrap(packet), 0, address, port);
|
int ret = Os.sendto(s, ByteBuffer.wrap(packet), 0, address, port);
|
||||||
assertEquals(packet.length, ret);
|
assertEquals(packet.length, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ public class PingTest extends AndroidTestCase {
|
|||||||
// Receive the response.
|
// Receive the response.
|
||||||
if (useRecvfrom) {
|
if (useRecvfrom) {
|
||||||
InetSocketAddress from = new InetSocketAddress();
|
InetSocketAddress from = new InetSocketAddress();
|
||||||
bytesRead = Libcore.os.recvfrom(s, responseBuffer, 0, from);
|
bytesRead = Os.recvfrom(s, responseBuffer, 0, from);
|
||||||
|
|
||||||
// Check the source address and scope ID.
|
// Check the source address and scope ID.
|
||||||
assertTrue(from.getAddress() instanceof Inet6Address);
|
assertTrue(from.getAddress() instanceof Inet6Address);
|
||||||
@@ -122,7 +122,7 @@ public class PingTest extends AndroidTestCase {
|
|||||||
assertNull(fromAddress.getScopedInterface());
|
assertNull(fromAddress.getScopedInterface());
|
||||||
assertEquals(dest.getHostAddress(), fromAddress.getHostAddress());
|
assertEquals(dest.getHostAddress(), fromAddress.getHostAddress());
|
||||||
} else {
|
} else {
|
||||||
bytesRead = Libcore.os.read(s, responseBuffer);
|
bytesRead = Os.read(s, responseBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the packet length.
|
// Check the packet length.
|
||||||
@@ -134,7 +134,7 @@ public class PingTest extends AndroidTestCase {
|
|||||||
assertEquals((byte) 0x81, response[0]);
|
assertEquals((byte) 0x81, response[0]);
|
||||||
|
|
||||||
// Find out what ICMP ID was used in the packet that was sent.
|
// Find out what ICMP ID was used in the packet that was sent.
|
||||||
int id = ((InetSocketAddress) Libcore.os.getsockname(s)).getPort();
|
int id = ((InetSocketAddress) Os.getsockname(s)).getPort();
|
||||||
sent[4] = (byte) (id / 256);
|
sent[4] = (byte) (id / 256);
|
||||||
sent[5] = (byte) (id % 256);
|
sent[5] = (byte) (id % 256);
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ public class PingTest extends AndroidTestCase {
|
|||||||
sendPing(s, ipv6Loopback, packet);
|
sendPing(s, ipv6Loopback, packet);
|
||||||
checkResponse(s, ipv6Loopback, packet, false);
|
checkResponse(s, ipv6Loopback, packet, false);
|
||||||
// Check closing the socket doesn't raise an exception.
|
// Check closing the socket doesn't raise an exception.
|
||||||
Libcore.os.close(s);
|
Os.close(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user