Compare commits
5 Commits
9dba1219bc
...
401338d566
Author | SHA1 | Date | |
---|---|---|---|
|
401338d566 | ||
|
0a009f7f4b | ||
|
e42860f73c | ||
|
49bf4598ff | ||
|
89475d0919 |
|
@ -39,7 +39,7 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.6.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'ie.equalit.ouinet:ouinet-arm64-v8a:0.20.0'
|
||||
implementation 'ie.equalit.ouinet:ouinet-omni:0.21.3'
|
||||
implementation 'com.getkeepsafe.relinker:relinker:1.4.4'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
|
|
|
@ -44,7 +44,7 @@ dependencies {
|
|||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.6.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'ie.equalit.ouinet:ouinet-arm64-v8a:0.20.0'
|
||||
implementation 'ie.equalit.ouinet:ouinet-omni:0.21.3'
|
||||
implementation 'com.getkeepsafe.relinker:relinker:1.4.4'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
package ie.equalit.ouinet_examples.android_kotlin
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("ie.equalit.ouinet_examples.android_kotlin", appContext.packageName)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package ie.equalit.ouinet_examples.android_kotlin
|
||||
|
||||
import ie.equalit.ouinet.Config
|
||||
import ie.equalit.ouinet.Ouinet
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class OuinetInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("ie.equalit.ouinet_examples.android_kotlin", appContext.packageName)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testStartStop() {
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
var config = Config.ConfigBuilder(appContext)
|
||||
.setCacheType("bep5-http")
|
||||
.setCacheHttpPubKey(BuildConfig.CACHE_PUB_KEY)
|
||||
.build()
|
||||
|
||||
var ouinet = Ouinet(appContext, config)
|
||||
|
||||
for (i in 1..5) {
|
||||
ouinet.start()
|
||||
Thread.sleep(1000);
|
||||
assertTrue(ouinet.state.toString().startsWith("Start"))
|
||||
|
||||
ouinet.stop()
|
||||
assertEquals("Stopped", ouinet.state.toString());
|
||||
}
|
||||
|
||||
for (i in 1..3) {
|
||||
Thread.sleep(100);
|
||||
ouinet.stop()
|
||||
assertEquals("Stopped", ouinet.state.toString());
|
||||
}
|
||||
|
||||
ouinet.start()
|
||||
Thread.sleep(1000);
|
||||
assertTrue(ouinet.state.toString().startsWith("Start"))
|
||||
ouinet.stop()
|
||||
assertEquals("Stopped", ouinet.state.toString());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user