diff options
author | Andrew Lee <anwlee@google.com> | 2015-09-01 17:11:02 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-09-01 17:11:02 -0700 |
commit | 393b68131d1439b2e0cb7d55cf3b897aa0f46def (patch) | |
tree | 1d16be5ef6e0979f2c1c7a475e68d28dded29de3 /tests/src | |
parent | 7de107bff21b046c50a42bebf57eb244772412e9 (diff) |
Fix CallDetailActivityTest.
Use PopupMenu to get a Menu instance, instead of using an internal
MenuBuilder.
Bug: 23640774
Change-Id: I356eba8a646ca1d09e6bca0887cfc03adf12782b
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/dialer/CallDetailActivityTest.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/src/com/android/dialer/CallDetailActivityTest.java b/tests/src/com/android/dialer/CallDetailActivityTest.java index c87424482..59c2434f2 100644 --- a/tests/src/com/android/dialer/CallDetailActivityTest.java +++ b/tests/src/com/android/dialer/CallDetailActivityTest.java @@ -29,12 +29,12 @@ import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.Suppress; import android.view.Menu; +import android.widget.PopupMenu; import android.widget.TextView; import com.android.dialer.calllog.CallLogAsyncTaskUtil; import com.android.dialer.util.AsyncTaskExecutors; import com.android.dialer.util.FakeAsyncTaskExecutor; -// import com.android.internal.view.menu.ContextMenuBuilder; /** * Unit tests for the {@link CallDetailActivity}. NOTE: The screen needs to be on for the @@ -86,33 +86,33 @@ public class CallDetailActivityTest extends ActivityInstrumentationTestCase2<Cal * Test for bug where voicemails should not have remove-from-call-log entry. * <p> * See http://b/5054103. + */ public void testVoicemailDoesNotHaveRemoveFromCallLog() throws Throwable { setActivityIntentForTestVoicemailEntry(); startActivityUnderTest(); mFakeAsyncTaskExecutor.runTask(GET_CALL_DETAILS); - Menu menu = new ContextMenuBuilder(mActivityUnderTest); - mActivityUnderTest.onCreateOptionsMenu(menu); - mActivityUnderTest.onPrepareOptionsMenu(menu); - assertFalse(menu.findItem(R.id.menu_remove_from_call_log).isVisible()); - assertTrue(menu.findItem(R.id.menu_trash).isVisible()); + Menu optionsMenu = (new PopupMenu(mActivityUnderTest, null)).getMenu(); + mActivityUnderTest.onCreateOptionsMenu(optionsMenu); + mActivityUnderTest.onPrepareOptionsMenu(optionsMenu); + assertFalse(optionsMenu.findItem(R.id.menu_remove_from_call_log).isVisible()); + assertTrue(optionsMenu.findItem(R.id.menu_trash).isVisible()); } - */ /** * Test to check that I haven't broken the remove-from-call-log entry from regular calls. + */ public void testRegularCallDoesHaveRemoveFromCallLog() throws Throwable { setActivityIntentForTestCallEntry(); startActivityUnderTest(); mFakeAsyncTaskExecutor.runTask(GET_CALL_DETAILS); - Menu menu = new ContextMenuBuilder(mActivityUnderTest); - mActivityUnderTest.onCreateOptionsMenu(menu); - mActivityUnderTest.onPrepareOptionsMenu(menu); - assertTrue(menu.findItem(R.id.menu_remove_from_call_log).isVisible()); - assertFalse(menu.findItem(R.id.menu_trash).isVisible()); + Menu optionsMenu = (new PopupMenu(mActivityUnderTest, null)).getMenu(); + mActivityUnderTest.onCreateOptionsMenu(optionsMenu); + mActivityUnderTest.onPrepareOptionsMenu(optionsMenu); + assertTrue(optionsMenu.findItem(R.id.menu_remove_from_call_log).isVisible()); + assertFalse(optionsMenu.findItem(R.id.menu_trash).isVisible()); } - */ private void setActivityIntentForTestCallEntry() { assertNull(mVoicemailUri); |