@Test
    /**
     * Test whether custom items are set correctly.
     */
    public void testCustomItem() {
        PendingIntent action1 = createCustomItemAction(TEST_URL);
        BrowserActionItem customItemWithoutIcon = new BrowserActionItem(CUSTOM_ITEM_TITLE, action1);
        PendingIntent action2 = createCustomItemAction(TEST_URL);
        BrowserActionItem customItemWithIcon =
                new BrowserActionItem(CUSTOM_ITEM_TITLE, action2, android.R.drawable.ic_menu_share);
        ArrayList<BrowserActionItem> customItems = new ArrayList<>();
        customItems.add(customItemWithIcon);
        customItems.add(customItemWithoutIcon);

        BrowserActionsIntent browserActionsIntent = new BrowserActionsIntent.Builder(mContext, mUri)
                                                            .setCustomItems(customItems)
                                                            .build();
        Intent intent = browserActionsIntent.getIntent();
        assertTrue(intent.hasExtra(BrowserActionsIntent.EXTRA_MENU_ITEMS));
        ArrayList<Bundle> bundles =
                intent.getParcelableArrayListExtra(BrowserActionsIntent.EXTRA_MENU_ITEMS);
        assertNotNull(bundles);
        List<BrowserActionItem> items = BrowserActionsIntent.parseBrowserActionItems(bundles);
        assertEquals(2, items.size());
        BrowserActionItem items1 = items.get(0);
        assertEquals(CUSTOM_ITEM_TITLE, items1.getTitle());
        assertEquals(android.R.drawable.ic_menu_share, items1.getIconId());
        assertEquals(action1, items1.getAction());
        BrowserActionItem items2 = items.get(1);
        assertEquals(CUSTOM_ITEM_TITLE, items2.getTitle());
        assertEquals(0, items2.getIconId());
        assertEquals(action2, items2.getAction());
    }
Test whether default {@link BrowserActionsIntent} is populated correctly.
customtabs/tests/src/android/support/customtabs/browseractions/BrowserActionsIntentTest.java