summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/ProgramFragmentFixedFunction.java
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2021-01-06 01:36:07 +0900
committerLorenzo Colitti <lorenzo@google.com>2021-01-14 17:11:28 +0900
commit755cf3be3f2dc0811d005473f25ac4c2a119c8d4 (patch)
tree0f1a2905a9a03d93d630962aa8ecbfde560557f8 /rs/java/android/renderscript/ProgramFragmentFixedFunction.java
parent4decf59c895a6cc09b4c5176b995185213acc388 (diff)
Improve testing of CONNECTIVITY_ACTION broadcasts.
We currently test CONNECTIVITY_ACTION broadcasts by directly registering BroadcastReceivers with BroadcastInterceptingContext, and making the receivers unregister themselves when all the broadcasts they expect have been received. This works for current test cases, but does not work if anything registers another receiver for CONNECTIVITY_ACTION. In that case, when we unregister the receiver in the receiver's onReceive method, BroadcastInterceptingContext will throw a ConcurrentModificationException because the list of receivers is being modified during iteration. Fix this by adding an ExpectedBroadcast class that stores the receiver and unregisters the receiver only when the test checks that the broadcast was received, which happens after the receiver runs. This is easier to use and also guarantees that the receiver is unregistered even if the test is expecting that the broadcast is never fired. Accordingly, remove mRegisteredReceivers and the code that uses it; it's no longer necessary now that ExpectedBroadcast always unregisters its receivers. Also add a convenience expectConnectivityAction method to expect a CONNECTIVITY_ACTION broadcast with specific contents. This makes the test easier to read and more detailed. Convert some existing tests to this method. While I'm at it, fix a test that was using "mCellNetworkAgent" to represent a wifi network. Bug: 173331190 Test: test-only change Change-Id: Ibada8b4215625e1016d9fd170526206920af76f5
Diffstat (limited to 'rs/java/android/renderscript/ProgramFragmentFixedFunction.java')
0 files changed, 0 insertions, 0 deletions