michael@0: package org.mozilla.gecko.tests; michael@0: michael@0: michael@0: public class testPictureLinkContextMenu extends ContentContextMenuTest { michael@0: michael@0: // Test website strings michael@0: private static String PICTURE_PAGE_URL; michael@0: private static String BLANK_PAGE_URL; michael@0: private static final String PICTURE_PAGE_TITLE = "Picture Link"; michael@0: private static final String tabs [] = { "Image", "Link" }; michael@0: private static final String photoMenuItems [] = { "Copy Image Location", "Share Image", "Set Image As", "Save Image" }; michael@0: private static final String linkMenuItems [] = { "Open Link in New Tab", "Open Link in Private Tab", "Copy Link", "Share Link", "Bookmark Link"}; michael@0: private static final String imageTitle = "^Image$"; michael@0: michael@0: public void testPictureLinkContextMenu() { michael@0: blockForGeckoReady(); michael@0: michael@0: PICTURE_PAGE_URL=getAbsoluteUrl("/robocop/robocop_picture_link.html"); michael@0: BLANK_PAGE_URL=getAbsoluteUrl("/robocop/robocop_blank_02.html"); michael@0: loadAndPaint(PICTURE_PAGE_URL); michael@0: verifyPageTitle(PICTURE_PAGE_TITLE); michael@0: michael@0: switchTabs(imageTitle); michael@0: verifyContextMenuItems(photoMenuItems); michael@0: verifyTabs(tabs); michael@0: switchTabs(imageTitle); michael@0: verifyCopyOption(photoMenuItems[0], "Firefox.jpg"); // Test the "Copy Image Location" option michael@0: switchTabs(imageTitle); michael@0: verifyShareOption(photoMenuItems[1], PICTURE_PAGE_TITLE); // Test the "Share Image" option michael@0: michael@0: verifyContextMenuItems(linkMenuItems); michael@0: openTabFromContextMenu(linkMenuItems[0],2); // Test the "Open in New Tab" option - expecting 2 tabs: the original and the new one michael@0: openTabFromContextMenu(linkMenuItems[1],2); // Test the "Open in Private Tab" option - expecting only 2 tabs in normal mode michael@0: verifyCopyOption(linkMenuItems[2], BLANK_PAGE_URL); // Test the "Copy Link" option michael@0: verifyShareOption(linkMenuItems[3], PICTURE_PAGE_TITLE); // Test the "Share Link" option michael@0: verifyBookmarkLinkOption(linkMenuItems[4],BLANK_PAGE_URL); // Test the "Bookmark Link" option michael@0: } michael@0: michael@0: @Override michael@0: public void tearDown() throws Exception { michael@0: mDatabaseHelper.deleteBookmark(BLANK_PAGE_URL); michael@0: super.tearDown(); michael@0: } michael@0: }