Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99ceeec8 authored by Austin Tankiang's avatar Austin Tankiang
Browse files

Stub out activity.registerReceiver in files.MenuManagerTest

MenuManager initiates the JobPanelController on creation, and the latter
calls registerReceiver on the passed in activity on init so it can
receive broadcasts. However the test activity created in MenuManagerTest
does not handle this properly, so stub it out as it is not needed for
the test.

Bug: 412583130
Test: atest -c 'DocumentsUIGoogleTests:com.android.documentsui.files.MenuManagerTest'
Flag: com.android.documentsui.flags.visual_signals_ro
Change-Id: I2d98f4fcc853adf9e4a477824001f3cbef6cb85a
parent f8b1f9be
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16,11 +16,15 @@

package com.android.documentsui.files;

import static com.android.documentsui.util.FlagUtils.isVisualSignalsFlagEnabled;
import static com.android.documentsui.util.FlagUtils.isZipNgFlagEnabled;

import static junit.framework.Assert.assertEquals;

import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;

import android.annotation.SuppressLint;
import android.net.Uri;
@@ -140,6 +144,12 @@ public final class MenuManagerTest {

    @Before
    public void setUp() {
        if (isVisualSignalsFlagEnabled()) {
            // The job progress indicator toolbar icon registers itself as a broadcast receiver to
            // receive updates, so we need to stub that functionality out.
            doReturn(null).when(activity).registerReceiver(any(), any(), anyInt());
        }

        testMenu = TestMenu.create();

        // The context menu on anything in DirectoryList (including no selection).