Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/FakeBubbleFactory.kt +4 −5 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ class FakeBubbleFactory { context: Context, bubblePositioner: BubblePositioner, expandedViewManager: BubbleExpandedViewManager, bubble: Bubble, bubbleTaskView: BubbleTaskView, mainExecutor: TestShellExecutor, bgExecutor: TestShellExecutor, Loading @@ -50,23 +51,24 @@ class FakeBubbleFactory { expandedViewManager, bubblePositioner, false, /* isOverflow */ bubble, bubbleTaskView, mainExecutor, bgExecutor, null, /* regionSamplingProvider */ ) } bubble.setViewInfo(createViewInfo(bubbleBarExpandedView)) return bubbleBarExpandedView } fun createViewInfo(bubbleExpandedView: BubbleBarExpandedView): BubbleViewInfo { private fun createViewInfo(bubbleExpandedView: BubbleBarExpandedView): BubbleViewInfo { return BubbleViewInfo().apply { bubbleBarExpandedView = bubbleExpandedView } } fun createChatBubble( context: Context, key: String = "key", viewInfo: BubbleViewInfo? = null, ): Bubble { val bubble = Bubble( Loading @@ -81,9 +83,6 @@ class FakeBubbleFactory { directExecutor(), directExecutor(), ) {} if (viewInfo != null) { bubble.setViewInfo(viewInfo) } return bubble } } Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarAnimationHelperTest.kt +12 −12 Original line number Diff line number Diff line Loading @@ -340,20 +340,20 @@ class BubbleBarAnimationHelperTest { val taskView = TaskView(context, taskViewController, taskViewTaskController) val taskInfo = mock<ActivityManager.RunningTaskInfo>() whenever(taskViewTaskController.taskInfo).thenReturn(taskInfo) val bubble = FakeBubbleFactory.createChatBubble(context, key) val bubbleTaskView = BubbleTaskView(taskView, mainExecutor) val bubbleBarExpandedView = FakeBubbleFactory.createExpandedView( context, bubblePositioner, expandedViewManager, bubble, bubbleTaskView, mainExecutor, bgExecutor, bubbleLogger, ) val viewInfo = FakeBubbleFactory.createViewInfo(bubbleBarExpandedView) return FakeBubbleFactory.createChatBubble(context, key, viewInfo) return bubble } private fun createOverflow(): BubbleOverflow { Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedViewTest.kt +12 −36 Original line number Diff line number Diff line Loading @@ -16,10 +16,8 @@ package com.android.wm.shell.bubbles.bar import android.app.ActivityManager import android.content.ComponentName import android.content.Context import android.content.pm.ShortcutInfo import android.graphics.Insets import android.graphics.Rect import android.view.LayoutInflater Loading @@ -38,25 +36,20 @@ import com.android.wm.shell.bubbles.BubbleExpandedViewManager import com.android.wm.shell.bubbles.BubbleLogger import com.android.wm.shell.bubbles.BubblePositioner import com.android.wm.shell.bubbles.BubbleTaskView import com.android.wm.shell.bubbles.BubbleTaskViewFactory import com.android.wm.shell.bubbles.FakeBubbleExpandedViewManager import com.android.wm.shell.bubbles.FakeBubbleFactory import com.android.wm.shell.bubbles.FakeBubbleTaskViewFactory import com.android.wm.shell.bubbles.RegionSamplingProvider import com.android.wm.shell.bubbles.UiEventSubject.Companion.assertThat import com.android.wm.shell.common.TestShellExecutor import com.android.wm.shell.shared.bubbles.DeviceConfig import com.android.wm.shell.shared.handles.RegionSamplingHelper import com.android.wm.shell.taskview.TaskView import com.android.wm.shell.taskview.TaskViewController import com.android.wm.shell.taskview.TaskViewTaskController import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage import com.google.common.util.concurrent.MoreExecutors.directExecutor import org.junit.After import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever import java.util.concurrent.Executor /** Tests for [BubbleBarExpandedViewTest] */ Loading @@ -78,6 +71,7 @@ class BubbleBarExpandedViewTest { private lateinit var positioner: BubblePositioner private lateinit var bubbleTaskView: BubbleTaskView private lateinit var bubble: Bubble private lateinit var bubbleTaskViewFactory: FakeBubbleTaskViewFactory private lateinit var bubbleExpandedView: BubbleBarExpandedView private var testableRegionSamplingHelper: TestableRegionSamplingHelper? = null Loading Loading @@ -105,13 +99,14 @@ class BubbleBarExpandedViewTest { positioner.update(deviceConfig) expandedViewManager = FakeBubbleExpandedViewManager(bubbleBar = true, expanded = true) bubbleTaskView = FakeBubbleTaskViewFactory().create() bubbleTaskViewFactory = FakeBubbleTaskViewFactory(context, mainExecutor) val inflater = LayoutInflater.from(context) bubble = FakeBubbleFactory.createChatBubble(context) bubbleTaskView = bubbleTaskViewFactory.create() regionSamplingProvider = TestRegionSamplingProvider() bubbleExpandedView = inflater.inflate( bubbleExpandedView = LayoutInflater.from(context).inflate( R.layout.bubble_bar_expanded_view, null, false /* attachToRoot */ ) as BubbleBarExpandedView bubbleExpandedView.bubbleLogger = BubbleLogger(uiEventLoggerFake) Loading @@ -119,6 +114,7 @@ class BubbleBarExpandedViewTest { expandedViewManager, positioner, false /* isOverflow */, bubble, bubbleTaskView, mainExecutor, bgExecutor, Loading @@ -131,18 +127,6 @@ class BubbleBarExpandedViewTest { testableRegionSamplingHelper = regionSamplingProvider!!.helper } bubble = Bubble( "key", ShortcutInfo.Builder(context, "id").build(), 100 /* desiredHeight */, 0 /* desiredHeightResId */, "title", 0 /* taskId */, null /* locus */, true /* isDismissable */, directExecutor(), directExecutor() ) {} bubbleExpandedView.update(bubble) } Loading Loading @@ -270,7 +254,7 @@ class BubbleBarExpandedViewTest { val expandedView = inflater.inflate( R.layout.bubble_bar_expanded_view, null, false /* attachToRoot */ ) as BubbleBarExpandedView val taskView = FakeBubbleTaskViewFactory().create() val taskView = bubbleTaskViewFactory.create() val taskViewParent = FrameLayout(context) taskViewParent.addView(taskView.taskView) taskView.listener.onTaskCreated(666, ComponentName(context, "BubbleBarExpandedViewTest")) Loading @@ -280,6 +264,7 @@ class BubbleBarExpandedViewTest { expandedViewManager, positioner, false /* isOverflow */, bubble, taskView, mainExecutor, bgExecutor, Loading Loading @@ -309,7 +294,7 @@ class BubbleBarExpandedViewTest { val expandedView = inflater.inflate( R.layout.bubble_bar_expanded_view, null, false /* attachToRoot */ ) as BubbleBarExpandedView val taskView = FakeBubbleTaskViewFactory().create() val taskView = bubbleTaskViewFactory.create() val taskViewParent = FrameLayout(context) taskViewParent.addView(taskView.taskView) taskView.listener.onTaskCreated(666, ComponentName(context, "BubbleBarExpandedViewTest")) Loading @@ -321,6 +306,7 @@ class BubbleBarExpandedViewTest { expandedViewManager, positioner, false /* isOverflow */, bubble, taskView, mainExecutor, bgExecutor, Loading Loading @@ -352,16 +338,6 @@ class BubbleBarExpandedViewTest { return views.first().parent as View } private inner class FakeBubbleTaskViewFactory : BubbleTaskViewFactory { override fun create(): BubbleTaskView { val taskViewTaskController = mock<TaskViewTaskController>() val taskView = TaskView(context, mock<TaskViewController>(), taskViewTaskController) val taskInfo = mock<ActivityManager.RunningTaskInfo>() whenever(taskViewTaskController.taskInfo).thenReturn(taskInfo) return BubbleTaskView(taskView, mainExecutor) } } private inner class TestRegionSamplingProvider : RegionSamplingProvider { lateinit var helper: TestableRegionSamplingHelper Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerViewTest.kt +5 −4 Original line number Diff line number Diff line Loading @@ -473,12 +473,16 @@ class BubbleBarLayerViewTest { } private fun createBubble(key: String): Bubble { val bubble = FakeBubbleFactory.createChatBubble(context, key).also { testBubblesList.add(it) } val bubbleTaskView = FakeBubbleTaskViewFactory(context, mainExecutor).create() val bubbleBarExpandedView = FakeBubbleFactory.createExpandedView( context, bubblePositioner, expandedViewManager, bubble, bubbleTaskView, mainExecutor, bgExecutor, Loading @@ -487,10 +491,7 @@ class BubbleBarLayerViewTest { // Mark visible so we don't wait for task view before animations can start bubbleBarExpandedView.onContentVisibilityChanged(true /* visible */) val viewInfo = FakeBubbleFactory.createViewInfo(bubbleBarExpandedView) return FakeBubbleFactory.createChatBubble(context, key, viewInfo).also { testBubblesList.add(it) } return bubble } private fun leftEdge(): PointF { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ class BubbleOverflow(private val context: Context, private val positioner: Bubbl expandedViewManager, positioner, /* isOverflow= */ true, /* bubble= */ null, /* bubbleTaskView= */ null, /* mainExecutor= */ null, /* backgroundExecutor= */ null, Loading Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/FakeBubbleFactory.kt +4 −5 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ class FakeBubbleFactory { context: Context, bubblePositioner: BubblePositioner, expandedViewManager: BubbleExpandedViewManager, bubble: Bubble, bubbleTaskView: BubbleTaskView, mainExecutor: TestShellExecutor, bgExecutor: TestShellExecutor, Loading @@ -50,23 +51,24 @@ class FakeBubbleFactory { expandedViewManager, bubblePositioner, false, /* isOverflow */ bubble, bubbleTaskView, mainExecutor, bgExecutor, null, /* regionSamplingProvider */ ) } bubble.setViewInfo(createViewInfo(bubbleBarExpandedView)) return bubbleBarExpandedView } fun createViewInfo(bubbleExpandedView: BubbleBarExpandedView): BubbleViewInfo { private fun createViewInfo(bubbleExpandedView: BubbleBarExpandedView): BubbleViewInfo { return BubbleViewInfo().apply { bubbleBarExpandedView = bubbleExpandedView } } fun createChatBubble( context: Context, key: String = "key", viewInfo: BubbleViewInfo? = null, ): Bubble { val bubble = Bubble( Loading @@ -81,9 +83,6 @@ class FakeBubbleFactory { directExecutor(), directExecutor(), ) {} if (viewInfo != null) { bubble.setViewInfo(viewInfo) } return bubble } } Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarAnimationHelperTest.kt +12 −12 Original line number Diff line number Diff line Loading @@ -340,20 +340,20 @@ class BubbleBarAnimationHelperTest { val taskView = TaskView(context, taskViewController, taskViewTaskController) val taskInfo = mock<ActivityManager.RunningTaskInfo>() whenever(taskViewTaskController.taskInfo).thenReturn(taskInfo) val bubble = FakeBubbleFactory.createChatBubble(context, key) val bubbleTaskView = BubbleTaskView(taskView, mainExecutor) val bubbleBarExpandedView = FakeBubbleFactory.createExpandedView( context, bubblePositioner, expandedViewManager, bubble, bubbleTaskView, mainExecutor, bgExecutor, bubbleLogger, ) val viewInfo = FakeBubbleFactory.createViewInfo(bubbleBarExpandedView) return FakeBubbleFactory.createChatBubble(context, key, viewInfo) return bubble } private fun createOverflow(): BubbleOverflow { Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedViewTest.kt +12 −36 Original line number Diff line number Diff line Loading @@ -16,10 +16,8 @@ package com.android.wm.shell.bubbles.bar import android.app.ActivityManager import android.content.ComponentName import android.content.Context import android.content.pm.ShortcutInfo import android.graphics.Insets import android.graphics.Rect import android.view.LayoutInflater Loading @@ -38,25 +36,20 @@ import com.android.wm.shell.bubbles.BubbleExpandedViewManager import com.android.wm.shell.bubbles.BubbleLogger import com.android.wm.shell.bubbles.BubblePositioner import com.android.wm.shell.bubbles.BubbleTaskView import com.android.wm.shell.bubbles.BubbleTaskViewFactory import com.android.wm.shell.bubbles.FakeBubbleExpandedViewManager import com.android.wm.shell.bubbles.FakeBubbleFactory import com.android.wm.shell.bubbles.FakeBubbleTaskViewFactory import com.android.wm.shell.bubbles.RegionSamplingProvider import com.android.wm.shell.bubbles.UiEventSubject.Companion.assertThat import com.android.wm.shell.common.TestShellExecutor import com.android.wm.shell.shared.bubbles.DeviceConfig import com.android.wm.shell.shared.handles.RegionSamplingHelper import com.android.wm.shell.taskview.TaskView import com.android.wm.shell.taskview.TaskViewController import com.android.wm.shell.taskview.TaskViewTaskController import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage import com.google.common.util.concurrent.MoreExecutors.directExecutor import org.junit.After import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever import java.util.concurrent.Executor /** Tests for [BubbleBarExpandedViewTest] */ Loading @@ -78,6 +71,7 @@ class BubbleBarExpandedViewTest { private lateinit var positioner: BubblePositioner private lateinit var bubbleTaskView: BubbleTaskView private lateinit var bubble: Bubble private lateinit var bubbleTaskViewFactory: FakeBubbleTaskViewFactory private lateinit var bubbleExpandedView: BubbleBarExpandedView private var testableRegionSamplingHelper: TestableRegionSamplingHelper? = null Loading Loading @@ -105,13 +99,14 @@ class BubbleBarExpandedViewTest { positioner.update(deviceConfig) expandedViewManager = FakeBubbleExpandedViewManager(bubbleBar = true, expanded = true) bubbleTaskView = FakeBubbleTaskViewFactory().create() bubbleTaskViewFactory = FakeBubbleTaskViewFactory(context, mainExecutor) val inflater = LayoutInflater.from(context) bubble = FakeBubbleFactory.createChatBubble(context) bubbleTaskView = bubbleTaskViewFactory.create() regionSamplingProvider = TestRegionSamplingProvider() bubbleExpandedView = inflater.inflate( bubbleExpandedView = LayoutInflater.from(context).inflate( R.layout.bubble_bar_expanded_view, null, false /* attachToRoot */ ) as BubbleBarExpandedView bubbleExpandedView.bubbleLogger = BubbleLogger(uiEventLoggerFake) Loading @@ -119,6 +114,7 @@ class BubbleBarExpandedViewTest { expandedViewManager, positioner, false /* isOverflow */, bubble, bubbleTaskView, mainExecutor, bgExecutor, Loading @@ -131,18 +127,6 @@ class BubbleBarExpandedViewTest { testableRegionSamplingHelper = regionSamplingProvider!!.helper } bubble = Bubble( "key", ShortcutInfo.Builder(context, "id").build(), 100 /* desiredHeight */, 0 /* desiredHeightResId */, "title", 0 /* taskId */, null /* locus */, true /* isDismissable */, directExecutor(), directExecutor() ) {} bubbleExpandedView.update(bubble) } Loading Loading @@ -270,7 +254,7 @@ class BubbleBarExpandedViewTest { val expandedView = inflater.inflate( R.layout.bubble_bar_expanded_view, null, false /* attachToRoot */ ) as BubbleBarExpandedView val taskView = FakeBubbleTaskViewFactory().create() val taskView = bubbleTaskViewFactory.create() val taskViewParent = FrameLayout(context) taskViewParent.addView(taskView.taskView) taskView.listener.onTaskCreated(666, ComponentName(context, "BubbleBarExpandedViewTest")) Loading @@ -280,6 +264,7 @@ class BubbleBarExpandedViewTest { expandedViewManager, positioner, false /* isOverflow */, bubble, taskView, mainExecutor, bgExecutor, Loading Loading @@ -309,7 +294,7 @@ class BubbleBarExpandedViewTest { val expandedView = inflater.inflate( R.layout.bubble_bar_expanded_view, null, false /* attachToRoot */ ) as BubbleBarExpandedView val taskView = FakeBubbleTaskViewFactory().create() val taskView = bubbleTaskViewFactory.create() val taskViewParent = FrameLayout(context) taskViewParent.addView(taskView.taskView) taskView.listener.onTaskCreated(666, ComponentName(context, "BubbleBarExpandedViewTest")) Loading @@ -321,6 +306,7 @@ class BubbleBarExpandedViewTest { expandedViewManager, positioner, false /* isOverflow */, bubble, taskView, mainExecutor, bgExecutor, Loading Loading @@ -352,16 +338,6 @@ class BubbleBarExpandedViewTest { return views.first().parent as View } private inner class FakeBubbleTaskViewFactory : BubbleTaskViewFactory { override fun create(): BubbleTaskView { val taskViewTaskController = mock<TaskViewTaskController>() val taskView = TaskView(context, mock<TaskViewController>(), taskViewTaskController) val taskInfo = mock<ActivityManager.RunningTaskInfo>() whenever(taskViewTaskController.taskInfo).thenReturn(taskInfo) return BubbleTaskView(taskView, mainExecutor) } } private inner class TestRegionSamplingProvider : RegionSamplingProvider { lateinit var helper: TestableRegionSamplingHelper Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerViewTest.kt +5 −4 Original line number Diff line number Diff line Loading @@ -473,12 +473,16 @@ class BubbleBarLayerViewTest { } private fun createBubble(key: String): Bubble { val bubble = FakeBubbleFactory.createChatBubble(context, key).also { testBubblesList.add(it) } val bubbleTaskView = FakeBubbleTaskViewFactory(context, mainExecutor).create() val bubbleBarExpandedView = FakeBubbleFactory.createExpandedView( context, bubblePositioner, expandedViewManager, bubble, bubbleTaskView, mainExecutor, bgExecutor, Loading @@ -487,10 +491,7 @@ class BubbleBarLayerViewTest { // Mark visible so we don't wait for task view before animations can start bubbleBarExpandedView.onContentVisibilityChanged(true /* visible */) val viewInfo = FakeBubbleFactory.createViewInfo(bubbleBarExpandedView) return FakeBubbleFactory.createChatBubble(context, key, viewInfo).also { testBubblesList.add(it) } return bubble } private fun leftEdge(): PointF { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ class BubbleOverflow(private val context: Context, private val positioner: Bubbl expandedViewManager, positioner, /* isOverflow= */ true, /* bubble= */ null, /* bubbleTaskView= */ null, /* mainExecutor= */ null, /* backgroundExecutor= */ null, Loading