зеркало из https://github.com/mozilla/gecko-dev.git
Bug 859563 - Explicitly unregisterListener once event expecters are no longer needed; r=cpeterson
This commit is contained in:
Родитель
f3d328634d
Коммит
8290531336
|
@ -63,6 +63,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||||
if (!ret.booleanValue()) {
|
if (!ret.booleanValue()) {
|
||||||
geckoReadyExpector.blockForEvent();
|
geckoReadyExpector.blockForEvent();
|
||||||
}
|
}
|
||||||
|
geckoReadyExpector.unregisterListener();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mAsserter.dumpLog("Exception in blockForGeckoReady", e);
|
mAsserter.dumpLog("Exception in blockForGeckoReady", e);
|
||||||
}
|
}
|
||||||
|
@ -214,6 +215,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||||
mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
|
mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
|
||||||
// wait for screen to load
|
// wait for screen to load
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void loadUrl(String url) {
|
protected final void loadUrl(String url) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ abstract class PixelTest extends BaseTest {
|
||||||
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
||||||
loadUrl(url);
|
loadUrl(url);
|
||||||
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
|
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
PaintedSurface p = mDriver.getPaintedSurface();
|
PaintedSurface p = mDriver.getPaintedSurface();
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
mAsserter.ok(p != null, "checking that painted surface loaded",
|
mAsserter.ok(p != null, "checking that painted surface loaded",
|
||||||
|
@ -31,6 +32,7 @@ abstract class PixelTest extends BaseTest {
|
||||||
mSolo.clickOnText("Reload");
|
mSolo.clickOnText("Reload");
|
||||||
|
|
||||||
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
|
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
PaintedSurface p = mDriver.getPaintedSurface();
|
PaintedSurface p = mDriver.getPaintedSurface();
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
mAsserter.ok(p != null, "checking that painted surface loaded",
|
mAsserter.ok(p != null, "checking that painted surface loaded",
|
||||||
|
|
|
@ -56,6 +56,9 @@ public class testAboutPage extends PixelTest {
|
||||||
tabEventExpecter.blockForEvent();
|
tabEventExpecter.blockForEvent();
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
|
||||||
|
tabEventExpecter.unregisterListener();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
|
|
||||||
// Grab the title to make sure the about: page was loaded
|
// Grab the title to make sure the about: page was loaded
|
||||||
awesomebar = mDriver.findElement(getActivity(), "awesome_bar_title");
|
awesomebar = mDriver.findElement(getActivity(), "awesome_bar_title");
|
||||||
mAsserter.isnot(awesomebar, null, "Got the awesomebar");
|
mAsserter.isnot(awesomebar, null, "Got the awesomebar");
|
||||||
|
|
|
@ -8,10 +8,6 @@ import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class testAddonManager extends PixelTest {
|
public class testAddonManager extends PixelTest {
|
||||||
Actions.EventExpecter tabEventExpecter;
|
|
||||||
Actions.EventExpecter contentEventExpecter;
|
|
||||||
String url = "about:addons";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getTestType() {
|
protected int getTestType() {
|
||||||
return TEST_MOCHITEST;
|
return TEST_MOCHITEST;
|
||||||
|
@ -24,6 +20,10 @@ public class testAddonManager extends PixelTest {
|
||||||
With the Addons Manager open the test will verify that when it is opened again from the menu no new tab will be opened*/
|
With the Addons Manager open the test will verify that when it is opened again from the menu no new tab will be opened*/
|
||||||
|
|
||||||
public void testAddonManager() {
|
public void testAddonManager() {
|
||||||
|
Actions.EventExpecter tabEventExpecter;
|
||||||
|
Actions.EventExpecter contentEventExpecter;
|
||||||
|
String url = "about:addons";
|
||||||
|
|
||||||
blockForGeckoReady();
|
blockForGeckoReady();
|
||||||
|
|
||||||
// Use the menu to open the Addon Manger
|
// Use the menu to open the Addon Manger
|
||||||
|
@ -37,6 +37,9 @@ public class testAddonManager extends PixelTest {
|
||||||
tabEventExpecter.blockForEvent();
|
tabEventExpecter.blockForEvent();
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
|
||||||
|
tabEventExpecter.unregisterListener();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
|
|
||||||
// Verify the url
|
// Verify the url
|
||||||
verifyPageTitle("Add-ons");
|
verifyPageTitle("Add-ons");
|
||||||
|
|
||||||
|
@ -72,6 +75,7 @@ public class testAddonManager extends PixelTest {
|
||||||
data = new JSONObject(eventExpecter.blockForEventData());
|
data = new JSONObject(eventExpecter.blockForEventData());
|
||||||
requestId = data.getString("requestId");
|
requestId = data.getString("requestId");
|
||||||
}
|
}
|
||||||
|
eventExpecter.unregisterListener();
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
mAsserter.ok(false, "exception in testAddonManager", ex.toString());
|
mAsserter.ok(false, "exception in testAddonManager", ex.toString());
|
||||||
|
@ -98,6 +102,9 @@ public class testAddonManager extends PixelTest {
|
||||||
tabEventExpecter.blockForEvent();
|
tabEventExpecter.blockForEvent();
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
|
||||||
|
tabEventExpecter.unregisterListener();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
|
|
||||||
// Verify tab count has increased
|
// Verify tab count has increased
|
||||||
verifyTabCount(2);
|
verifyTabCount(2);
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ public class testAllPagesTab extends BaseTest {
|
||||||
}
|
}
|
||||||
mSolo.clickOnView(child);
|
mSolo.clickOnView(child);
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
verifyUrl(url);
|
verifyUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class testAxisLocking extends PixelTest {
|
||||||
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
||||||
meh.dragSync(20, 150, 10, 50);
|
meh.dragSync(20, 150, 10, 50);
|
||||||
PaintedSurface painted = waitForPaint(paintExpecter);
|
PaintedSurface painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 0, 100);
|
checkScrollWithBoxes(painted, 0, 100);
|
||||||
// since checkScrollWithBoxes only checks 4 points, it may not pick up a
|
// since checkScrollWithBoxes only checks 4 points, it may not pick up a
|
||||||
|
@ -48,6 +49,7 @@ public class testAxisLocking extends PixelTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
painted = waitForPaint(paintExpecter);
|
painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 100, 200);
|
checkScrollWithBoxes(painted, 100, 200);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -95,6 +95,7 @@ public class testBookmark extends PixelTest {
|
||||||
mAsserter.ok(child != null, "list item can be retrieved", child != null ? child.toString() : "null!");
|
mAsserter.ok(child != null, "list item can be retrieved", child != null ? child.toString() : "null!");
|
||||||
mSolo.clickOnView(child);
|
mSolo.clickOnView(child);
|
||||||
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
|
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
|
|
||||||
// Clean up the bookmark we created
|
// Clean up the bookmark we created
|
||||||
deleteBookmark();
|
deleteBookmark();
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class testDistribution extends ContentProviderTest {
|
||||||
Actions.EventExpecter distributionSetExpecter = mActions.expectGeckoEvent("Distribution:Set:OK");
|
Actions.EventExpecter distributionSetExpecter = mActions.expectGeckoEvent("Distribution:Set:OK");
|
||||||
init.invoke(null, mActivity, aPackagePath);
|
init.invoke(null, mActivity, aPackagePath);
|
||||||
distributionSetExpecter.blockForEvent();
|
distributionSetExpecter.blockForEvent();
|
||||||
|
distributionSetExpecter.unregisterListener();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mAsserter.ok(false, "exception initializing distribution", e.toString());
|
mAsserter.ok(false, "exception initializing distribution", e.toString());
|
||||||
}
|
}
|
||||||
|
@ -108,6 +109,7 @@ public class testDistribution extends ContentProviderTest {
|
||||||
data = new JSONObject(eventExpecter.blockForEventData());
|
data = new JSONObject(eventExpecter.blockForEventData());
|
||||||
requestId = data.getString("requestId");
|
requestId = data.getString("requestId");
|
||||||
}
|
}
|
||||||
|
eventExpecter.unregisterListener();
|
||||||
|
|
||||||
JSONArray preferences = data.getJSONArray("preferences");
|
JSONArray preferences = data.getJSONArray("preferences");
|
||||||
for (int i = 0; i < preferences.length(); i++) {
|
for (int i = 0; i < preferences.length(); i++) {
|
||||||
|
@ -140,6 +142,7 @@ public class testDistribution extends ContentProviderTest {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject data = new JSONObject(eventExpecter.blockForEventData());
|
JSONObject data = new JSONObject(eventExpecter.blockForEventData());
|
||||||
|
eventExpecter.unregisterListener();
|
||||||
JSONArray searchEngines = data.getJSONArray("searchEngines");
|
JSONArray searchEngines = data.getJSONArray("searchEngines");
|
||||||
boolean foundEngine = false;
|
boolean foundEngine = false;
|
||||||
for (int i = 0; i < searchEngines.length(); i++) {
|
for (int i = 0; i < searchEngines.length(); i++) {
|
||||||
|
@ -187,6 +190,7 @@ public class testDistribution extends ContentProviderTest {
|
||||||
data = new JSONObject(eventExpecter.blockForEventData());
|
data = new JSONObject(eventExpecter.blockForEventData());
|
||||||
requestId = data.getString("requestId");
|
requestId = data.getString("requestId");
|
||||||
}
|
}
|
||||||
|
eventExpecter.unregisterListener();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mAsserter.ok(false, "exception setting test locale", e.toString());
|
mAsserter.ok(false, "exception setting test locale", e.toString());
|
||||||
|
@ -220,6 +224,7 @@ public class testDistribution extends ContentProviderTest {
|
||||||
data = new JSONObject(eventExpecter.blockForEventData());
|
data = new JSONObject(eventExpecter.blockForEventData());
|
||||||
requestId = data.getString("requestId");
|
requestId = data.getString("requestId");
|
||||||
}
|
}
|
||||||
|
eventExpecter.unregisterListener();
|
||||||
|
|
||||||
JSONArray preferences = data.getJSONArray("preferences");
|
JSONArray preferences = data.getJSONArray("preferences");
|
||||||
for (int i = 0; i < preferences.length(); i++) {
|
for (int i = 0; i < preferences.length(); i++) {
|
||||||
|
|
|
@ -26,12 +26,14 @@ public class testFindInPage extends PixelTest {
|
||||||
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
||||||
findText("Robocoop", 3); // This will be close enough to existing text to test that search finds just what it should
|
findText("Robocoop", 3); // This will be close enough to existing text to test that search finds just what it should
|
||||||
PaintedSurface painted = waitForPaint(paintExpecter);
|
PaintedSurface painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
mAsserter.ispixel(painted.getPixelAt(width,height), 255, 0, 0, "Pixel at " + String.valueOf(width) + "," + String.valueOf(height));
|
mAsserter.ispixel(painted.getPixelAt(width,height), 255, 0, 0, "Pixel at " + String.valueOf(width) + "," + String.valueOf(height));
|
||||||
|
|
||||||
// Search that finds matches and therefor pans the page
|
// Search that finds matches and therefor pans the page
|
||||||
paintExpecter = mActions.expectPaint();
|
paintExpecter = mActions.expectPaint();
|
||||||
findText("Robocop", 3);
|
findText("Robocop", 3);
|
||||||
painted = waitForPaint(paintExpecter);
|
painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
mAsserter.isnotpixel(painted.getPixelAt(width,height), 255, 0, 0, "Pixel at " + String.valueOf(width) + "," + String.valueOf(height));
|
mAsserter.isnotpixel(painted.getPixelAt(width,height), 255, 0, 0, "Pixel at " + String.valueOf(width) + "," + String.valueOf(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class testFlingCorrectness extends PixelTest {
|
||||||
meh.dragSync(10, 150, 10, 50);
|
meh.dragSync(10, 150, 10, 50);
|
||||||
meh.dragSync(10, 150, 10, 50);
|
meh.dragSync(10, 150, 10, 50);
|
||||||
PaintedSurface painted = waitForPaint(paintExpecter);
|
PaintedSurface painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 0, 200);
|
checkScrollWithBoxes(painted, 0, 200);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -39,8 +40,10 @@ public class testFlingCorrectness extends PixelTest {
|
||||||
|
|
||||||
// now fling page downwards using a 100-pixel drag but a velocity of 15px/sec, so that
|
// now fling page downwards using a 100-pixel drag but a velocity of 15px/sec, so that
|
||||||
// we scroll the full 200 pixels back to the top of the page
|
// we scroll the full 200 pixels back to the top of the page
|
||||||
|
paintExpecter = mActions.expectPaint();
|
||||||
meh.flingSync(10, 50, 10, 150, 15);
|
meh.flingSync(10, 50, 10, 150, 15);
|
||||||
painted = waitForPaint(paintExpecter);
|
painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 0, 0);
|
checkScrollWithBoxes(painted, 0, 0);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class testHistory extends PixelTest {
|
||||||
mAsserter.isnot(mFirstChild, null, "Got history item");
|
mAsserter.isnot(mFirstChild, null, "Got history item");
|
||||||
mSolo.clickOnView(mFirstChild);
|
mSolo.clickOnView(mFirstChild);
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
verifyUrl(url3);
|
verifyUrl(url3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,7 @@ public class testHistoryTab extends PixelTest {
|
||||||
} else {
|
} else {
|
||||||
mAsserter.ok(false, "waiting for history item", "history item available");
|
mAsserter.ok(false, "waiting for history item", "history item available");
|
||||||
}
|
}
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class testOverscroll extends PixelTest {
|
||||||
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
||||||
meh.dragSync(10, 50, 10, 150);
|
meh.dragSync(10, 50, 10, 150);
|
||||||
PaintedSurface painted = waitWithNoPaint(paintExpecter);
|
PaintedSurface painted = waitWithNoPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 0, 0);
|
checkScrollWithBoxes(painted, 0, 0);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -42,6 +43,7 @@ public class testOverscroll extends PixelTest {
|
||||||
paintExpecter = mActions.expectPaint();
|
paintExpecter = mActions.expectPaint();
|
||||||
meh.dragSync(50, 10, 150, 10);
|
meh.dragSync(50, 10, 150, 10);
|
||||||
painted = waitWithNoPaint(paintExpecter);
|
painted = waitWithNoPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 0, 0);
|
checkScrollWithBoxes(painted, 0, 0);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class testPanCorrectness extends PixelTest {
|
||||||
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
||||||
meh.dragSync(10, 150, 10, 50);
|
meh.dragSync(10, 150, 10, 50);
|
||||||
PaintedSurface painted = waitForPaint(paintExpecter);
|
PaintedSurface painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 0, 100);
|
checkScrollWithBoxes(painted, 0, 100);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -39,6 +40,7 @@ public class testPanCorrectness extends PixelTest {
|
||||||
paintExpecter = mActions.expectPaint();
|
paintExpecter = mActions.expectPaint();
|
||||||
meh.dragSync(150, 10, 50, 10);
|
meh.dragSync(150, 10, 50, 10);
|
||||||
painted = waitForPaint(paintExpecter);
|
painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
checkScrollWithBoxes(painted, 100, 100);
|
checkScrollWithBoxes(painted, 100, 100);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -7,8 +7,6 @@ import android.widget.CheckBox;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class testPermissions extends PixelTest {
|
public class testPermissions extends PixelTest {
|
||||||
private Actions.RepeatedEventExpecter mPaintExpecter;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getTestType() {
|
protected int getTestType() {
|
||||||
return TEST_MOCHITEST;
|
return TEST_MOCHITEST;
|
||||||
|
@ -21,6 +19,8 @@ public class testPermissions extends PixelTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void geolocationTest() {
|
private void geolocationTest() {
|
||||||
|
Actions.RepeatedEventExpecter paintExpecter;
|
||||||
|
|
||||||
// Test geolocation notification
|
// Test geolocation notification
|
||||||
loadAndPaint(getAbsoluteUrl("/robocop/robocop_geolocation.html"));
|
loadAndPaint(getAbsoluteUrl("/robocop/robocop_geolocation.html"));
|
||||||
waitForText("wants your location");
|
waitForText("wants your location");
|
||||||
|
@ -33,9 +33,10 @@ public class testPermissions extends PixelTest {
|
||||||
mAsserter.ok(!mSolo.isCheckBoxChecked(0), "checkbox not checked", "checkbox is not checked");
|
mAsserter.ok(!mSolo.isCheckBoxChecked(0), "checkbox not checked", "checkbox is not checked");
|
||||||
|
|
||||||
// Test "Share" button functionality with unchecked checkbox
|
// Test "Share" button functionality with unchecked checkbox
|
||||||
mPaintExpecter = mActions.expectPaint();
|
paintExpecter = mActions.expectPaint();
|
||||||
mSolo.clickOnText("Share");
|
mSolo.clickOnText("Share");
|
||||||
PaintedSurface painted = waitForPaint(mPaintExpecter);
|
PaintedSurface painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
mAsserter.ispixel(painted.getPixelAt(10, 10), 0, 0x80, 0, "checking page background is green");
|
mAsserter.ispixel(painted.getPixelAt(10, 10), 0, 0x80, 0, "checking page background is green");
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -50,9 +51,10 @@ public class testPermissions extends PixelTest {
|
||||||
mAsserter.ok(mSolo.isCheckBoxChecked(0), "checkbox checked", "checkbox is checked");
|
mAsserter.ok(mSolo.isCheckBoxChecked(0), "checkbox checked", "checkbox is checked");
|
||||||
|
|
||||||
// Test "Share" button functionality with checked checkbox
|
// Test "Share" button functionality with checked checkbox
|
||||||
mPaintExpecter = mActions.expectPaint();
|
paintExpecter = mActions.expectPaint();
|
||||||
mSolo.clickOnText("Share");
|
mSolo.clickOnText("Share");
|
||||||
painted = waitForPaint(mPaintExpecter);
|
painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
mAsserter.ispixel(painted.getPixelAt(10, 10), 0, 0x80, 0, "checking page background is green");
|
mAsserter.ispixel(painted.getPixelAt(10, 10), 0, 0x80, 0, "checking page background is green");
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -116,6 +116,7 @@ public class testPrefsObserver extends BaseTest {
|
||||||
// will do nothing.
|
// will do nothing.
|
||||||
removePrefObserver();
|
removePrefObserver();
|
||||||
}
|
}
|
||||||
|
mExpecter.unregisterListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class testSearchSuggestions extends BaseTest {
|
||||||
Actions.EventExpecter enginesEventExpecter = mActions.expectGeckoEvent("SearchEngines:Data");
|
Actions.EventExpecter enginesEventExpecter = mActions.expectGeckoEvent("SearchEngines:Data");
|
||||||
final Activity awesomeBarActivity = clickOnAwesomeBar();
|
final Activity awesomeBarActivity = clickOnAwesomeBar();
|
||||||
enginesEventExpecter.blockForEvent();
|
enginesEventExpecter.blockForEvent();
|
||||||
|
enginesEventExpecter.unregisterListener();
|
||||||
connectSuggestClient(awesomeBarActivity);
|
connectSuggestClient(awesomeBarActivity);
|
||||||
|
|
||||||
for (int i = 0; i < TEST_QUERY.length(); i++) {
|
for (int i = 0; i < TEST_QUERY.length(); i++) {
|
||||||
|
|
|
@ -73,6 +73,8 @@ public class testSystemPages extends PixelTest {
|
||||||
// Wait for the new tab and page to load
|
// Wait for the new tab and page to load
|
||||||
tabEventExpecter.blockForEvent();
|
tabEventExpecter.blockForEvent();
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
tabEventExpecter.unregisterListener();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
|
|
||||||
verifyTabCount(expectedTabCount);
|
verifyTabCount(expectedTabCount);
|
||||||
verifyUrl(expectedUrls[i]);
|
verifyUrl(expectedUrls[i]);
|
||||||
|
@ -84,6 +86,7 @@ public class testSystemPages extends PixelTest {
|
||||||
paintExpecter = mActions.expectPaint(); // Set up listener to catch the page load
|
paintExpecter = mActions.expectPaint(); // Set up listener to catch the page load
|
||||||
mSolo.clickOnText("About");
|
mSolo.clickOnText("About");
|
||||||
waitForPaint(paintExpecter); // Waiting for the page to load
|
waitForPaint(paintExpecter); // Waiting for the page to load
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
|
|
||||||
expectedTabCount--; // Decreasing since we don't expect this in a new tab
|
expectedTabCount--; // Decreasing since we don't expect this in a new tab
|
||||||
verifyTabCount(expectedTabCount);
|
verifyTabCount(expectedTabCount);
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class testVkbOverlap extends PixelTest {
|
||||||
int greenPixelCount = 0;
|
int greenPixelCount = 0;
|
||||||
|
|
||||||
PaintedSurface painted = waitForPaint(paintExpecter);
|
PaintedSurface painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
try {
|
try {
|
||||||
greenPixelCount = countGreenPixels(painted);
|
greenPixelCount = countGreenPixels(painted);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -66,6 +67,7 @@ public class testVkbOverlap extends PixelTest {
|
||||||
// now that the focus is in the text field we will repaint every 500ms as the cursor blinks, so we need to use a smaller
|
// now that the focus is in the text field we will repaint every 500ms as the cursor blinks, so we need to use a smaller
|
||||||
// "no paints" threshold to consider the page painted
|
// "no paints" threshold to consider the page painted
|
||||||
paintExpecter.blockUntilClear(LESS_THAN_CURSOR_BLINK_PERIOD);
|
paintExpecter.blockUntilClear(LESS_THAN_CURSOR_BLINK_PERIOD);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
painted = mDriver.getPaintedSurface();
|
painted = mDriver.getPaintedSurface();
|
||||||
try {
|
try {
|
||||||
// if the vkb scrolled into view as expected, then the number of green pixels now visible should be about the
|
// if the vkb scrolled into view as expected, then the number of green pixels now visible should be about the
|
||||||
|
|
|
@ -64,6 +64,8 @@ public class testWebContentContextMenu extends PixelTest {
|
||||||
// Wait for the new tab and page to load
|
// Wait for the new tab and page to load
|
||||||
tabEventExpecter.blockForEvent();
|
tabEventExpecter.blockForEvent();
|
||||||
contentEventExpecter.blockForEvent();
|
contentEventExpecter.blockForEvent();
|
||||||
|
tabEventExpecter.unregisterListener();
|
||||||
|
contentEventExpecter.unregisterListener();
|
||||||
|
|
||||||
// See tab count
|
// See tab count
|
||||||
Element tabCount = mDriver.findElement(getActivity(), "tabs_count");
|
Element tabCount = mDriver.findElement(getActivity(), "tabs_count");
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class test_bug720538 extends PixelTest {
|
||||||
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
|
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
|
||||||
meh.doubleTap(100, 100);
|
meh.doubleTap(100, 100);
|
||||||
painted = waitForPaint(paintExpecter);
|
painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// check a few points to ensure that we did a good zoom-to-block on the iframe. this checks that
|
// check a few points to ensure that we did a good zoom-to-block on the iframe. this checks that
|
||||||
|
@ -59,6 +60,7 @@ public class test_bug720538 extends PixelTest {
|
||||||
paintExpecter = mActions.expectPaint();
|
paintExpecter = mActions.expectPaint();
|
||||||
meh.doubleTap(100, mDriver.getGeckoWidth() / 2);
|
meh.doubleTap(100, mDriver.getGeckoWidth() / 2);
|
||||||
painted = waitForPaint(paintExpecter);
|
painted = waitForPaint(paintExpecter);
|
||||||
|
paintExpecter.unregisterListener();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// and now we check a pixel at the bottom of the view to ensure that we have the page
|
// and now we check a pixel at the bottom of the view to ensure that we have the page
|
||||||
|
|
Загрузка…
Ссылка в новой задаче