Skip to content

Commit

Permalink
Back out "Remove unnecessary @PrepareForTest class in PlatformService…
Browse files Browse the repository at this point in the history
…ClientTest"

Summary:
Backing this out since it seems to be causing some test failures with GitHub Actions

Original commit changeset: 54dea95d3bdd

Original Phabricator Diff: D35967525 (facebook@438cb59)

Reviewed By: joesus

Differential Revision: D36071544

fbshipit-source-id: 5697f74b3e56cebf5dea6ed7d29e5f1665b80886
  • Loading branch information
samodom authored and facebook-github-bot committed May 2, 2022
1 parent 438cb59 commit ac25e23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import android.os.IBinder
import android.os.Message
import android.os.Messenger
import android.os.RemoteException
import androidx.annotation.VisibleForTesting
import com.facebook.internal.NativeProtocol.createPlatformServiceIntent
import com.facebook.internal.NativeProtocol.getLatestAvailableProtocolVersionForService
import java.lang.IllegalArgumentException
Expand Down Expand Up @@ -89,7 +88,7 @@ abstract class PlatformServiceClient(
}

override fun onServiceConnected(name: ComponentName, service: IBinder) {
sender = createSender(service)
sender = Messenger(service)
sendMessage()
}

Expand Down Expand Up @@ -121,11 +120,6 @@ abstract class PlatformServiceClient(
}
}

@VisibleForTesting
protected open fun createSender(service: IBinder): Messenger {
return Messenger(service)
}

protected abstract fun populateRequestBundle(data: Bundle)
protected fun handleMessage(message: Message) {
if (message.what == replyMessage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ package com.facebook.internal
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.IBinder
import android.os.Message
import android.os.Messenger
import com.facebook.FacebookPowerMockTestCase
Expand All @@ -36,7 +35,7 @@ import org.junit.Test
import org.powermock.api.mockito.PowerMockito
import org.powermock.core.classloader.annotations.PrepareForTest

@PrepareForTest(NativeProtocol::class)
@PrepareForTest(PlatformServiceClient::class, NativeProtocol::class)
class PlatformServiceClientTest : FacebookPowerMockTestCase() {
private lateinit var mockContext: Context
private lateinit var mockIntent: Intent
Expand All @@ -63,6 +62,7 @@ class PlatformServiceClientTest : FacebookPowerMockTestCase() {
.thenReturn(PROTOCOL_VERSION)
PowerMockito.`when`(NativeProtocol.createPlatformServiceIntent(mockContext))
.thenReturn(mockIntent)
PowerMockito.whenNew(Messenger::class.java).withAnyArguments().thenReturn(mockMessenger)

testClient =
object :
Expand All @@ -76,10 +76,6 @@ class PlatformServiceClientTest : FacebookPowerMockTestCase() {
override fun populateRequestBundle(data: Bundle) {
data.putString("TEST", "TEST_DATA")
}

override fun createSender(service: IBinder): Messenger {
return mockMessenger
}
}
}

Expand Down

0 comments on commit ac25e23

Please sign in to comment.