Java Code Examples for com.linkedin.android.testbutler.TestButler#setGsmState()

The following examples show how to use com.linkedin.android.testbutler.TestButler#setGsmState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CarretoVersionProviderTest.java    From force-update with Apache License 2.0 6 votes vote down vote up
@Test
@SdkSuppress(minSdkVersion=19)
public void loadVersionOffline() throws Exception {
    CarretoGooglePlayVersionProvider provider = new CarretoGooglePlayVersionProvider("com.vocabularyminer.android");

    TestButler.setGsmState(false);
    TestButler.setWifiState(false);

    try {
        VersionResult result = provider.getVersionResult();

        assertTrue(result.isError());
        assertNotNull(result);
        assertNull(result.getVersion());
        assertNotNull(result.getErrorMessage());
        assertNotNull(result.getErrorException());

    } finally {
        TestButler.setGsmState(true);
        TestButler.setWifiState(true);
        Thread.sleep(1000);
    }

}
 
Example 2
Source File: JsonHttpVersionProviderTest.java    From force-update with Apache License 2.0 6 votes vote down vote up
@Test
@SdkSuppress(minSdkVersion=19)
public void loadVersionOffline() throws Exception {
    JsonHttpVersionProvider provider = new JsonHttpVersionProvider("https://raw.githubusercontent.com/skoumalcz/force-update/master/force-update/src/androidTest/java/net/skoumal/forceupdate/provider/JsonHttpVersionProviderTest.DefaultAttributes.json");

    TestButler.setGsmState(false);
    TestButler.setWifiState(false);

    try {
        VersionResult result = provider.getVersionResult();

        assertTrue(result.isError());
        assertNotNull(result);
        assertNull(result.getVersion());
        assertNull(result.getPayload());
        assertNotNull(result.getErrorMessage());
        assertNotNull(result.getErrorException());

    } finally {
        TestButler.setGsmState(true);
        TestButler.setWifiState(true);
        Thread.sleep(1000);
    }

}
 
Example 3
Source File: GsmEnablerTest.java    From test-butler with Apache License 2.0 5 votes vote down vote up
private boolean disableDataTransfer() {
    //Action
    TestButler.setGsmState(false);

    //Check
    return Waiter.wait(RETRY_COUNT, new Waiter.DelayDependOnCount.SimpleLinearDelay(PAUSE), new Waiter.Predicate() {
        @Override
        public boolean compute(int tryCount) {
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
            return activeNetworkInfo == null || !activeNetworkInfo.isConnected();
        }
    });
}
 
Example 4
Source File: GsmEnablerTest.java    From test-butler with Apache License 2.0 5 votes vote down vote up
private boolean enableDataTransfer() {
    //Action
    TestButler.setGsmState(true);

    //Check
    return Waiter.wait(RETRY_COUNT, new Waiter.DelayDependOnCount.SimpleLinearDelay(PAUSE), new Waiter.Predicate() {
        @Override
        public boolean compute(int tryCount) {
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
            return activeNetworkInfo != null && activeNetworkInfo.isConnected();
        }
    });
}