FileDocCategorySizeDatePackage
AlbumsPlaybackStress.javaAPI DocAndroid 1.5 API3318Wed May 06 22:42:46 BST 2009com.android.music.tests.stress

AlbumsPlaybackStress

public class AlbumsPlaybackStress extends android.test.ActivityInstrumentationTestCase

Fields Summary
private android.app.Activity
browseActivity
private String[]
testing
private String
TAG
Constructors Summary
public AlbumsPlaybackStress()

  
    
      super("com.android.music",AlbumBrowserActivity.class);
  
Methods Summary
protected voidsetUp()

 
      super.setUp(); 
  
protected voidtearDown()

   
      super.tearDown();           
  
public voidtestAlbumPlay()

 
      Instrumentation inst = getInstrumentation();
      try{
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_RIGHT);
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_RIGHT);
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
        Thread.sleep(MusicPlayerNames.WAIT_LONG_TIME);
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);     
        for(int i=0; i< MusicPlayerNames.NO_ALBUMS_TOBE_PLAYED; i++){
          inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
          inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
          inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
          Thread.sleep(MusicPlayerNames.WAIT_LONG_TIME);
          inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
          inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);       
        } 
      }catch (Exception e){
          Log.v(TAG, e.toString());
      }
      inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
    
      //Verification: check if it is in low memory
      ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
      ((ActivityManager)getActivity().getSystemService("activity")).getMemoryInfo(mi);
      assertFalse(TAG, mi.lowMemory);