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

Commit 348d2668 authored by Ben Murdoch's avatar Ben Murdoch
Browse files

Fix up ModifierShortcutsTests to use test bookmarks.xml

Rather than relying on the device version of bookmarks.xml which
may not align with the shortcuts to be tested in the test case, use
the frozen copy of bookmarks.xml in the test APK.

Flag: TEST_ONLY
Bug: 312452252
Test: atest ModifierShortcutTests
Change-Id: Ica2ff886f3a930cfb75ca5b4889a69eb30f29a7f
parent 9ded1170
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase {
    private static final SparseArray<String> INTENT_SHORTCUTS =  new SparseArray<>();
    private static final SparseArray<String> ROLE_SHORTCUTS =  new SparseArray<>();
    static {
        // These shortcuts should align with those defined in bookmarks.xml
        // These shortcuts should align with those defined in
        // services/tests/wmtests/res/xml/bookmarks.xml
        INTENT_SHORTCUTS.append(KEYCODE_U, Intent.CATEGORY_APP_CALCULATOR);
        INTENT_SHORTCUTS.append(KEYCODE_C, Intent.CATEGORY_APP_CONTACTS);
        INTENT_SHORTCUTS.append(KEYCODE_E, Intent.CATEGORY_APP_EMAIL);
+4 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import static java.util.Collections.unmodifiableMap;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.platform.test.flag.junit.SetFlagsRule;
import android.util.ArrayMap;
import android.view.InputDevice;
@@ -102,6 +103,9 @@ class ShortcutKeyTestBase {
        doReturn(mResources).when(mContext).getResources();
        doReturn(mSettingsProviderRule.mockContentResolver(mContext))
                .when(mContext).getContentResolver();
        XmlResourceParser testBookmarks = mResources.getXml(
                com.android.frameworks.wmtests.R.xml.bookmarks);
        doReturn(testBookmarks).when(mResources).getXml(com.android.internal.R.xml.bookmarks);
    }