[android-developers] Re: Testing with Activity Monitor

2011-04-11 Thread Brian Phagan
The Dialer activity is not blocked, it is allowed to launch.  Also,
the assertEquals(1, monitor.getHits()) fails with a value of 0.

On Apr 11, 6:27 pm, Dianne Hackborn hack...@android.com wrote:
 What is the error you are getting?









 On Mon, Apr 11, 2011 at 1:30 PM, Brian Phagan phagan@gmail.com wrote:
  I am trying to write unit tests for my application.  I have a button
  that initiates a call, and to test it I am trying to use an Activity
  Monitor to block the call, but for some reason the call is allowed to
  execute, causing the test to fail.  My test case is written as
  follows:

  public void test2Launches() {
                 Instrumentation instr = getInstrumentation();
                 IntentFilter callFilter = new
  IntentFilter(Intent.ACTION_CALL);
                 Instrumentation.ActivityMonitor monitor =
  instr.addMonitor(callFilter, null, true);
                 mActivity.runOnUiThread(
                                 new Runnable() {

                                         public void run() {
                                                 mCallButton.requestFocus();

                                         }
                                 }
                 );
                 this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
                 assertEquals(1, monitor.getHits());
         }

  Any help on why this isn't working would be appreciated.

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 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 Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Testing with Activity Monitor

2011-04-11 Thread Dianne Hackborn
Your intent filter also needs to handle CATEGORY_DEFAULT.  This should be
the exact same thing you would put in the manifest to handle an intent.

On Mon, Apr 11, 2011 at 4:43 PM, Brian Phagan phagan@gmail.com wrote:

 The Dialer activity is not blocked, it is allowed to launch.  Also,
 the assertEquals(1, monitor.getHits()) fails with a value of 0.

 On Apr 11, 6:27 pm, Dianne Hackborn hack...@android.com wrote:
  What is the error you are getting?
 
 
 
 
 
 
 
 
 
  On Mon, Apr 11, 2011 at 1:30 PM, Brian Phagan phagan@gmail.com
 wrote:
   I am trying to write unit tests for my application.  I have a button
   that initiates a call, and to test it I am trying to use an Activity
   Monitor to block the call, but for some reason the call is allowed to
   execute, causing the test to fail.  My test case is written as
   follows:
 
   public void test2Launches() {
  Instrumentation instr = getInstrumentation();
  IntentFilter callFilter = new
   IntentFilter(Intent.ACTION_CALL);
  Instrumentation.ActivityMonitor monitor =
   instr.addMonitor(callFilter, null, true);
  mActivity.runOnUiThread(
  new Runnable() {
 
  public void run() {
  
  mCallButton.requestFocus();
 
  }
  }
  );
  this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
  assertEquals(1, monitor.getHits());
  }
 
   Any help on why this isn't working would be appreciated.
 
   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  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 Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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 Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Testing with Activity Monitor

2011-04-11 Thread Brian Phagan
I have added the category to the intent filter, but still no luck.
Code now looks like this:

public void test2Launches() {
Instrumentation instr = getInstrumentation();
IntentFilter callFilter = new IntentFilter(Intent.ACTION_CALL);
callFilter.addCategory(Intent.CATEGORY_DEFAULT);
Instrumentation.ActivityMonitor monitor =
instr.addMonitor(callFilter, null, true);
assertNotNull(mCallButton);
mActivity.runOnUiThread(
new Runnable() {

public void run() {
mCallButton.requestFocus();

}
}
);
this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals(1, monitor.getHits());
}

On Apr 11, 6:50 pm, Dianne Hackborn hack...@android.com wrote:
 Your intent filter also needs to handle CATEGORY_DEFAULT.  This should be
 the exact same thing you would put in the manifest to handle an intent.









 On Mon, Apr 11, 2011 at 4:43 PM, Brian Phagan phagan@gmail.com wrote:
  The Dialer activity is not blocked, it is allowed to launch.  Also,
  the assertEquals(1, monitor.getHits()) fails with a value of 0.

  On Apr 11, 6:27 pm, Dianne Hackborn hack...@android.com wrote:
   What is the error you are getting?

   On Mon, Apr 11, 2011 at 1:30 PM, Brian Phagan phagan@gmail.com
  wrote:
I am trying to write unit tests for my application.  I have a button
that initiates a call, and to test it I am trying to use an Activity
Monitor to block the call, but for some reason the call is allowed to
execute, causing the test to fail.  My test case is written as
follows:

