Closed Bug 629539 Opened 15 years ago Closed 15 years ago

test that proper visit notifications are dispatched (test_async_history_api.js)

Categories

(Toolkit :: Places, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b12
Tracking Status
blocking2.0 --- final+

People

(Reporter: sdwilsh, Assigned: sdwilsh)

References

Details

(Whiteboard: [softblocker])

Attachments

(1 file, 3 obsolete files)

Follow-up to bug 606966. We need to test that proper visit notifications are dispatched.
blocking2.0: --- → final+
Assignee: nobody → sdwilsh
Status: NEW → ASSIGNED
We already have onTitleChanged covered. Happy days!
onPageChanged cannot be tested due to bug 626836.
This means we only need to test for: onVisit uri-visit-saved observer service topic
Attached patch v1.0 (obsolete) — Splinter Review
Attachment #512644 - Flags: review?(mak77)
Whiteboard: [softblocker] → [softblocker][needs review mak]
Comment on attachment 512644 [details] [diff] [review] v1.0 >diff --git a/toolkit/components/places/tests/unit/test_async_history_api.js b/toolkit/components/places/tests/unit/test_async_history_api.js > const TEST_DOMAIN = "http://mozilla.org/"; > const TOPIC_UPDATEPLACES_COMPLETE = "places-updatePlaces-complete"; >+const URI_VISIT_SAVED = "uri-visit-saved"; use TOPIC_ prefix coherently please >+VisitObserver.prototype = { >+ __proto__: NavHistoryObserver.prototype, >+ onVisit: function(aURI, >+ aVisitId, >+ aTime, >+ aSessionId, >+ aReferringId, >+ aTransitionType) >+ { >+ do_log_info("onVisit(" + aURI.spec + ", " + aVisitId + ", " + aTime + >+ ", " + aSessionId + ", " + aReferringId + ", " + >+ aTransitionType + ")"); >+ if (!this.uri.equals(aURI)) { >+ return; >+ } >+ this.callback(aURI, aTime, aTransitionType); aURI in the callback seems completely useless, this listener is already bound to a certain uri (indeed you don't use aURI later) >+ let observer = { >+ observe: function(aSubject, aTopic, aData) >+ { >+ do_log_info("observe(" + aSubject + ", " + aTopic + ", " + aData + ")"); >+ do_check_true(aSubject instanceof Ci.nsIURI); >+ do_check_true(aSubject.equals(place.uri)); >+ >+ Services.obs.removeObserver(observer, URI_VISIT_SAVED); >+ finisher(); >+ }, >+ }; >+ Services.obs.addObserver(observer, URI_VISIT_SAVED, false); you can use a function here rather than a object, saving some line of code
Attachment #512644 - Flags: review?(mak77) → review+
(In reply to comment #5) > use TOPIC_ prefix coherently please I would prefer to keep the CPP and JS constants named the same though.
(In reply to comment #6) > (In reply to comment #5) > > use TOPIC_ prefix coherently please > I would prefer to keep the CPP and JS constants named the same though. ah ok, then I guess why the cpp constants don't follow the same schema, I think most of them have TOPIC somewhere in the name. Btw, I'm fine both ways then.
Whiteboard: [softblocker][needs review mak] → [softblocker]
Attached patch v1.1 (obsolete) — Splinter Review
For checkin. This is a test-only change, so it doesn't need approval.
Attachment #512644 - Attachment is obsolete: true
Attached patch v1.2 (obsolete) — Splinter Review
Something just landed that bitrots this. This fixes the bitrot.
Attachment #512896 - Attachment is obsolete: true
Comment on attachment 512902 [details] [diff] [review] v1.2 not really...hg fail
Attachment #512902 - Attachment is obsolete: true
Attached patch v1.2Splinter Review
OK, this is it for real this time.
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b12
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: