diff options
author | Elliott Hughes <enh@google.com> | 2011-05-24 11:58:13 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-24 11:58:13 -0700 |
commit | ac1fc788fd943fa235606480dbe6578df66833ec (patch) | |
tree | 73a4a201ce1faa02c8aee124793d96730df5d441 /luni | |
parent | ef4da87682d67dde707d0a44ec2780fd15b1f990 (diff) | |
parent | 7bab62689d99e62747833a750fb8042db93b1f4f (diff) | |
download | apache-harmony-ac1fc788fd943fa235606480dbe6578df66833ec.tar.gz |
Merge "Remove tests for deprecated Thread API." into dalvik-dev
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java index ba35ada..4816975 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java @@ -742,38 +742,6 @@ public class ThreadTest extends junit.framework.TestCase { } /** - * @tests java.lang.Thread#resume() - */ - @SuppressWarnings("deprecation") - public void test_resume() { - // Test for method void java.lang.Thread.resume() - int orgval; - ResSupThread t; - try { - t = new ResSupThread(Thread.currentThread()); - synchronized (t) { - ct = new Thread(t, "Interrupt Test2"); - ct.start(); - t.wait(); - } - ct.suspend(); - // Wait to be sure the suspend has occurred - Thread.sleep(500); - orgval = t.getCheckVal(); - // Wait to be sure the thread is suspended - Thread.sleep(500); - assertTrue("Failed to suspend thread", orgval == t.getCheckVal()); - ct.resume(); - // Wait to be sure the resume has occurred. - Thread.sleep(500); - assertTrue("Failed to resume thread", orgval != t.getCheckVal()); - ct.interrupt(); - } catch (InterruptedException e) { - fail("Unexpected interrupt occurred : " + e.getMessage()); - } - } - - /** * @tests java.lang.Thread#run() */ public void test_run() { @@ -906,115 +874,6 @@ public class ThreadTest extends junit.framework.TestCase { } /** - * @tests java.lang.Thread#stop() - */ - @SuppressWarnings("deprecation") - public void test_stop() { - // Test for method void java.lang.Thread.stop() - try { - Runnable r = new ResSupThread(null); - synchronized (r) { - st = new Thread(r, "Interupt Test5"); - st.start(); - r.wait(); - } - - } catch (InterruptedException e) { - fail("Unexpected interrupt received"); - } - st.stop(); - - try { - st.join(10000); - } catch (InterruptedException e1) { - st.interrupt(); - fail("Failed to stopThread before 10000 timeout"); - } - assertTrue("Failed to stopThread", !st.isAlive()); - } - - /** - * @tests java.lang.Thread#stop(java.lang.Throwable) - */ - @SuppressWarnings("deprecation") - public void test_stopLjava_lang_Throwable() { - // Test for method void java.lang.Thread.stop(java.lang.Throwable) - ResSupThread t = new ResSupThread(Thread.currentThread()); - synchronized (t) { - st = new Thread(t, "StopThread"); - st.setPriority(Thread.MAX_PRIORITY); - st.start(); - try { - t.wait(); - } catch (InterruptedException e) { - } - } - try { - st.stop(new BogusException("Bogus")); - Thread.sleep(20000); - } catch (InterruptedException e) { - assertTrue("Stopped child with exception not alive", st.isAlive()); - st.interrupt(); - return; - } - st.interrupt(); - fail("Stopped child did not throw exception"); - } - - /** - * @tests java.lang.Thread#suspend() - */ - @SuppressWarnings("deprecation") - public void test_suspend() { - // Test for method void java.lang.Thread.suspend() - int orgval; - ResSupThread t = new ResSupThread(Thread.currentThread()); - try { - synchronized (t) { - ct = new Thread(t, "Interupt Test6"); - ct.start(); - t.wait(); - } - ct.suspend(); - // Wait to be sure the suspend has occurred - Thread.sleep(500); - orgval = t.getCheckVal(); - // Wait to be sure the thread is suspended - Thread.sleep(500); - assertTrue("Failed to suspend thread", orgval == t.getCheckVal()); - ct.resume(); - // Wait to be sure the resume has occurred. - Thread.sleep(500); - assertTrue("Failed to resume thread", orgval != t.getCheckVal()); - ct.interrupt(); - } catch (InterruptedException e) { - fail("Unexpected interrupt occurred"); - } - - final Object notify = new Object(); - Thread t1 = new Thread(new Runnable() { - public void run() { - synchronized (notify) { - notify.notify(); - } - Thread.currentThread().suspend(); - } - }); - try { - synchronized (notify) { - t1.start(); - notify.wait(); - } - // wait for Thread to suspend - Thread.sleep(500); - assertTrue("Thread should be alive", t1.isAlive()); - t1.resume(); - t1.join(); - } catch (InterruptedException e) { - } - } - - /** * @tests java.lang.Thread#toString() */ public void test_toString() { |