public void test2Launches() {
               Instrumentation instr = getInstrumentation();
               IntentFilter callFilter = new
IntentFilter(Intent.ACTION_CALL);
               Instrumentation.ActivityMonitor monitor =
instr.addMonitor(callFilter, null, true);
               mActivity.runOnUiThread(
                               new Runnable() {

                                       public void run() {

   mCallButton.requestFocus();

                                       }
                               }
               );
               this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
               assertEquals(1, monitor.getHits());
       }

Any help on why this isn't working would be appreciated.

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to
  android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

   --
   Dianne Hackborn
   Android framework engineer
   hack...@android.com

   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 Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 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 Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Testing with Activity Monitor

2011-04-11 Thread Dianne Hackborn
What do you see in the log as the actual intent being started?

On Mon, Apr 11, 2011 at 5:24 PM, Brian Phagan phagan@gmail.com wrote:

 I have added the category to the intent filter, but still no luck.
 Code now looks like this:

 public void test2Launches() {
Instrumentation instr = getInstrumentation();
IntentFilter callFilter = new
 IntentFilter(Intent.ACTION_CALL);
 callFilter.addCategory(Intent.CATEGORY_DEFAULT);
 Instrumentation.ActivityMonitor monitor =
 instr.addMonitor(callFilter, null, true);
 assertNotNull(mCallButton);
 mActivity.runOnUiThread(
new Runnable() {

public void run() {
mCallButton.requestFocus();

}
}
);
this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals(1, monitor.getHits());
}

 On Apr 11, 6:50 pm, Dianne Hackborn hack...@android.com wrote:
  Your intent filter also needs to handle CATEGORY_DEFAULT.  This should be
  the exact same thing you would put in the manifest to handle an intent.
 
 
 
 
 
 
 
 
 
  On Mon, Apr 11, 2011 at 4:43 PM, Brian Phagan phagan@gmail.com
 wrote:
   The Dialer activity is not blocked, it is allowed to launch.  Also,
   the assertEquals(1, monitor.getHits()) fails with a value of 0.
 
   On Apr 11, 6:27 pm, Dianne Hackborn hack...@android.com wrote:
What is the error you are getting?
 
On Mon, Apr 11, 2011 at 1:30 PM, Brian Phagan phagan@gmail.com
   wrote:
 I am trying to write unit tests for my application.  I have a
 button
 that initiates a call, and to test it I am trying to use an
 Activity
 Monitor to block the call, but for some reason the call is allowed
 to
 execute, causing the test to fail.  My test case is written as
 follows:
 
 public void test2Launches() {
Instrumentation instr = getInstrumentation();
IntentFilter callFilter = new
 IntentFilter(Intent.ACTION_CALL);
Instrumentation.ActivityMonitor monitor =
 instr.addMonitor(callFilter, null, true);
mActivity.runOnUiThread(
new Runnable() {
 
public void run() {
 
mCallButton.requestFocus();
 
}
}
);
this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
assertEquals(1, monitor.getHits());
}
 
 Any help on why this isn't working would be appreciated.
 
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
   android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
 
--
Dianne Hackborn
Android framework engineer
hack...@android.com
 
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 Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  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 Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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 

[android-developers] Re: Testing with Activity Monitor

2011-04-11 Thread Brian Phagan
04-12 00:38:32.894: INFO/ActivityManager(59): Starting activity:
Intent { act=android.intent.action.CALL dat=tel:5733415688
cmp=com.android.phone/.OutgoingCallBroadcaster }


On Apr 11, 7:28 pm, Dianne Hackborn hack...@android.com wrote:
 What do you see in the log as the actual intent being started?









 On Mon, Apr 11, 2011 at 5:24 PM, Brian Phagan phagan@gmail.com wrote:
  I have added the category to the intent filter, but still no luck.
  Code now looks like this:

  public void test2Launches() {
                 Instrumentation instr = getInstrumentation();
                 IntentFilter callFilter = new
  IntentFilter(Intent.ACTION_CALL);
                  callFilter.addCategory(Intent.CATEGORY_DEFAULT);
                  Instrumentation.ActivityMonitor monitor =
  instr.addMonitor(callFilter, null, true);
                  assertNotNull(mCallButton);
                  mActivity.runOnUiThread(
                                 new Runnable() {

                                         public void run() {
                                                 mCallButton.requestFocus();

                                         }
                                 }
                 );
                 this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
                 assertEquals(1, monitor.getHits());
         }

  On Apr 11, 6:50 pm, Dianne Hackborn hack...@android.com wrote:
   Your intent filter also needs to handle CATEGORY_DEFAULT.  This should be
   the exact same thing you would put in the manifest to handle an intent.

   On Mon, Apr 11, 2011 at 4:43 PM, Brian Phagan phagan@gmail.com
  wrote:
