summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorMason Tang <masontang@google.com>2010-08-04 14:14:48 -0700
committerMason Tang <masontang@google.com>2010-08-04 14:14:48 -0700
commit36daf14edbea260f54fb8f650db407e6f5f73ca8 (patch)
tree8bf278ca78a54a7068e0195d97ae9eaba911b805 /tests/src
parentd290a01420234214d73d31b8bfa61652625bb149 (diff)
downloadandroid_packages_apps_Calendar-36daf14edbea260f54fb8f650db407e6f5f73ca8.tar.gz
android_packages_apps_Calendar-36daf14edbea260f54fb8f650db407e6f5f73ca8.tar.bz2
android_packages_apps_Calendar-36daf14edbea260f54fb8f650db407e6f5f73ca8.zip
Fixed widget tests so that they always run in Pacific timezone
Change-Id: I82db0a8b3743f1346bd3e720188163cfc4d23a73
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/calendar/widget/CalendarAppWidgetServiceTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/src/com/android/calendar/widget/CalendarAppWidgetServiceTest.java b/tests/src/com/android/calendar/widget/CalendarAppWidgetServiceTest.java
index 7bf53eca..a07d007f 100644
--- a/tests/src/com/android/calendar/widget/CalendarAppWidgetServiceTest.java
+++ b/tests/src/com/android/calendar/widget/CalendarAppWidgetServiceTest.java
@@ -21,6 +21,8 @@ import com.android.calendar.widget.CalendarAppWidgetModel;
import com.android.calendar.widget.CalendarAppWidgetService;
import com.android.calendar.widget.CalendarAppWidgetService.MarkedEvents;
+import java.util.TimeZone;
+
import android.database.MatrixCursor;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
@@ -33,6 +35,8 @@ import android.view.View;
public class CalendarAppWidgetServiceTest extends AndroidTestCase {
private static final String TAG = "CalendarAppWidgetService";
+ private static final String DEFAULT_TIMEZONE = "America/Los_Angeles";
+
final long now = 1262340000000L; // Fri Jan 01 2010 02:00:00 GMT-0800 (PST)
final long ONE_MINUTE = 60000;
final long ONE_HOUR = 60 * ONE_MINUTE;
@@ -42,6 +46,8 @@ public class CalendarAppWidgetServiceTest extends AndroidTestCase {
final String title = "Title";
final String location = "Location";
+
+
// TODO Disabled test since this CalendarAppWidgetModel is not used for the no event case
//
// @SmallTest
@@ -62,6 +68,20 @@ public class CalendarAppWidgetServiceTest extends AndroidTestCase {
// assertEquals(expected.toString(), actual.toString());
// }
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ // we want to run these tests in a predictable timezone
+ TimeZone.setDefault(TimeZone.getTimeZone(DEFAULT_TIMEZONE));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ // this restores the previous default timezone
+ TimeZone.setDefault(null);
+ }
+
@SmallTest
public void testGetAppWidgetModel_1Event() throws Exception {
CalendarAppWidgetModel expected = new CalendarAppWidgetModel();