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