Closed Bug 1089190 Opened 10 years ago Closed 10 years ago

Add testing for offline network pages

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 36

People

(Reporter: mfinkle, Assigned: mfinkle)

Details

Attachments

(1 file)

This test adds some testing for offline network error pages. I stole the core of this test from: http://mxr.mozilla.org/mozilla-central/source/toolkit/components/places/tests/browser/browser_bug680727.js Try run here, show the test passing (look at the logs themselves) in RC3 (Android 2.3) and RC4 (Android 4) https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=0b127fa4c060
Attachment #8511545 - Flags: review?(bnicholson)
Assignee: nobody → mark.finkle
Status: NEW → ASSIGNED
OS: Linux → Android
Hardware: x86_64 → All
Comment on attachment 8511545 [details] [diff] [review] offline-test v0.1 Review of attachment 8511545 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/base/tests/testOfflinePage.java @@ +1,1 @@ > +package org.mozilla.gecko.tests; Not sure why so many of our tests are missing the license header, but we should probably include it. ::: mobile/android/base/tests/testOfflinePage.js @@ +71,5 @@ > + browser.removeEventListener("DOMContentLoaded", errorListener, true); > + ok(Services.io.offline, "Services.io.offline is true."); > + > + // This is an error page. > + is(browser.contentDocument.documentURI.substring(0, 27), "about:neterror?e=netOffline", "Document URI is the error page."); Heh, I know this is copied, but this is silly. We should extract this string into a variable and use .length like sane people. @@ +86,5 @@ > + > + ok(browser.contentDocument.getElementById("errorTryAgain"), "The error page has got a #errorTryAgain element"); > + chromeWin.setTimeout(function() { > + browser.contentDocument.getElementById("errorTryAgain").click(); > + }, 1000); I'm guessing this delay is needed from offline true -> false switch? Arbitrary timeouts always suck, so I wonder if there's a more reliable way to detect whether we're ready.
Attachment #8511545 - Flags: review?(bnicholson) → review+
(In reply to Brian Nicholson (:bnicholson) from comment #1) > ::: mobile/android/base/tests/testOfflinePage.java > @@ +1,1 @@ > > +package org.mozilla.gecko.tests; > > Not sure why so many of our tests are missing the license header, but we > should probably include it. Done > ::: mobile/android/base/tests/testOfflinePage.js > > + is(browser.contentDocument.documentURI.substring(0, 27), "about:neterror?e=netOffline", "Document URI is the error page."); > > Heh, I know this is copied, but this is silly. We should extract this string > into a variable and use .length like sane people. I kept this since we need to make sure it matches the about:error string. > > + ok(browser.contentDocument.getElementById("errorTryAgain"), "The error page has got a #errorTryAgain element"); > > + chromeWin.setTimeout(function() { > > + browser.contentDocument.getElementById("errorTryAgain").click(); > > + }, 1000); > > I'm guessing this delay is needed from offline true -> false switch? > Arbitrary timeouts always suck, so I wonder if there's a more reliable way > to detect whether we're ready. Needed for visual local testing. I removed the timeout https://hg.mozilla.org/integration/fx-team/rev/0dce9d625fb5
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 36
(In reply to Mark Finkle (:mfinkle) from comment #2) > (In reply to Brian Nicholson (:bnicholson) from comment #1) > > > ::: mobile/android/base/tests/testOfflinePage.java > > @@ +1,1 @@ > > > +package org.mozilla.gecko.tests; > > > > Not sure why so many of our tests are missing the license header, but we > > should probably include it. > > Done Aren't tests usually in the public domain, not MPL? Also, I wonder if we could figure out how to reproduce what I'm seeing in bug 1083213 with a test.
(In reply to :Margaret Leibovic from comment #4) > Aren't tests usually in the public domain, not MPL? If I recall from long ago, that was only because the PD license block was much shorter than the MPL 1.1 license block!
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: