| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.ui.picker; | 5 package org.chromium.ui.picker; |
| 6 | 6 |
| 7 import static org.junit.Assert.assertEquals; | 7 import static org.junit.Assert.assertEquals; |
| 8 | 8 |
| 9 import android.app.Activity; | 9 import android.app.Activity; |
| 10 import android.widget.DatePicker; | 10 import android.widget.DatePicker; |
| 11 | 11 |
| 12 import org.chromium.testing.local.LocalRobolectricTestRunner; | 12 import org.chromium.testing.local.LocalRobolectricTestRunner; |
| 13 import org.junit.Before; | 13 import org.junit.Before; |
| 14 import org.junit.Test; | 14 import org.junit.Test; |
| 15 import org.junit.runner.RunWith; | 15 import org.junit.runner.RunWith; |
| 16 import org.robolectric.Robolectric; | 16 import org.robolectric.Robolectric; |
| 17 import org.robolectric.annotation.Config; | 17 import org.robolectric.annotation.Config; |
| 18 | 18 |
| 19 import java.util.TimeZone; | 19 import java.util.TimeZone; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Tests for DateDialogNormalizer. | 22 * Tests for DateDialogNormalizer. |
| 23 */ | 23 */ |
| 24 @RunWith(LocalRobolectricTestRunner.class) | 24 @RunWith(LocalRobolectricTestRunner.class) |
| 25 @Config(manifest = Config.NONE) | 25 // sdk 18 is used due to a bug in Robolectric, crbug.com/635199 |
| 26 @Config(manifest = Config.NONE, sdk = 18) |
| 26 public class DateDialogNormalizerTest { | 27 public class DateDialogNormalizerTest { |
| 27 | 28 |
| 28 private static final long MILLIS_PER_MINUTE = 60 * 1000; | 29 private static final long MILLIS_PER_MINUTE = 60 * 1000; |
| 29 private static final long MILLIS_PER_HOUR = 60 * 60 * 1000; | 30 private static final long MILLIS_PER_HOUR = 60 * 60 * 1000; |
| 30 private static final long PST_OFFSET_MILLIS = 8 * MILLIS_PER_HOUR; | 31 private static final long PST_OFFSET_MILLIS = 8 * MILLIS_PER_HOUR; |
| 31 private static final long JAPAN_OFFSET_MILLIS = -9 * MILLIS_PER_HOUR; | 32 private static final long JAPAN_OFFSET_MILLIS = -9 * MILLIS_PER_HOUR; |
| 32 | 33 |
| 33 private static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone("GMT"); | 34 private static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone("GMT"); |
| 34 private static final TimeZone PST_TIME_ZONE = TimeZone.getTimeZone("GMT-08")
; | 35 private static final TimeZone PST_TIME_ZONE = TimeZone.getTimeZone("GMT-08")
; |
| 35 private static final TimeZone JAPAN_TIME_ZONE = TimeZone.getTimeZone("Japan"
); // GMT+09 | 36 private static final TimeZone JAPAN_TIME_ZONE = TimeZone.getTimeZone("Japan"
); // GMT+09 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 run(GMT_TIME_ZONE, | 151 run(GMT_TIME_ZONE, |
| 151 2001, 3, 4, MARCH_15_3456, DECEMBER_31_5000, | 152 2001, 3, 4, MARCH_15_3456, DECEMBER_31_5000, |
| 152 3456, 2, 15, MARCH_15_3456, DECEMBER_31_5000); | 153 3456, 2, 15, MARCH_15_3456, DECEMBER_31_5000); |
| 153 run(GMT_TIME_ZONE, | 154 run(GMT_TIME_ZONE, |
| 154 10001, 3, 4, MARCH_15_3456, DECEMBER_31_5000, | 155 10001, 3, 4, MARCH_15_3456, DECEMBER_31_5000, |
| 155 5000, 11, 31, MARCH_15_3456, DECEMBER_31_5000); | 156 5000, 11, 31, MARCH_15_3456, DECEMBER_31_5000); |
| 156 | 157 |
| 157 TimeZone.setDefault(originalDefaultTimeZone); | 158 TimeZone.setDefault(originalDefaultTimeZone); |
| 158 } | 159 } |
| 159 } | 160 } |
| OLD | NEW |