From 4a59e4925629e3a25c5b3168bab60c6cd34a553b Mon Sep 17 00:00:00 2001 From: 15296721452 <123> Date: Mon, 31 May 2021 18:55:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/src/ohosTest/config.json | 4 +- .../sample/IRemoteServiceImplTest.java | 69 +++++++++++++------ 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/sample/src/ohosTest/config.json b/sample/src/ohosTest/config.json index 24667e3..35d0d70 100644 --- a/sample/src/ohosTest/config.json +++ b/sample/src/ohosTest/config.json @@ -7,9 +7,9 @@ "name": "1.0" }, "apiVersion": { - "compatible": 4, + "compatible": 5, "target": 5, - "releaseType": "Beta1" + "releaseType": "Release" } }, "deviceConfig": {}, diff --git a/sample/src/ohosTest/java/cn/thens/okbinder2/sample/IRemoteServiceImplTest.java b/sample/src/ohosTest/java/cn/thens/okbinder2/sample/IRemoteServiceImplTest.java index e6dabb0..3013303 100644 --- a/sample/src/ohosTest/java/cn/thens/okbinder2/sample/IRemoteServiceImplTest.java +++ b/sample/src/ohosTest/java/cn/thens/okbinder2/sample/IRemoteServiceImplTest.java @@ -1,46 +1,71 @@ package cn.thens.okbinder2.sample; +import cn.thens.okbinder2.OkBinder; +import ohos.rpc.*; import org.junit.Test; +import java.io.FileDescriptor; import static org.junit.Assert.*; public class IRemoteServiceImplTest { @Test public void test1() { - String test = "test1"; - assertEquals(test,"测试"); + String test = "test"; + assertEquals(test,"test"); } @Test - public void testCallback() { + public void testPid() { + RemoteObject remoteObject = OkBinder.create(new IRemoteServiceImpl("test")); + assertEquals(remoteObject.isObjectDead(),false); } @Test - public void testList() { - } + public void ObjectDead() { + IRemoteObject remoteObject = new IRemoteObject() { + @Override + public IRemoteBroker queryLocalInterface(String s) { + return null; + } - @Test - public void testSparseArray() { - } + @Override + public boolean sendRequest(int i, MessageParcel messageParcel, MessageParcel messageParcel1, MessageOption messageOption) throws RemoteException { + return false; + } - @Test - public void testObjectArray() { - } + @Override + public boolean addDeathRecipient(DeathRecipient deathRecipient, int i) { + return false; + } - @Test - public void testError() { - } + @Override + public boolean removeDeathRecipient(DeathRecipient deathRecipient, int i) { + return false; + } - @Test - public void testMap() { - } + @Override + public String getInterfaceDescriptor() { + return null; + } - @Test - public void testAidlArray() { - } + @Override + public void dump(FileDescriptor fileDescriptor, String[] strings) throws RemoteException { - @Test - public void testPrimitiveArray2() { + } + + @Override + public void slowPathDump(FileDescriptor fileDescriptor, String[] strings) throws RemoteException { + + } + + @Override + public boolean isObjectDead() { + return true; + } + }; + OkBinder.proxy(IRemoteService.class, remoteObject); + boolean objectDead = remoteObject.isObjectDead(); + assertEquals(objectDead,true); } } \ No newline at end of file -- Gitee