From 393b68131d1439b2e0cb7d55cf3b897aa0f46def Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 1 Sep 2015 17:11:02 -0700 Subject: Fix CallDetailActivityTest. Use PopupMenu to get a Menu instance, instead of using an internal MenuBuilder. Bug: 23640774 Change-Id: I356eba8a646ca1d09e6bca0887cfc03adf12782b --- .../com/android/dialer/CallDetailActivityTest.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'tests/src/com/android/dialer') 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 * 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); -- cgit v1.2.3