Fix bug 2056252: android.test.AndroidTestRunnerTest:testRunTestWithNullListener is failing

- Verify mInstrumentation is not null before calling getContext()
This commit is contained in:
Jack Wang
2009-08-17 14:19:52 -07:00
parent 0ef135d5c7
commit a8db0a4ff6

View File

@@ -158,7 +158,7 @@ public class AndroidTestRunner extends BaseTestRunner {
mTestResult.addListener(testListener);
}
Context testContext = mInstrumentation.getContext();
Context testContext = mInstrumentation == null ? mContext : mInstrumentation.getContext();
for (TestCase testCase : mTestCases) {
setContextIfAndroidTestCase(testCase, mContext, testContext);
setInstrumentationIfInstrumentationTestCase(testCase, mInstrumentation);