For #21183: remove lazyMonitored wrapper functionality.
We're not using the functionality so there's no sense in doing the work. However, we keep the wrapper: see the code comments for details.upstream-sync
parent
09fe569b30
commit
4fe6a4506d
@ -1,36 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.perf
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class LazyMonitoredTest {
|
||||
|
||||
private val componentInitCount get() = ComponentInitCount.count.get()
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
ComponentInitCount.count.set(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN accessing a lazy monitored THEN it returns the initializer value`() {
|
||||
val actual by lazyMonitored { 4 }
|
||||
assertEquals(4, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN accessing a lazy monitored THEN the component init count is incremented`() {
|
||||
assertEquals(0, componentInitCount)
|
||||
|
||||
val monitored by lazyMonitored { }
|
||||
// We must access the value to trigger init.
|
||||
@Suppress("UNUSED_EXPRESSION") monitored
|
||||
|
||||
assertEquals(1, componentInitCount)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue