Skip to content
Snippets Groups Projects
Commit cdb134c0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add additional mocking for Context innards" into oc-dr1-dev

parents cacf1981 f3a08b44
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.res.Resources;
import android.hardware.usb.UsbManager;
import android.net.ConnectivityManager;
......@@ -85,6 +86,7 @@ import java.util.Vector;
public class TetheringTest {
private static final String[] PROVISIONING_APP_NAME = {"some", "app"};
@Mock private ApplicationInfo mApplicationInfo;
@Mock private Context mContext;
@Mock private ConnectivityManager mConnectivityManager;
@Mock private INetworkManagementService mNMService;
......@@ -115,6 +117,9 @@ public class TetheringTest {
super(base);
}
@Override
public ApplicationInfo getApplicationInfo() { return mApplicationInfo; }
@Override
public ContentResolver getContentResolver() { return mContentResolver; }
......
......@@ -30,6 +30,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.RouteInfo;
......@@ -59,15 +60,17 @@ import org.mockito.MockitoAnnotations;
public class OffloadControllerTest {
@Mock private OffloadHardwareInterface mHardware;
@Mock private ApplicationInfo mApplicationInfo;
@Mock private Context mContext;
final ArgumentCaptor<ArrayList> mStringArrayCaptor = ArgumentCaptor.forClass(ArrayList.class);
private MockContentResolver mContentResolver;
@Before public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(mContext.getApplicationInfo()).thenReturn(mApplicationInfo);
when(mContext.getPackageName()).thenReturn("OffloadControllerTest");
mContentResolver = new MockContentResolver(mContext);
mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
when(mContext.getPackageName()).thenReturn("OffloadControllerTest");
when(mContext.getContentResolver()).thenReturn(mContentResolver);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment