Skip to content

Commit

Permalink
add to travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
duwen committed Feb 5, 2018
1 parent 13f6249 commit 88f7639
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 23 deletions.
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: android
jdk: oraclejdk8
android:
components:
- platform-tools
- tools

# The BuildTools version used by your project
- build-tools-25.0.0


# The SDK version used to compile your project
- android-23

# Support library
- extra-android-support
- extra-android-m2repository
- sys-img-x86_64-android-22
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'

script:
- android list target

6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package wendu.jsbdemo;

import android.os.SystemClock;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.ActivityInstrumentationTestCase2;
import android.view.View;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import wendu.dsbridge.DWebView;
import wendu.dsbridge.OnReturnValue;

/**
* Created by du on 2018/2/5.
*/
@RunWith (AndroidJUnit4.class)
public class CallJavascriptActivityTest extends ActivityInstrumentationTestCase2<CallJavascriptActivity> {

private DWebView dWebView;

public CallJavascriptActivityTest() {
super(CallJavascriptActivity.class);
}

@Override
@Before
public void setUp() throws Exception {
super.setUp();
// Injecting the Instrumentation instance is required
// for your test to run with AndroidJUnitRunner.
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
CallJavascriptActivity activity=getActivity();
dWebView= (DWebView) getActivity().findViewById(R.id.webview);
//dWebView.loadUrl("file:///android_asset/js-call-native.html");
DWebView.setWebContentsDebuggingEnabled(true);
}

@After
public void tearDown() throws Exception {

}

@Test
public void onClick(View v) throws Exception {
dWebView.callHandler("addValue", new Object[]{3, 4}, new OnReturnValue<Integer>() {
@Override
public void onValue(Integer retValue) {
assertEquals(7,retValue.intValue());
}
});
SystemClock.sleep(5000);
}

}
1 change: 1 addition & 0 deletions app/src/main/assets/js-call-native.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@

function callProgress() {
dsBridge.call("callProgress", function (value) {
if(value==0) value="";
document.getElementById("progress").innerText = value
})
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/wendu/jsbdemo/JsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void onTick(long millisUntilFinished) {
@Override
public void onFinish() {
//complete the js invocation with data; handler will be invalid when complete is called
handler.complete();
handler.complete(0);

}
}.start();
Expand Down
17 changes: 0 additions & 17 deletions app/src/test/java/wendu/jsbdemo/ExampleUnitTest.java

This file was deleted.

4 changes: 2 additions & 2 deletions readme-chs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# DSBridge

[![](https://jitpack.io/v/wendux/DSBridge-Android.svg)](https://jitpack.io/#wendux/DSBridge-Android) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/mit-license.php)
[![](https://jitpack.io/v/wendux/DSBridge-Android.svg)](https://jitpack.io/#wendux/DSBridge-Android) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/mit-license.php) [![](https://travis-ci.org/wendux/DSBridge-Android.svg?branch=x5-3.0)](https://travis-ci.org/wendux/DSBridge-Android)
> 三端易用的现代跨平台的 Javascript bridge, 通过它,你可以在Javascript和原生之间同步或异步的调用彼此的函数.

Expand Down Expand Up @@ -192,7 +192,7 @@ public void callProgress(Object args, final CompletionHandler<Integer> handler)
public void onFinish() {
//complete the js invocation with data;
//handler will invalid when complete is called
handler.complete();
handler.complete(0);
}
}.start();
}
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# DSBridge

[![](https://jitpack.io/v/wendux/DSBridge-Android.svg)](https://jitpack.io/#wendux/DSBridge-Android) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/mit-license.php)
[![](https://jitpack.io/v/wendux/DSBridge-Android.svg)](https://jitpack.io/#wendux/DSBridge-Android) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/mit-license.php) [![](https://travis-ci.org/wendux/DSBridge-Android.svg?branch=x5-3.0)](https://travis-ci.org/wendux/DSBridge-Android)
>Modern cross-platform JavaScript bridge, through which you can invoke each other's functions synchronously or asynchronously between JavaScript and native applications.

Expand Down Expand Up @@ -55,7 +55,7 @@ DSBridge v3.0 is a milestone version. Compared with v2.0, we have made a lot of

See the `wendu.jsbdemo/` package. run the `app` project and to see it in action.

To use a dsBridge in your own project:
To use dsBridge in your own project:

## Usage

Expand Down Expand Up @@ -179,7 +179,7 @@ public void callProgress(Object args, final CompletionHandler<Integer> handler)
public void onFinish() {
//complete the js invocation with data;
//handler will be invalid when complete is called
handler.complete();
handler.complete(0);
}
}.start();
}
Expand Down

0 comments on commit 88f7639

Please sign in to comment.