Hi

I'm sure in my instrumentation testing (DialtactaActivityTest, which
is under com.android.contacts.tests) defines the instrumentation in
AndroidMaifest.xml.

<manifest xmlns:android="http://schemas.android.com/apk/res/android";

    package="com.android.contacts.tests"
android:sharedUserId="android.uid.shared">



    <application>

        <uses-library android:name="android.test.runner" />

    </application>



    <instrumentation

    android:name="android.test.InstrumentationTestRunner"

    android:targetPackage="com.android.contacts"

    android:label="DialtactsActivityTest">

    </instrumentation>



However, Instrumentation.java is called when DialtactaActivity is
running, and check whether the process name and package name are
equal.

By adding log, the log shows "android.process.acore" equal
"com.android.contacts". I am wondering is there any way to avoid it?



BRs

Angela


On 4月4日, 上午2時14分, Dianne Hackborn <[email protected]> wrote:
> You can't do this.  The whole point of this check is that if you aren't
> running in the same process as the activity you are starting, well the other
> activity won't be running in your process so you can't get an Activity
> object for it or do much of anything with it.
>
> If you want to test a particular activity, your instrumentation needs to be
> signed with the same certificate as the target activity's .apk and declare
> that it is instrumenting that .apk.
>
> 2009/4/3 [email protected] <[email protected]>
>
>
>
>
>
>
>
> > Following is the code for equal checking:
>
> > In Instrumentation.java, startActivitySync function,
>
> > public Activity startActivitySync(Intent intent) {
>
> > ...
>
> > if (!ai.applicationInfo.processName.equals(
>
> >    getTargetContext().getPackageName())) {
>
> >    // todo: if this intent is ambiguous, look here to see if
>
> >    // there is a single match that is in our package.
>
> >    throw new RuntimeException("Intent resolved to different package "
>
> >                                + ai.applicationInfo.packageName + ":
> > "
>
> >                                + intent);
> >     }
>
> > }
>
> > On 4月3日, 下午2時00分, "[email protected]" <[email protected]> wrote:
> > > Hi all,
>
> > > I'd like to do the instrumentation testing for DialtactaActivity,
> > > however, before running the instrumentation, it will check whether the
> > > process name and packages name are equal.
>
> > > Unfortunately, the process name and packages name of DialtactsActivity
> > > are different and result fail in running.
>
> > > Is there any way to make the process work?
>
> > > BRs
> > > Angela
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.- 隱藏被引用文字 -
>
> - 顯示被引用文字 -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to