| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.mojo.system; | 5 package org.chromium.mojo.system.impl; |
| 6 | 6 |
| 7 import android.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
| 8 | 8 |
| 9 import org.chromium.mojo.MojoTestCase; |
| 10 import org.chromium.mojo.system.AsyncWaiter; |
| 9 import org.chromium.mojo.system.AsyncWaiter.Callback; | 11 import org.chromium.mojo.system.AsyncWaiter.Callback; |
| 10 import org.chromium.mojo.system.AsyncWaiter.Cancellable; | 12 import org.chromium.mojo.system.AsyncWaiter.Cancellable; |
| 13 import org.chromium.mojo.system.Core; |
| 11 import org.chromium.mojo.system.Core.WaitFlags; | 14 import org.chromium.mojo.system.Core.WaitFlags; |
| 12 import org.chromium.mojo.system.Core.WaitManyResult; | 15 import org.chromium.mojo.system.Core.WaitManyResult; |
| 16 import org.chromium.mojo.system.DataPipe; |
| 17 import org.chromium.mojo.system.Handle; |
| 18 import org.chromium.mojo.system.InvalidHandle; |
| 19 import org.chromium.mojo.system.MessagePipeHandle; |
| 13 import org.chromium.mojo.system.MessagePipeHandle.ReadFlags; | 20 import org.chromium.mojo.system.MessagePipeHandle.ReadFlags; |
| 14 import org.chromium.mojo.system.MessagePipeHandle.ReadMessageResult; | 21 import org.chromium.mojo.system.MessagePipeHandle.ReadMessageResult; |
| 15 import org.chromium.mojo.system.MessagePipeHandle.WriteFlags; | 22 import org.chromium.mojo.system.MessagePipeHandle.WriteFlags; |
| 23 import org.chromium.mojo.system.MojoException; |
| 24 import org.chromium.mojo.system.MojoResult; |
| 25 import org.chromium.mojo.system.Pair; |
| 26 import org.chromium.mojo.system.SharedBufferHandle; |
| 16 import org.chromium.mojo.system.SharedBufferHandle.MapFlags; | 27 import org.chromium.mojo.system.SharedBufferHandle.MapFlags; |
| 17 | 28 |
| 18 import java.nio.ByteBuffer; | 29 import java.nio.ByteBuffer; |
| 19 import java.util.ArrayList; | 30 import java.util.ArrayList; |
| 20 import java.util.Arrays; | 31 import java.util.Arrays; |
| 21 import java.util.Collections; | 32 import java.util.Collections; |
| 22 import java.util.List; | 33 import java.util.List; |
| 23 import java.util.Random; | 34 import java.util.Random; |
| 24 import java.util.concurrent.Executors; | 35 import java.util.concurrent.Executors; |
| 25 import java.util.concurrent.ScheduledExecutorService; | 36 import java.util.concurrent.ScheduledExecutorService; |
| 26 import java.util.concurrent.TimeUnit; | 37 import java.util.concurrent.TimeUnit; |
| 27 | 38 |
| 28 /** | 39 /** |
| 29 * Testing the core API. | 40 * Testing the core API. |
| 30 */ | 41 */ |
| 31 public class CoreTest extends MojoTestCase { | 42 public class CoreImplTest extends MojoTestCase { |
| 32 | 43 |
| 33 private static final long RUN_LOOP_TIMEOUT_MS = 5; | 44 private static final long RUN_LOOP_TIMEOUT_MS = 5; |
| 34 | 45 |
| 35 private static final ScheduledExecutorService WORKER = | 46 private static final ScheduledExecutorService WORKER = |
| 36 Executors.newSingleThreadScheduledExecutor(); | 47 Executors.newSingleThreadScheduledExecutor(); |
| 37 | 48 |
| 38 /** | 49 /** |
| 39 * Runnable that will close the given handle. | 50 * Runnable that will close the given handle. |
| 40 */ | 51 */ |
| 41 private static class CloseHandle implements Runnable { | 52 private static class CloseHandle implements Runnable { |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 nativeRunLoop(RUN_LOOP_TIMEOUT_MS); | 792 nativeRunLoop(RUN_LOOP_TIMEOUT_MS); |
| 782 assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult()); | 793 assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult()); |
| 783 assertEquals(null, asyncWaiterResult.getException()); | 794 assertEquals(null, asyncWaiterResult.getException()); |
| 784 } finally { | 795 } finally { |
| 785 handles.first.close(); | 796 handles.first.close(); |
| 786 handles.second.close(); | 797 handles.second.close(); |
| 787 } | 798 } |
| 788 } | 799 } |
| 789 | 800 |
| 790 } | 801 } |
| OLD | NEW |