The Dialer activity is not blocked, it is allowed to launch.  Also,
the assertEquals(1, monitor.getHits()) fails with a value of 0.

On Apr 11, 6:27 pm, Dianne Hackborn hack...@android.com wrote:
 What is the error you are getting?

 On Mon, Apr 11, 2011 at 1:30 PM, Brian Phagan phagan@gmail.com
wrote:
  I am trying to write unit tests for my application.  I have a
  button
  that initiates a call, and to test it I am trying to use an
  Activity
  Monitor to block the call, but for some reason the call is allowed
  to
  execute, causing the test to fail.  My test case is written as
  follows:

  public void test2Launches() {
                 Instrumentation instr = getInstrumentation();
                 IntentFilter callFilter = new
  IntentFilter(Intent.ACTION_CALL);
                 Instrumentation.ActivityMonitor monitor =
  instr.addMonitor(callFilter, null, true);
                 mActivity.runOnUiThread(
                                 new Runnable() {

                                         public void run() {

 mCallButton.requestFocus();

                                         }
                                 }
                 );
                 this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
                 assertEquals(1, monitor.getHits());
         }

  Any help on why this isn't working would be appreciated.

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to
android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 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 Developers group.
To post to this group, send email to
  android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

   --
   Dianne Hackborn
   Android framework engineer
   hack...@android.com

   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 Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 

Re: [android-developers] Re: Testing with Activity Monitor

2011-04-11 Thread Dianne Hackborn
So that's the intent you need to intercept -- CALL and the tel: scheme.
 Also of course the DEFAULT category.

On Mon, Apr 11, 2011 at 5:41 PM, Brian Phagan phagan@gmail.com wrote:

 04-12 00:38:32.894: INFO/ActivityManager(59): Starting activity:
 Intent { act=android.intent.action.CALL dat=tel:5733415688
 cmp=com.android.phone/.OutgoingCallBroadcaster }


 On Apr 11, 7:28 pm, Dianne Hackborn hack...@android.com wrote:
  What do you see in the log as the actual intent being started?
 
 
 
 
 
 
 
 
 
  On Mon, Apr 11, 2011 at 5:24 PM, Brian Phagan phagan@gmail.com
 wrote:
   I have added the category to the intent filter, but still no luck.
   Code now looks like this:
 
   public void test2Launches() {
  Instrumentation instr = getInstrumentation();
  IntentFilter callFilter = new
   IntentFilter(Intent.ACTION_CALL);
   callFilter.addCategory(Intent.CATEGORY_DEFAULT);
   Instrumentation.ActivityMonitor monitor =
   instr.addMonitor(callFilter, null, true);
   assertNotNull(mCallButton);
   mActivity.runOnUiThread(
  new Runnable() {
 
  public void run() {
  
  mCallButton.requestFocus();
 
  }
  }
  );
  this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
  assertEquals(1, monitor.getHits());
  }
 
   On Apr 11, 6:50 pm, Dianne Hackborn hack...@android.com wrote:
Your intent filter also needs to handle CATEGORY_DEFAULT.  This
 should be
the exact same thing you would put in the manifest to handle an
 intent.
 
On Mon, Apr 11, 2011 at 4:43 PM, Brian Phagan phagan@gmail.com
   wrote:
 The Dialer activity is not blocked, it is allowed to launch.  Also,
 the assertEquals(1, monitor.getHits()) fails with a value of 0.
 
 On Apr 11, 6:27 pm, Dianne Hackborn hack...@android.com wrote:
  What is the error you are getting?
 
  On Mon, Apr 11, 2011 at 1:30 PM, Brian Phagan 
 phagan@gmail.com
 wrote:
   I am trying to write unit tests for my application.  I have a
   button
   that initiates a call, and to test it I am trying to use an
   Activity
   Monitor to block the call, but for some reason the call is
 allowed
   to
   execute, causing the test to fail.  My test case is written as
   follows:
 
   public void test2Launches() {
  Instrumentation instr = getInstrumentation();
  IntentFilter callFilter = new
   IntentFilter(Intent.ACTION_CALL);
  Instrumentation.ActivityMonitor monitor =
   instr.addMonitor(callFilter, null, true);
  mActivity.runOnUiThread(
  new Runnable() {
 
  public void run() {
 
  mCallButton.requestFocus();
 
  }
  }
  );
  this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
  assertEquals(1, monitor.getHits());
  }
 
   Any help on why this isn't working would be appreciated.
 
   --
   You received this message because you are subscribed to the
 Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  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 Developers group.
 To post to this group, send email to
   android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
 
--
Dianne Hackborn
Android framework engineer
hack...@android.com
 
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 Developers group.
   To post