summaryrefslogtreecommitdiffstats
path: root/luni/src/test
Commit message (Collapse)AuthorAgeFilesLines
* Work around the snappily-titled ICANN "Name Collision Occurrence Management ↵Elliott Hughes2014-08-222-4/+4
| | | | | | | | | | | Framework". Using a non-existent TLD is now a Bad Idea. (cherry-pick of a7d651e95e38974fa0de19247e8341df98a0b1b1.) Bug: 17146413 Change-Id: I6a68b4609d59a6d56ba780d03ffcf24a2759db48
* Support narrow am/pm markers in LocaleData.Elliott Hughes2014-08-221-0/+2
| | | | | | | (cherry-pick of ebe417d7808ac5bce5bc14d36d6af4c31218326d.) Bug: 16938600 Change-Id: I7334c1ea57ea0593b3e0bd7943f8a5208c704881
* Fix init test cases from DexClassLoaderTest.Calin Juravle2014-08-211-32/+52
| | | | | | | | | | | | | Because the tests cases are executed in the same runtime and the class linker may cache generated optimized files, init tests need to use their own optimized directories (so that they can reliable test the number of generated files). Bug: 16806146 (cherry picked from commit 58c130c1eb99cc72998150d813b3e31896e3bfaf) Change-Id: I8111cc7ea640f3bc94821fcd4380acfc078c746f
* Fix parsing of fractional seconds.Narayan Kamath2014-08-141-0/+11
| | | | | | | | | | | | | We were just parsing them as millisecond values, which is wrong. ".1" fractional second is 100 milliseconds (we were parsing it as 1 ms), and ".765432" fractional seconds is 765 milliseconds (we were parsing it as 765432ms. In most cases, this was hidden by the fact that we were formatting such values incorrectly as well. bug: 16969112 Change-Id: Id287684f78691090ac4a6c3029d7909f2c1e1310
* Allow Calendar.getInstance to be called with a null Locale.Narayan Kamath2014-08-134-0/+69
| | | | | | | | | | | | | LocaleData.get was changed to throw for null locales instead of falling back to the default, so we need to adjust callers accordingly. Turns out all other callers would've thrown anyway (for different reasons) so this change makes those exceptions explicit and adds tests for them. bug: 16938922 Change-Id: I3e77435a6b414b002b96a4f8deb44b51591c5a51
* Variants are case sensitive.Narayan Kamath2014-08-081-4/+11
| | | | | | | Yet we were incorrectly upper-casing them inside forLanguageTag. bug: 16811867 Change-Id: I088161c4c7769908f35b9f2b7d945fb1cd1fd7ac
* Track bouncycastle upgrade to 1.51Kenny Root2014-08-071-2/+2
| | | | | | The SubjectKeyIdentifierStructure class is no longer in Bouncycastle. Change-Id: Ie5eb91a14ec38f773ef22754d77651a161fd7122
* Fix MimeUtils to treat ".flac" as "audio/flac".Elliott Hughes2014-08-052-15/+46
| | | | | | | (cherry-pick of 77926e913a14b9541df38b6175f795f2ca6c5266.) Bug: 15715370 Change-Id: I2d99f070c3debea01621a172d8189951a56736b5
* Fix LocaleInternalsTest.Narayan Kamath2014-07-311-3/+4
| | | | | | | | | | | | - After the new Java forLanguageTag implementation, bogus locales really do result in "und". - Fix a regression in unicode extension parsing, where we would always add a "null" to the keyword set. - Improve test assertions so that the reason for failure is obvious. bug: 15849709 Change-Id: I26fb348b872badb7844587cf290429e15dbb0f0e
* Add ICU.addLikelySubtags(Locale).Narayan Kamath2014-07-311-0/+8
| | | | | | | | | | | | | | We don't need a replacement for ICU.getScript(String), Locale.getScript() can be used instead. The old definition of the function has been left public for the support library to use (though we could remove it if we modify the support lib). Note that addLikelySubtag returns a String that's language tag like, but uses underscores instead of hyphens to separate subtags. bug: 15876704 Change-Id: I6c7d289c4b725a83900e38dd5bbed026afd9ac4e
* Merge "Change the DateFormatSymbols serialized form"Neil Fuller2014-07-231-6/+5
|\
| * Change the DateFormatSymbols serialized formNeil Fuller2014-07-301-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding locale to the serialized form of DateFormatSymbols. Some duplicated code around the generation of numeric / offset timezone strings (e.g. GMT+08:00) has been removed. A new hidden method has been added to TimeZone to create this string. The timezone string lookup has been moved into LocaleData and it now has a single path rather than treating the customZoneStrings path as special. customZoneStrings has been removed from DateFormatSymbols because it would potentially have an incorrect value after serialization and it is no longer required. Bug: 16502916 Change-Id: I2b317e34ba4772beb372a75dd08c95113408b9cc
* | Fix Character.getDirectionality.Elliott Hughes2014-07-291-0/+12
|/ | | | | | | | | | Previously we'd throw ArrayIndexOutOfBoundsException for U+2066..U+2069. Now we'll return DIRECTIONALITY_UNDEFINED. I've exposed (via @hide) the underlying icu4c implementation so that frameworks code at least can work with the new explicit bidi formatting characters. Bug: 15492712 Change-Id: I96583c7e1c6be26d3f1a857615a1042d58e9feaf
* Merge "SSLSocketFactory: don't reload the default if class name is same"Kenny Root2014-07-241-0/+1
|\
| * SSLSocketFactory: don't reload the default if class name is sameKenny Root2014-07-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Don't bother to reload the default SocketFactory if the requested classname didn't change since the last time. Also make the warning when classloading fails more terse. Most of the time the ClassLoader is wrong, so giving them a hint via ClassLoader#toString is sufficient. Bug: 16468683 Change-Id: I36844e942ccadda993c9f5a1523b2a66280903f3
* | Fix serialization / deserialization of SealedObjectNeil Fuller2014-07-241-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to apphelia@ for the report. The readObject() implementation had hardcoded the field order incorrectly leading to a couple of fields being swapped on each serialization: paramsAlg and sealAlg. This was wrong as far back as 2009 so the class has likely never worked for its intended purpose. Field order during Serialization is primitives first, then fields. Secondary ordering is alphabetical. The purpose of overriding readObject() at all is for safety in the event of compromised stream data. It would be more appropriate to clone() rather than readUnshared(). readUnshared() assumes a corresponding writeUnshared(), which is not present. The readUnshared() probably only works here because the byte[] arrays typically are not shared anyway. From reading latest guidelines on safe serialization the code need not be order-specific: it can use readFields(). s.defaultReadObject() could have been used instead but the guidelines recommend against. Performance is probably not a concern. Until now nobody could have been using SealedObject for its intended purpose otherwise they would have noticed this bug (or they were always serializing / deserializing an even number of times!). Anybody attempting to use SealedObject on earlier versions of Android will need to serialize / deserialize twice to avoid the bug. After this fix the class will work as intended. Additional: Some duplicated code has been extracted into methods, and streams are now closed when they are finished with. In reality this will have no effect given the stream implementations involved. Bug: https://code.google.com/p/android/issues/detail?id=73235 Change-Id: If745d6556437ae7839543e66dd15f912afd4ec98
* | Throw an error when parsing an obviously bad DoubleNeil Fuller2014-07-241-0/+15
|/ | | | | | | Thanks to Robbie Hott for the bug report. Bug: https://code.google.com/p/android/issues/detail?id=71216 Change-Id: I402fa27e0b90c1c1d26169d79c7061e4a2caa138
* Merge "Add math tests in csv format for libcore math functions"Jeff Hao2014-07-226-0/+10328
|\
| * Add math tests in csv format for libcore math functionsMichael Chen2014-07-216-0/+10328
| | | | | | | | | | | | | | | | | | The goal here is to have a csv file with math tests that different parts of Android can all use the same math tests. This change provides these initial csv files as well as the corresponding testing framework for libcore. Change-Id: I56430bd9224d92853aefa5024d6fdd1d10dfb255
* | Fix broken nio BufferTest and add alignment test.Mathieu Chartier2014-07-221-9/+23
| | | | | | | | | | | | Bug: 16486921 Bug: 16449607 Change-Id: Ib1871d0fa09bfc3fbf3c041f56ee74fd7a234a5a
* | Implement Locale.forLanguageTag in java.Narayan Kamath2014-07-222-20/+40
|/ | | | | | | | | | | | | | | | | This prevents us from having to parse ICU locale IDs or construct them in java. Note that the changes to LocaleTest bring us in line with the spec (some of the previous tests demonstrated wonky ICU4C behaviour we didn't want). This change includes a minor fix to unicode extension parsing, we now accept keywords with empty values which the spec allows. bug: 15661724 bug: 15849709 Change-Id: If9417ab4cb545fdb8b9a0a47a7eade6ebbe33ba8
* Merge "CipherTest: check multiple calls to doFinal work"Kenny Root2014-07-171-0/+8
|\
| * CipherTest: check multiple calls to doFinal workKenny Root2014-07-141-0/+8
| | | | | | | | | | | | | | | | | | | | In existing implementations of JSSE Cipher providers, calling "doFinal" resets the cipher to the state it was at when "init" was called. Note that this is dangerous to do, but it appears some people do it. Bug: 16298401 Bug: http://code.google.com/p/android/issues/detail?id=73339 Change-Id: I32e26fde660dc7c50fdac0d74d5d97801f1da9f9
* | Revert "Revert "Add a cache for ZoneInfo objects in Java""Neil Fuller2014-07-171-0/+23
| | | | | | | | | | | | | | | | | | This reverts commit 01b6a878d10ee68db87c3d85d137e81a5257a78a. Contains a fix for when the timezone ID is not found. This includes a new test. Change-Id: I2e5e669782ea6caf4e97153ed6b63ca6ee4ef50d
* | Revert "Add a cache for ZoneInfo objects in Java"Neil Fuller2014-07-171-18/+0
| | | | | | | | | | | | This reverts commit a6e8689807f5a8bb9470ce7c26a47455d2d0608d. Change-Id: I17a0262d169db3418f2f8888195381f778975dc4
* | Add a cache for ZoneInfo objects in JavaNeil Fuller2014-07-161-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mirrors the single-item cache in localtime.c. This is in preparation for an upcoming change to migrate android.format.text.Time over to Java. It will be making use of the Java ZoneInfo instead of the native equivalent. The Java cache has a size of 1 like the bionic one, though this can easily be increased. Given the default TimeZone / ZoneInfo was always pinned, in many cases the memory usage will not go up noticeably. In scenarios where applications load timezones besides the default a cache size of 1 potentially increases pinned memory usage by one ZoneInfo plus the overhead of the prototype object held by the cache (which is never returned to callers). An example ZoneInfo is "Europe/London", which has ~190 transitions (1 int + 1 byte) and ~6 types (1 int + 1 byte). Overhead of other fields is ~ 13 bytes, plus the ID string. 190 * (4 + 1) + 6 * (4 + 1) + 13 = 993 bytes. The prototypes held by the cache share the majority of their memory with their clones returned from ZoneInfo.makeTimeZone() and so the overhead of introducing the cache itself should be in the order of a few tens of bytes at most. In future we may want to increase the cache size to 2 in order to support apps that compare / switch timezones to increase the odds of the default remaining in the cache. Sizes above 2 look increasingly specialist. Change-Id: I0b7daa8ad5d334c8d421dfaa6e0421d3c181a915
* | Tidy up OldAndroidLocaleTest#testICULocales.Narayan Kamath2014-07-161-6/+11
| | | | | | | | | | | | | | Construct the locale object directly instead of having a list of strings and parsing them by hand. Change-Id: Ia26ab30cbe7c5e6e10aca81a0d55b213879b5112
* | TLS-PSK cipher suites enabled when PSKKeyManager is provided.Alex Klyubin2014-07-141-0/+108
|/ | | | | | | | This documents and tests that TLS-PSK cipher suites are enabled if a PSKKeyManager is provided to SSLContext during its initialization. Bug: 15073623 Change-Id: I8e2bc3e7a1ea8a986e468973b6bad19dc6b7bc3c
* Merge "Invalidate cache of default SocketFactory"Kenny Root2014-07-101-0/+174
|\
| * Invalidate cache of default SocketFactoryKenny Root2014-06-271-0/+174
| | | | | | | | | | | | | | | | | | | | | | Currently the default SocketFactory is set once and never invalidated. Use the Services cache version number to know when to invalidate our cache. This increases the time to get the default implementation from 63ns to 97ns on a Nexus 7 (2013) aka deb. Change-Id: I5d46f02fccaa25e5bcea69d5ca0e4924290cf0e1
* | Merge "KeyPairGeneratorTest: add back some DH tests"Kenny Root2014-07-101-6/+23
|\ \
| * | KeyPairGeneratorTest: add back some DH testsKenny Root2014-07-101-6/+23
| |/ | | | | | | | | | | | | | | | | Add back the DH tests that uses a pre-defined Diffie-Hellman prime and generator. Keep the tests that try to find safe prime disabled. Bug: 5513723 Bug: 16188130 Change-Id: If77b14287855528964665e7782be45c5f57434db
* | Merge "Fix unit tests now that the "tl" -> "fil" hack is gone."Narayan Kamath2014-07-091-11/+27
|\ \
| * | Fix unit tests now that the "tl" -> "fil" hack is gone.Narayan Kamath2014-07-071-11/+27
| |/ | | | | | | | | bug: 15873165 Change-Id: I2ffe1f384e2140b31adb72d1f4eaa029a70428f0
* | Remove more.Elliott Hughes2014-07-071-47/+0
| | | | | | | | | | | | (cherry-pick of f39b5ca3c6378c3c36c63889577004b9693ea9c6.) Change-Id: Idaf030cd369e728ec37df7107cd30062db899b7c
* | Remove.Elliott Hughes2014-07-0710-2257/+30
| | | | | | | | | | | | (cherry-pick of 63744c884dd4b4f4307f2b021fb894af164972af.) Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
* | RemoveBrian Carlstrom2014-07-072-109/+0
|/ | | | | | (cherry picked from commit 36214feb86a0963b23f34c8c63584252bd757e19) Change-Id: I96d5109c01e39255b9970f7a515ddd3575a50e56
* Merge "Fix a faulty Julian day computation."Elliott Hughes2014-06-261-0/+42
|\
| * Fix a faulty Julian day computation.Elliott Hughes2014-06-261-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of Calendar.MILLISECONDS was wrong, as was the use of ZONE_OFFSET without DST_OFFSET. The existing code pretty much only works for the values tested in the unit test! This patch adds new tests to make up for that. I've also added calls to Calendar.clear to ensure we're not leaking SECONDS and MILLISECONDS from the Calendar instances (which get initialized to the current wall clock) into our test values. This hasn't mattered in the past, but actually does matter here because tests like isMidnight measure down to the millisecond. Bug: https://code.google.com/p/android/issues/detail?id=72356 Signed-off-by: jasper tsai <jasper3_tsai@asus.com> Signed-off-by: hellena shih <hellena_shih@asus.com> Change-Id: I7d57590a95d3f026bdf1b991e0b1ddb47ba9af37
* | Merge "Clarify the String.compareTo contract and add tests."Elliott Hughes2014-06-261-0/+67
|\ \
| * | Clarify the String.compareTo contract and add tests.Elliott Hughes2014-06-261-0/+67
| |/ | | | | | | | | | | | | | | | | | | | | Our use of vague terms like "negative" and "positive" led VM engineers to assume they had more leeway than they actually do. While we're here, let's fix all the ambiguous use of 'character' and add a warning and link to Collator anywhere the non-standard (and non-locale-specific) case folding is used. Change-Id: I0a0fb2a493861d32fac0bc4e28ae9634f8ac342c
* | Assert that setEnabledProtocols/CipherSuites copy their inputs.Alex Klyubin2014-06-193-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SSLSocket, SSLServerSocket, and SSLEngine offer setEnabledProtocols and setEnabledCipherSuites methods which take an array of protocols or cipher suites as input. If these methods store references to the input arrays, then the internal state (lists of enabled protocols and cipher suites) of SSLSocket, SSLServerSocket, and SSLEngine could be modified without going through the setter methods of these classes. Correct implementations of these methods should store copies of the input arrays. Bug: 15753142 Change-Id: Ia5248050d81320ed1da99892278bd60872605f52
* | Fix for currency symbol coming from the default localeNeil Fuller2014-06-191-10/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NumberFormat.setCurrency() (actually DecimalFormat) was using currency.getSymbol() without passing the format's locale. This caused the default Locale to be used to look up the symbol. The fix uses the format locale, not the default. A test has been added to demonstrate the problem / fix. To avoid having the NativeDecimalFormat know about the locale class, the symbol is passed as an argument rather than the Currency object. This is an internal API. Making this change showed an issue with Currency.getSymbol(): For Locales without a country the currency code would be returned and not a symbol. ICU provides language-level symbols so this was not the best we could do. Since the code was previously using the default Locale, and the default locale usually has a country it was not previously obvious. testBug71369 broke because of this second issue. The code is also fixed here. This was discovered while investigating bug 71369 but is not related. Change-Id: If0ce280aefb042fe8f7ca126cced090b9268a866
* | Merge "Fix CurrencyTest.test_getSymbol for unknown variants"Neil Fuller2014-06-171-0/+35
|\ \
| * | Fix CurrencyTest.test_getSymbol for unknown variantsNeil Fuller2014-06-181-0/+35
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The behavior of CurrencyTest.getSymbol has changed since K for unrecoginzed locales. Commit de0eb683370d789e7bb25673b350b8dbf2ba5d69 now means the ICU default locale is set when the Java default locale is changed. Previously it would have been left unset and would have fallen back to using the system settings (most likely US or UK English during tests). The test is setting the Java default locale to "kr-KR" (a locale unrecognized by ICU) and requesting the currency symbol for USD for locale "kr-KR" (still unrecognized by ICU). Before the commit: Because the kr-KR argument is unrecognized ICU tries the ICU default (which was unset and so picked system setting of en). It returned "$". After the commit: As above, but now the ICU default is set to kr-KR. Since there is no entry for USD in the default it falls back to "root", and returns the value found there: "US$". Behavior when the default locale is unrecognized is edge-case and arguably it is no more / less correct before or after this commit. The test has been updated to reflect the new value + some tidy up of the test generally. This change also contains a more focused test that demonstrates the behavior in ICU and adds documentation to make ICU slightly clearer. Arguably neither the new ICUTest nor the existing CurrencyTest code should exist because they assert edge-case behavior that Android may wish to change in future. Bug: 14821275 Change-Id: I8beb6004b0c37d2fe59855d13d2c8e2e6fe1c530
* | Merge "Removing tests that test the SqlLite API directly."Neil Fuller2014-06-1712-3152/+145
|\ \
| * | Removing tests that test the SqlLite API directly.Neil Fuller2014-06-1712-3152/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many of the tests were testing that the SqlLite Java API works. Android does not ship with the SQLLite code as a public API so these have been removed. Some of the tests were testing JDBC APIs associated with Connection, Driver and DriverManager behavior so these have been retained and moved to libcore/java/sql/DriverTest.java / ConnectionTest.java Change-Id: I97ec05591019505f527ee134177c5637bbd08538
* | | Merge "CTS fix: Signature2Test.test_clone()"Neil Fuller2014-06-171-0/+10
|\ \ \
| * | | CTS fix: Signature2Test.test_clone()Neil Fuller2014-06-181-0/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Previously it would throw a NullPointerException. Fixing that rendered the Signature cloneable and the test assertions failing. The test now passes but is of questionable value except to prove the absence of RuntimeException. Change-Id: I2a5b160f0914837b37b801e16b8a3717d00fd94e
* | | Merge "Fix getISO3Country and getISO3Language."Narayan Kamath2014-06-171-0/+8
|\ \ \