mobile/android/base/tests/testPictureLinkContextMenu.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 package org.mozilla.gecko.tests;
michael@0 2
michael@0 3
michael@0 4 public class testPictureLinkContextMenu extends ContentContextMenuTest {
michael@0 5
michael@0 6 // Test website strings
michael@0 7 private static String PICTURE_PAGE_URL;
michael@0 8 private static String BLANK_PAGE_URL;
michael@0 9 private static final String PICTURE_PAGE_TITLE = "Picture Link";
michael@0 10 private static final String tabs [] = { "Image", "Link" };
michael@0 11 private static final String photoMenuItems [] = { "Copy Image Location", "Share Image", "Set Image As", "Save Image" };
michael@0 12 private static final String linkMenuItems [] = { "Open Link in New Tab", "Open Link in Private Tab", "Copy Link", "Share Link", "Bookmark Link"};
michael@0 13 private static final String imageTitle = "^Image$";
michael@0 14
michael@0 15 public void testPictureLinkContextMenu() {
michael@0 16 blockForGeckoReady();
michael@0 17
michael@0 18 PICTURE_PAGE_URL=getAbsoluteUrl("/robocop/robocop_picture_link.html");
michael@0 19 BLANK_PAGE_URL=getAbsoluteUrl("/robocop/robocop_blank_02.html");
michael@0 20 loadAndPaint(PICTURE_PAGE_URL);
michael@0 21 verifyPageTitle(PICTURE_PAGE_TITLE);
michael@0 22
michael@0 23 switchTabs(imageTitle);
michael@0 24 verifyContextMenuItems(photoMenuItems);
michael@0 25 verifyTabs(tabs);
michael@0 26 switchTabs(imageTitle);
michael@0 27 verifyCopyOption(photoMenuItems[0], "Firefox.jpg"); // Test the "Copy Image Location" option
michael@0 28 switchTabs(imageTitle);
michael@0 29 verifyShareOption(photoMenuItems[1], PICTURE_PAGE_TITLE); // Test the "Share Image" option
michael@0 30
michael@0 31 verifyContextMenuItems(linkMenuItems);
michael@0 32 openTabFromContextMenu(linkMenuItems[0],2); // Test the "Open in New Tab" option - expecting 2 tabs: the original and the new one
michael@0 33 openTabFromContextMenu(linkMenuItems[1],2); // Test the "Open in Private Tab" option - expecting only 2 tabs in normal mode
michael@0 34 verifyCopyOption(linkMenuItems[2], BLANK_PAGE_URL); // Test the "Copy Link" option
michael@0 35 verifyShareOption(linkMenuItems[3], PICTURE_PAGE_TITLE); // Test the "Share Link" option
michael@0 36 verifyBookmarkLinkOption(linkMenuItems[4],BLANK_PAGE_URL); // Test the "Bookmark Link" option
michael@0 37 }
michael@0 38
michael@0 39 @Override
michael@0 40 public void tearDown() throws Exception {
michael@0 41 mDatabaseHelper.deleteBookmark(BLANK_PAGE_URL);
michael@0 42 super.tearDown();
michael@0 43 }
michael@0 44 }

mercurial