Merge change 22109 into eclair

* changes:
  Fix bug 1546445: Correct spelling errors in API - InstrumentationTestCase.injectInsrumentation - AndroidTestRunner.setInstrumentaiton
This commit is contained in:
Android (Google) Code Review
2009-08-25 12:47:11 -07:00
5 changed files with 54 additions and 5 deletions

View File

@@ -118540,6 +118540,19 @@
>
</constructor>
<method name="addTestListener"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="deprecated"
visibility="public"
>
<parameter name="instrumentation" type="android.app.Instrumentation">
</parameter>
</method>
<method name="setInstrumentation"
return="void"
abstract="false"
native="false"
@@ -118789,6 +118802,19 @@
synchronized="false"
static="false"
final="false"
deprecated="deprecated"
visibility="public"
>
<parameter name="instrumentation" type="android.app.Instrumentation">
</parameter>
</method>
<method name="injectInstrumentation"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>

View File

@@ -43,10 +43,24 @@ public class InstrumentationTestCase extends TestCase {
*
* @param instrumentation the instrumentation to use with this instance
*/
public void injectInsrumentation(Instrumentation instrumentation) {
public void injectInstrumentation(Instrumentation instrumentation) {
mInstrumentation = instrumentation;
}
/**
* Injects instrumentation into this test case. This method is
* called by the test runner during test setup.
*
* @param instrumentation the instrumentation to use with this instance
*
* @deprecated Incorrect spelling,
* use {@link #injectInstrumentation(android.app.Instrumentation) instead.
*/
@Deprecated
public void injectInsrumentation(Instrumentation instrumentation) {
injectInstrumentation(instrumentation);
}
/**
* Inheritors can access the instrumentation using this.
* @return instrumentation

View File

@@ -65,7 +65,7 @@ public class InstrumentationTestSuite extends TestSuite {
public void runTest(Test test, TestResult result) {
if (test instanceof InstrumentationTestCase) {
((InstrumentationTestCase) test).injectInsrumentation(mInstrumentation);
((InstrumentationTestCase) test).injectInstrumentation(mInstrumentation);
}
// run the test as usual

View File

@@ -180,14 +180,23 @@ public class AndroidTestRunner extends BaseTestRunner {
private void setInstrumentationIfInstrumentationTestCase(
Test test, Instrumentation instrumentation) {
if (InstrumentationTestCase.class.isAssignableFrom(test.getClass())) {
((InstrumentationTestCase) test).injectInsrumentation(instrumentation);
((InstrumentationTestCase) test).injectInstrumentation(instrumentation);
}
}
public void setInstrumentaiton(Instrumentation instrumentation) {
public void setInstrumentation(Instrumentation instrumentation) {
mInstrumentation = instrumentation;
}
/**
* @deprecated Incorrect spelling,
* use {@link #setInstrumentation(android.app.Instrumentation)} instead.
*/
@Deprecated
public void setInstrumentaiton(Instrumentation instrumentation) {
setInstrumentation(instrumentation);
}
@Override
protected Class loadSuiteClass(String suiteClassName) throws ClassNotFoundException {
return mContext.getClassLoader().loadClass(suiteClassName);

View File

@@ -329,7 +329,7 @@ public class InstrumentationTestRunner extends Instrumentation implements TestSu
mTestRunner = getAndroidTestRunner();
mTestRunner.setContext(getTargetContext());
mTestRunner.setInstrumentaiton(this);
mTestRunner.setInstrumentation(this);
mTestRunner.setSkipExecution(logOnly);
mTestRunner.setTest(testSuiteBuilder.build());
mTestCount = mTestRunner.getTestCases().size();