From 06c9281eee70e8b34ec89f1e0aef7b174e29de2c Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Mon, 23 Nov 2015 11:26:38 -0800 Subject: Fix crash when business is closed today but open tomorrow. Attempted to index into -1 position of opening hours array when business is not open today but open tomorrow. That is because entries exist in the array for tomorrow, but not today. Bug: 25830349 Change-Id: Ib3def69e3d2813bf9cb4739a954b7b9f3724b56a --- .../com/android/incallui/InCallContactInteractionsTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'InCallUI/tests') diff --git a/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java b/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java index 1c2e9ded7..625cda448 100644 --- a/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java +++ b/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java @@ -174,6 +174,17 @@ public class InCallContactInteractionsTest extends AndroidTestCase { .detail); } + public void testOpeningHours_NotOpenTodayOpenTomorrow() { + assertEquals("Opens tomorrow at 8:00 AM", + mInCallContactInteractions.constructHoursInfo( + getTestCalendarWithHour(21), + Arrays.asList( + Pair.create( + getTestCalendarWithHourAndDaysFromToday(8, 1), + getTestCalendarWithHourAndDaysFromToday(10, 1)))) + .detail); + } + public void testMultipleOpenRanges_BeforeOpen() { assertEquals("Opens today at 8:00 AM", mInCallContactInteractions.constructHoursInfo( @@ -214,7 +225,7 @@ public class InCallContactInteractionsTest extends AndroidTestCase { .detail); } - public void testInvalidOpeningHours() { + public void testNotOpenTodayOrTomorrow() { assertEquals(null, mInCallContactInteractions.constructHoursInfo( getTestCalendarWithHour(21), -- cgit v1.2.3