зеркало из https://github.com/mozilla/gecko-dev.git
Bug 785577 - Robocop: improve wait before testing menus; r=jmaher
This commit is contained in:
Родитель
62c6cf834b
Коммит
c42f5bb0ff
|
@ -5,7 +5,11 @@ import @ANDROID_PACKAGE_NAME@.*;
|
|||
import android.app.Activity;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
public class testWebContentContextMenu extends BaseTest {
|
||||
/* Test the context menu on web content: Long click on a link,
|
||||
* verify that the context menu is shown and verify that some
|
||||
* of the menu actions work.
|
||||
*/
|
||||
public class testWebContentContextMenu extends PixelTest {
|
||||
@Override
|
||||
protected int getTestType() {
|
||||
return TEST_MOCHITEST;
|
||||
|
@ -23,15 +27,16 @@ public class testWebContentContextMenu extends BaseTest {
|
|||
|
||||
// Load the test page and check for 'Open Link'
|
||||
String url = getAbsoluteUrl("/robocop/robocop_big_link.html");
|
||||
loadUrl(url);
|
||||
loadAndPaint(url);
|
||||
|
||||
mAsserter.dumpLog("long-clicking at "+left+", "+top);
|
||||
mSolo.clickLongOnScreen(left, top);
|
||||
|
||||
mAsserter.ok(mSolo.waitForText("Open"), "looking for context menu action", "found 'Open Link'");
|
||||
mAsserter.ok(mSolo.waitForText("^Open Link in New Tab$"), "looking for context menu action", "found 'Open Link in New Tab'");
|
||||
|
||||
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
|
||||
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
|
||||
mSolo.clickOnText("Open");
|
||||
mSolo.clickOnText("Open Link");
|
||||
|
||||
// Wait for the new tab and page to load
|
||||
tabEventExpecter.blockForEvent();
|
||||
|
@ -46,12 +51,12 @@ public class testWebContentContextMenu extends BaseTest {
|
|||
mAsserter.is(tabCountText, "2", "Number of tabs has increased");
|
||||
|
||||
// Load the test page again and test for 'Share Link' and 'Bookmark Link'
|
||||
loadUrl(url);
|
||||
loadAndPaint(url);
|
||||
|
||||
mSolo.clickLongOnScreen(left, top);
|
||||
|
||||
mAsserter.ok(mSolo.waitForText("Share"), "looking for context menu action", "found 'Share Link'");
|
||||
mAsserter.ok(mSolo.waitForText("Bookmark"), "looking for context menu action", "found 'Bookmark Link'");
|
||||
mAsserter.ok(mSolo.waitForText("^Share Link$"), "looking for context menu action", "found 'Share Link'");
|
||||
mAsserter.ok(mSolo.waitForText("^Bookmark Link$"), "looking for context menu action", "found 'Bookmark Link'");
|
||||
mSolo.clickOnText("Bookmark");
|
||||
mAsserter.is(mSolo.waitForText("Bookmark added"), true, "Bookmark added verified");
|
||||
|
||||
|
@ -62,7 +67,7 @@ public class testWebContentContextMenu extends BaseTest {
|
|||
// We know that the link test page points to robocop_blank_01.html, so lets
|
||||
// load it and see if the page is bookmarked
|
||||
url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
|
||||
loadUrl(url);
|
||||
loadAndPaint(url);
|
||||
|
||||
// Pause briefly, to ensure that the bookmark addition, above, updates database tables and
|
||||
// completes before checking that the bookmark exists.
|
||||
|
@ -85,12 +90,12 @@ public class testWebContentContextMenu extends BaseTest {
|
|||
|
||||
// Load the mailto test page again and test for allowed menu actions
|
||||
url = getAbsoluteUrl("/robocop/robocop_big_mailto.html");
|
||||
loadUrl(url);
|
||||
loadAndPaint(url);
|
||||
|
||||
mSolo.clickLongOnScreen(left, top);
|
||||
|
||||
mAsserter.ok(mSolo.waitForText("Share"), "looking for context menu action", "found 'Share Link'");
|
||||
mAsserter.ok(!mSolo.waitForText("Open", 0, 1000, false), "looking for context menu action", "did not find 'Open Link'");
|
||||
mAsserter.ok(!mSolo.waitForText("Bookmark", 0, 1000, false), "looking for context menu action", "did not find 'Bookmark Link'");
|
||||
mAsserter.ok(mSolo.waitForText("Share"), "looking for context menu action", "found 'Share'");
|
||||
mAsserter.ok(!mSolo.waitForText("^Open Link in New Tab$", 0, 1000, false), "looking for context menu action", "did not find 'Open Link in New Tab'");
|
||||
mAsserter.ok(!mSolo.waitForText("^Bookmark Link$", 0, 1000, false), "looking for context menu action", "did not find 'Bookmark Link'");
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче