Automate litmus test Testcase ID #5065 - Completed download - Go to Download Page

ASSIGNED

Status

()

Toolkit
Downloads API
ASSIGNED
10 years ago
10 years ago

People

(Reporter: Anoop Saldanha (Poona), Assigned: Anoop Saldanha (Poona))

Tracking

(Blocks: 1 bug)

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

10 years ago
Proposed type of test: chrome

Proposed location of test: toolkit/mozapps/downloads/tests/chrome
(Assignee)

Comment 1

10 years ago
Created attachment 331509 [details] [diff] [review]
v1.0

This test doesn't handle 3 and 4 of the litmus test, since we decided to defer work on it for sometime.

The test passes if a new tab opens, since I tried everything I could to retrieve the url opened by the new tab, but to no avail.

One thing to note is the latency in opening of the new page.  Initially I thought it was the test.  Then I manually worked with the Go to Download Page and it was the same thing.  Sometimes it takes as much as 10 secs for the tab to open.

The test passes nevertheless :)
Attachment #331509 - Flags: review?(sdwilsh)
(Assignee)

Comment 2

10 years ago
Created attachment 331517 [details] [diff] [review]
v1.0

Had to correct a small indentation.  Corrected patch updated.
Attachment #331509 - Attachment is obsolete: true
Attachment #331517 - Flags: review?(sdwilsh)
Attachment #331509 - Flags: review?(sdwilsh)
Product: Firefox → Toolkit
Comment on attachment 331517 [details] [diff] [review]
v1.0

This needs to be in browser/ because it depends on the browser

>+/**
>+ * We define a custom populateDM() and not use the populateDM() defined in
>+ * utils.js, since we require the dummy download to also have the referrer url.
>+ */
Then let's fix utils.js to bind null if the property doesn't exist on the
object being passed in.  Code duplication FTL.

>+function runTest()
>+{
>+  const dmui = Cc["@mozilla.org/download-manager-ui;1"].
>+             getService(Ci.nsIDownloadManagerUI);
>+  const dm = Cc["@mozilla.org/download-manager;1"].
>+             getService(Ci.nsIDownloadManager);
s/const/let/

>+  const prefServ = Cc["@mozilla.org/preferences-service;1"].
>+                   getService(Ci.nsIPrefBranch);
ditto

>+  let initialPrefValue = prefServ.getIntPref("browser.link.open_newwindow");
>+  prefServ.setIntPref("browser.link.open_newwindow", 3);
what's that do exactly?  comments would be nice

>+      let chromeWin = wm.getMostRecentWindow("navigator:browser");
s/chromeWin/browser/

>+        // Cleanup
>+        prefServ.setIntPref("browser.link.open_newwindow", initialPrefValue);
>+        setCleanState();
do this at the end of the test?

>+      function popupListener() {
>+        let menuitem = popup.childNodes;
>+        for(let i = 0; i < menuitem.length; i++) {
>+          if(menuitem[i].label == "Go to Download Page")
>+            menuitem[i].doCommand();
check the command, not string name please
Attachment #331517 - Flags: review?(sdwilsh) → review-
You need to log in before you can comment on or make changes to this bug.