History log of /libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ThreadGroupTest.java
Revision Date Author Comments
d434a6072462b8ba01a41f9febdaabc383e0e31e 17-Apr-2014 Neil Fuller <nfuller@google.com> DO NOT MERGE Fix for ThreadGroup CTS test.

Fixed the test for UncaughtExceptionHandler. This was actually
several tests in one. Each has been broken out. The ones that
were failing were a result of the CTS test runner executing as
an instrumented Android app. The default behavior (configured in
com.android.internal.os.RuntimeInit) is to kill an app if an
uncaught exception reaches the top-most handler. The solution
was to set an alternative default UncaughtExceptionHandler on
Thread to suppress this behavior for the duration of the test
by installing an alternative handler. This handler could also
then be used to confirm the ThreadGroup behavior of "if an
exception is handled by the ThreadGroup hierarchy, use the
Thread default UncaughtExceptionHandler".

The functionality changes are in:
1) setUp()/tearDown() - installing, uninstalling the handler and
removing a Thread.sleep(50).
2) test_uncaughtException_* methods split out. Additional tests
were added and one was removed.
3) Tidied up test_list(), which was relying on particular
thread names and would have used Thread.stop() (which is
unimplemented) if those threads were found.

The remaining changes were refactorings to pull out common code,
remove unneccessary newlines / comments / semi-colons, reformat
to 100 chars width, remove == true / == false conditions, delete
dead code. All pure functions have been made static to make it
clearer they have no side-effects.

What remains is still not nice, but is improved and ~300 lines
shorter.

Bug: 13748422

(cherry picked from commit 071ba8eb49cc6ea63dc913aab145076dbeff0049)

Change-Id: I995553a909974cb0bb6b9521a6a39fd0d6014a3f
071ba8eb49cc6ea63dc913aab145076dbeff0049 17-Apr-2014 Neil Fuller <nfuller@google.com> Fix for ThreadGroup CTS test.

Fixed the test for UncaughtExceptionHandler. This was actually
several tests in one. Each has been broken out. The ones that
were failing were a result of the CTS test runner executing as
an instrumented Android app. The default behavior (configured in
com.android.internal.os.RuntimeInit) is to kill an app if an
uncaught exception reaches the top-most handler. The solution
was to set an alternative default UncaughtExceptionHandler on
Thread to suppress this behavior for the duration of the test
by installing an alternative handler. This handler could also
then be used to confirm the ThreadGroup behavior of "if an
exception is handled by the ThreadGroup hierarchy, use the
Thread default UncaughtExceptionHandler".

The functionality changes are in:
1) setUp()/tearDown() - installing, uninstalling the handler and
removing a Thread.sleep(50).
2) test_uncaughtException_* methods split out. Additional tests
were added and one was removed.
3) Tidied up test_list(), which was relying on particular
thread names and would have used Thread.stop() (which is
unimplemented) if those threads were found.

The remaining changes were refactorings to pull out common code,
remove unneccessary newlines / comments / semi-colons, reformat
to 100 chars width, remove == true / == false conditions, delete
dead code. All pure functions have been made static to make it
clearer they have no side-effects.

What remains is still not nice, but is improved and ~300 lines
shorter.

Bug: 13748422
Change-Id: I995553a909974cb0bb6b9521a6a39fd0d6014a3f
ab762bb740405d0fefcccf4a0899a234f995be13 15-Nov-2013 Narayan Kamath <narayan@google.com> Move tests from tests/api to harmony-tests. (Take 2)

This reverts commit d5e281743e55e1daa297fd8043b2d9b6e8e1bed2.

The makefile issue that caused the original build break
has been resolved.
d5e281743e55e1daa297fd8043b2d9b6e8e1bed2 15-Nov-2013 Narayan Kamath <narayan@google.com> Revert "Move tests from tests/api to harmony-tests."

This reverts commit 81bf28ad31131815d0a36a43a0eca3c29aefdfcd.

Breaks build

Change-Id: I3f1562921ffe8fdbec36971dd65db398c27c92db
81bf28ad31131815d0a36a43a0eca3c29aefdfcd 15-Nov-2013 Narayan Kamath <narayan@google.com> Move tests from tests/api to harmony-tests.

The vast majority of cleaned up harmony tests
are now in harmony-tests/src/test/org/apache/harmony/tests/

Change-Id: I56c2e484ff434b5618cf6751d602ae9f0db96b30