Skip to content

Commit ddc8641

Browse files
committed
Boot completed receiver test
1 parent 2b1b666 commit ddc8641

File tree

10 files changed

+56
-10
lines changed

10 files changed

+56
-10
lines changed

.idea/androidTestResultsUserPreferences.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/deploymentTargetSelector.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/navigator/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ android {
1212
}
1313
}
1414
defaultConfig {
15-
testInstrumentationRunner = "com.w2sv.navigator.HiltTestRunner"
15+
testInstrumentationRunner = "com.w2sv.hilt.HiltTestRunner"
1616
}
1717
}
1818

core/navigator/src/androidTest/kotlin/com/w2sv/navigator/HiltTestRunner.kt renamed to core/navigator/src/androidTest/kotlin/com/w2sv/hilt/HiltTestRunner.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.w2sv.navigator
1+
package com.w2sv.hilt
22

33
import android.app.Application
44
import android.content.Context
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.w2sv.navigator.system_broadcast_receiver
2+
3+
import androidx.test.core.app.ApplicationProvider
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import androidx.test.uiautomator.UiDevice
6+
import com.w2sv.common.util.log
7+
import com.w2sv.navigator.system_broadcastreceiver.BootCompletedReceiver
8+
import org.junit.Before
9+
import org.junit.Test
10+
11+
class BootCompletedReceiverTest {
12+
13+
private val receiver = BootCompletedReceiver()
14+
private lateinit var device: UiDevice
15+
16+
@Before
17+
fun setup() {
18+
device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
19+
}
20+
21+
@Test
22+
fun test() {
23+
receiver.toggle(true, ApplicationProvider.getApplicationContext())
24+
device.executeShellCommand("adb root").log()
25+
}
26+
}

core/navigator/src/main/kotlin/com/w2sv/navigator/system_broadcastreceiver/SystemBroadcastReceiver.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import android.content.Intent
66
import android.content.IntentFilter
77
import slimber.log.i
88

9-
abstract class SystemBroadcastReceiver(private val action: String) : BroadcastReceiver() {
9+
internal abstract class SystemBroadcastReceiver(private val action: String) : BroadcastReceiver() {
1010

1111
private val logIdentifier: String
1212
get() = this::class.java.simpleName
@@ -32,7 +32,7 @@ abstract class SystemBroadcastReceiver(private val action: String) : BroadcastRe
3232
}
3333
}
3434

35-
fun register(context: Context) {
35+
private fun register(context: Context) {
3636
context.registerReceiver(
3737
this,
3838
IntentFilter()
@@ -43,7 +43,7 @@ abstract class SystemBroadcastReceiver(private val action: String) : BroadcastRe
4343
i { "Registered $logIdentifier" }
4444
}
4545

46-
fun unregister(context: Context) {
46+
private fun unregister(context: Context) {
4747
context.unregisterReceiver(this)
4848
i { "Unregistered $logIdentifier" }
4949
}

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
minSdk = "30" # 29 = min for MediaStore.Downloads.EXTERNAL_CONTENT_URI
33
compileSdk = "34"
44

5-
agp = "8.6.1"
5+
agp = "8.7.1"
66
kotlin = "2.0.20"
77
java = "17"
88
ksp = "2.0.20-1.0.25"
99
triplet-play = "3.11.0"
1010
protobuf-plugin = "0.9.4"
1111

12-
compose-tooling = "1.7.3"
12+
compose-tooling = "1.7.4"
1313
compose-material3 = "1.3.0"
1414
hilt = "2.52"
1515
junit = "4.13.2"
@@ -22,7 +22,7 @@ materialKolor = "1.7.0"
2222
compose-destinations = "2.0.0-beta01"
2323
hiltNavigationCompose = "1.2.0"
2424
protobuf = "4.28.2"
25-
androidxActivity = "1.9.2"
25+
androidxActivity = "1.9.3"
2626
kotlinutils = "0.1.3-rc1"
2727
datastoreutils = "0.0.4-rc1"
2828
kotlinxCoroutines = "1.9.0"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)