mobile/android/base/tests/testLinkContextMenu.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/tests/testLinkContextMenu.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +package org.mozilla.gecko.tests;
     1.5 +
     1.6 +
     1.7 +public class testLinkContextMenu extends ContentContextMenuTest {
     1.8 +
     1.9 +    // Test website strings
    1.10 +    private static String LINK_PAGE_URL;
    1.11 +    private static String BLANK_PAGE_URL;
    1.12 +    private static final String LINK_PAGE_TITLE = "Big Link";
    1.13 +    private static final String linkMenuItems [] = { "Open Link in New Tab", "Open Link in Private Tab", "Copy Link", "Share Link", "Bookmark Link"};
    1.14 +
    1.15 +    public void testLinkContextMenu() {
    1.16 +        blockForGeckoReady();
    1.17 +
    1.18 +        LINK_PAGE_URL=getAbsoluteUrl("/robocop/robocop_big_link.html");
    1.19 +        BLANK_PAGE_URL=getAbsoluteUrl("/robocop/robocop_blank_01.html");
    1.20 +        inputAndLoadUrl(LINK_PAGE_URL);
    1.21 +        waitForText(LINK_PAGE_TITLE);
    1.22 +
    1.23 +        verifyContextMenuItems(linkMenuItems); // Verify context menu items are correct
    1.24 +        openTabFromContextMenu(linkMenuItems[0],2); // Test the "Open in New Tab" option - expecting 2 tabs: the original and the new one
    1.25 +        openTabFromContextMenu(linkMenuItems[1],2); // Test the "Open in Private Tab" option - expecting only 2 tabs in normal mode
    1.26 +        verifyCopyOption(linkMenuItems[2], BLANK_PAGE_URL); // Test the "Copy Link" option
    1.27 +        verifyShareOption(linkMenuItems[3], LINK_PAGE_TITLE); // Test the "Share Link" option
    1.28 +        verifyBookmarkLinkOption(linkMenuItems[4], BLANK_PAGE_URL); // Test the "Bookmark Link" option
    1.29 +    }
    1.30 +
    1.31 +    @Override
    1.32 +    public void tearDown() throws Exception {
    1.33 +        mDatabaseHelper.deleteBookmark(BLANK_PAGE_URL);
    1.34 +        super.tearDown();
    1.35 +    }
    1.36 +}

mercurial