use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class CursorWindowTest method testDeprecatedConstructor.
@SmallTest
public void testDeprecatedConstructor() {
@SuppressWarnings("deprecation") CursorWindow window = new CursorWindow(true);
assertEquals("<unnamed>", window.getName());
assertEquals(0, window.getStartPosition());
window.close();
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class CursorWindowTest method testConstructorWithNullName.
@SmallTest
public void testConstructorWithNullName() {
CursorWindow window = new CursorWindow(null);
assertEquals("<unnamed>", window.getName());
assertEquals(0, window.getStartPosition());
window.close();
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class RouteInfoTest method testConstructor.
@SmallTest
public void testConstructor() {
RouteInfo r;
// Invalid input.
try {
r = new RouteInfo(null, null, "rmnet0");
fail("Expected RuntimeException: destination and gateway null");
} catch (RuntimeException e) {
}
// Null destination is default route.
r = new RouteInfo(null, Address("2001:db8::1"), null);
assertEquals(Prefix("::/0"), r.getDestination());
assertEquals(Address("2001:db8::1"), r.getGateway());
assertNull(r.getInterface());
r = new RouteInfo(null, Address("192.0.2.1"), "wlan0");
assertEquals(Prefix("0.0.0.0/0"), r.getDestination());
assertEquals(Address("192.0.2.1"), r.getGateway());
assertEquals("wlan0", r.getInterface());
// Null gateway sets gateway to unspecified address (why?).
r = new RouteInfo(Prefix("2001:db8:beef:cafe::/48"), null, "lo");
assertEquals(Prefix("2001:db8:beef::/48"), r.getDestination());
assertEquals(Address("::"), r.getGateway());
assertEquals("lo", r.getInterface());
r = new RouteInfo(Prefix("192.0.2.5/24"), null);
assertEquals(Prefix("192.0.2.0/24"), r.getDestination());
assertEquals(Address("0.0.0.0"), r.getGateway());
assertNull(r.getInterface());
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class UriMatcherTest method testContentUris.
@SmallTest
public void testContentUris() {
UriMatcher matcher = new UriMatcher(ROOT);
matcher.addURI("people", null, PEOPLE);
matcher.addURI("people", "#", PEOPLE_ID);
matcher.addURI("people", "#/phones", PEOPLE_PHONES);
matcher.addURI("people", "#/phones/blah", PEOPLE_PHONES_ID);
matcher.addURI("people", "#/phones/#", PEOPLE_PHONES_ID);
matcher.addURI("people", "#/addresses", PEOPLE_ADDRESSES);
matcher.addURI("people", "#/addresses/#", PEOPLE_ADDRESSES_ID);
matcher.addURI("people", "#/contact-methods", PEOPLE_CONTACTMETH);
matcher.addURI("people", "#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
matcher.addURI("calls", null, CALLS);
matcher.addURI("calls", "#", CALLS_ID);
matcher.addURI("caller-id", null, CALLERID);
matcher.addURI("caller-id", "*", CALLERID_TEXT);
matcher.addURI("filter-recent", null, FILTERRECENT);
matcher.addURI("auth", "another/path/segment", ANOTHER_PATH_SEGMENT);
checkAll(matcher);
}
use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.
the class LinkPropertiesTest method testRouteInterfaces.
@SmallTest
public void testRouteInterfaces() {
LinkAddress prefix = new LinkAddress(NetworkUtils.numericToInetAddress("2001:db8::"), 32);
InetAddress address = NetworkUtils.numericToInetAddress(ADDRV6);
// Add a route with no interface to a LinkProperties with no interface. No errors.
LinkProperties lp = new LinkProperties();
RouteInfo r = new RouteInfo(prefix, address, null);
lp.addRoute(r);
assertEquals(1, lp.getRoutes().size());
assertAllRoutesHaveInterface(null, lp);
// Add a route with an interface. Except an exception.
r = new RouteInfo(prefix, address, "wlan0");
try {
lp.addRoute(r);
fail("Adding wlan0 route to LP with no interface, expect exception");
} catch (IllegalArgumentException expected) {
}
// Change the interface name. All the routes should change their interface name too.
lp.setInterfaceName("rmnet0");
assertAllRoutesHaveInterface("rmnet0", lp);
// Now add a route with the wrong interface. This causes an exception too.
try {
lp.addRoute(r);
fail("Adding wlan0 route to rmnet0 LP, expect exception");
} catch (IllegalArgumentException expected) {
}
// If the interface name matches, the route is added.
lp.setInterfaceName("wlan0");
lp.addRoute(r);
assertEquals(2, lp.getRoutes().size());
assertAllRoutesHaveInterface("wlan0", lp);
// Routes with null interfaces are converted to wlan0.
r = RouteInfo.makeHostRoute(NetworkUtils.numericToInetAddress(ADDRV6), null);
lp.addRoute(r);
assertEquals(3, lp.getRoutes().size());
assertAllRoutesHaveInterface("wlan0", lp);
// Check comparisons work.
LinkProperties lp2 = new LinkProperties(lp);
assertAllRoutesHaveInterface("wlan0", lp);
assertEquals(0, lp.compareRoutes(lp2).added.size());
assertEquals(0, lp.compareRoutes(lp2).removed.size());
lp2.setInterfaceName("p2p0");
assertAllRoutesHaveInterface("p2p0", lp2);
assertEquals(3, lp.compareRoutes(lp2).added.size());
assertEquals(3, lp.compareRoutes(lp2).removed.size());
}
Aggregations