summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_pageInfo.js
blob: 90fe2e17f507c73d423158c4c593fe6724cefc6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function test() {
  waitForExplicitFinish();

  var pageInfo;

  gBrowser.selectedTab = gBrowser.addTab();
  gBrowser.selectedBrowser.addEventListener("load", function loadListener() {
    gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);

    Services.obs.addObserver(observer, "page-info-dialog-loaded", false);
    pageInfo = BrowserPageInfo();
  }, true);
  content.location =
    "https://example.com/browser/browser/base/content/test/general/feed_tab.html";

  function observer(win, topic, data) {
    Services.obs.removeObserver(observer, "page-info-dialog-loaded");
    pageInfo.onFinished.push(handlePageInfo);
  }

  function handlePageInfo() {
    ok(pageInfo.document.getElementById("feedTab"), "Feed tab");
    let feedListbox = pageInfo.document.getElementById("feedListbox");
    ok(feedListbox, "Feed list");

    var feedRowsNum = feedListbox.getRowCount();
    is(feedRowsNum, 3, "Number of feeds listed");

    for (var i = 0; i < feedRowsNum; i++) {
      let feedItem = feedListbox.getItemAtIndex(i);
      is(feedItem.getAttribute("name"), i + 1, "Feed name");
    }

    pageInfo.close();
    gBrowser.removeCurrentTab();
    finish();
  }
}