Program: 181944
Project: 181944
Buggy source:
@LargeTest public void testDataConnectionWithWifiToAMToWifi(){
  assertNotNull("String_Node_Str",TEST_ACCESS_POINT);
  assertTrue("String_Node_Str" + TEST_ACCESS_POINT,cmActivity.connectToWifi(TEST_ACCESS_POINT));
  waitForNetworkState(ConnectivityManager.TYPE_WIFI,State.CONNECTED,STATE_TRANSITION_LONG_TIMEOUT);
  try {
    Thread.sleep(STATE_TRANSITION_SHORT_TIMEOUT);
  }
 catch (  Exception e) {
    Log.v(LOG_TAG,"String_Node_Str" + e.toString());
  }
  cmActivity.setAirplaneMode(getInstrumentation().getContext(),true);
  waitForNetworkState(ConnectivityManager.TYPE_WIFI,State.DISCONNECTED,STATE_TRANSITION_LONG_TIMEOUT);
  try {
    Thread.sleep(STATE_TRANSITION_SHORT_TIMEOUT);
  }
 catch (  Exception e) {
    Log.v(LOG_TAG,"String_Node_Str" + e.toString());
  }
  NetworkInfo networkInfo=cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
  cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,networkInfo.getState(),NetworkState.DO_NOTHING,State.DISCONNECTED);
  networkInfo=cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
  assertEquals(State.DISCONNECTED,networkInfo.getState());
  cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_WIFI,networkInfo.getState(),NetworkState.TO_CONNECTION,State.CONNECTED);
  cmActivity.setAirplaneMode(getInstrumentation().getContext(),false);
  waitForNetworkState(ConnectivityManager.TYPE_WIFI,State.CONNECTED,STATE_TRANSITION_LONG_TIMEOUT);
  if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_WIFI)) {
    Log.v(LOG_TAG,"String_Node_Str");
    Log.v(LOG_TAG,"String_Node_Str" + cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
    assertTrue(false);
  }
  if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
    Log.v(LOG_TAG,"String_Node_Str");
    Log.v(LOG_TAG,"String_Node_Str" + cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_MOBILE));
    assertTrue(false);
  }
}

Fixed version (ground truth):
@LargeTest public void testDataConnectionWithWifiToAMToWifi(){
  assertNotNull("String_Node_Str",TEST_ACCESS_POINT);
  assertTrue("String_Node_Str" + TEST_ACCESS_POINT,cmActivity.connectToWifi(TEST_ACCESS_POINT));
  waitForNetworkState(ConnectivityManager.TYPE_WIFI,State.CONNECTED,STATE_TRANSITION_LONG_TIMEOUT);
  try {
    Thread.sleep(STATE_TRANSITION_SHORT_TIMEOUT);
  }
 catch (  Exception e) {
    Log.v(LOG_TAG,"String_Node_Str" + e.toString());
  }
  cmActivity.setAirplaneMode(getInstrumentation().getContext(),true);
  waitForNetworkState(ConnectivityManager.TYPE_WIFI,State.DISCONNECTED,STATE_TRANSITION_LONG_TIMEOUT);
  try {
    Thread.sleep(STATE_TRANSITION_SHORT_TIMEOUT);
  }
 catch (  Exception e) {
    Log.v(LOG_TAG,"String_Node_Str" + e.toString());
  }
  NetworkInfo networkInfo=cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
  assertEquals(State.DISCONNECTED,networkInfo.getState());
  cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_WIFI,networkInfo.getState(),NetworkState.TO_CONNECTION,State.CONNECTED);
  cmActivity.setAirplaneMode(getInstrumentation().getContext(),false);
  waitForNetworkState(ConnectivityManager.TYPE_WIFI,State.CONNECTED,STATE_TRANSITION_LONG_TIMEOUT);
  waitForNetworkState(ConnectivityManager.TYPE_MOBILE,State.DISCONNECTED,STATE_TRANSITION_LONG_TIMEOUT);
  if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_WIFI)) {
    Log.v(LOG_TAG,"String_Node_Str");
    Log.v(LOG_TAG,"String_Node_Str" + cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
    assertTrue(false);
  }
}