Home | History | Annotate | Download | only in shadows
      1 package com.xtremelabs.robolectric.shadows;
      2 
      3 import static org.junit.Assert.assertThat;
      4 import static org.hamcrest.CoreMatchers.equalTo;
      5 import static org.hamcrest.CoreMatchers.not;
      6 
      7 import android.os.Binder;
      8 
      9 import com.xtremelabs.robolectric.WithTestDefaultsRunner;
     10 
     11 import org.junit.Test;
     12 import org.junit.runner.RunWith;
     13 
     14 @RunWith(WithTestDefaultsRunner.class)
     15 public class BinderTest {
     16 
     17     @Test
     18     public void testSetCallingPid() {
     19         ShadowBinder.setCallingPid(47);
     20 
     21         assertThat(Binder.getCallingPid(), equalTo(47));
     22     }
     23 
     24     @Test
     25     public void testCallingProcessIsJvmProcessId() {
     26         int pid = Binder.getCallingPid();
     27 
     28         assertThat(pid, not(equalTo(0)));
     29     }
     30 }
     31