-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
duwen
committed
Feb 5, 2018
1 parent
13f6249
commit 88f7639
Showing
8 changed files
with
97 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
app/src/androidTest/java/wendu/jsbdemo/CallJavascriptActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters