Code example for Instrumentation

Methods: addMonitorsendKeyDownUpSyncwaitForIdleSync

0
				public void run() {         
					mActivity.setSelection(position);
				} 
			}	    	 
		); 
		mInst.sendKeyDownUpSync(KeyEvent.KEYCODE_ENTER);
		mInst.waitForIdleSync();
 
         
    } 
 
    public void testCase01_activityDisplay() { 
        assertTrue(mActivity!= null);
        assertTrue(mLanguage!= null);
        assertTrue(mInputSwitch != null);            
        assertTrue(mKeyboardSetting != null);
    } 
 
    public void testCase02_LanguageDisplay(){ 
        assertTrue(mLanguage!= null);
   	   	ActivityMonitor monitor = 
    		mInst.addMonitor("com.android.settings.LocalePicker", null, false);
            	 
       /* 
        * Launch Language activity. 
    	*/ 
        Log.i(TAG, "testCase02_LanguageDisplay order : " + mLanguage.getOrder() );
        pressPreferenceItem( mLanguage.getOrder() );
         
        mLocalePicker = (com.android.settings.LocalePicker)monitor.waitForActivityWithTimeout(2000);
        assertTrue(mLocalePicker != null);
        mLocalePicker.finish();
        /* 
                * Here we donot test any more since if we change the locale, activity will be re-create and the 
                * references of the components will be invalid and test cannot goes on. 
                * So ignore further tests here.... 
                */ 
         
         
         
    } 
 
    public void testCase03_UserDict(){ 
   	   	ActivityMonitor monitor = 
    		mInst.addMonitor("com.android.settings.UserDictionarySettings", null, false);        
        /* 
         * Launch  user dict activity. 
        */ 
        pressPreferenceItem(USER_DICT_ORDER);