summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/chrome/test_get_printer_basic_attributes.html
blob: 26a04e09d570763ddc00ff577ab00ec7d188d2f8 (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
<!DOCTYPE HTML>
<html>
<head>
  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body onload="run()">
<script type="application/javascript">

SimpleTest.waitForExplicitFinish();

async function run() {
  try {
    let printerList = Cc["@mozilla.org/gfx/printerlist;1"].getService(
      Ci.nsIPrinterList
    );

    let printers = await printerList.printers;
    for (let printer of printers) {
      printer.QueryInterface(Ci.nsIPrinter);
      info(`Listing basic attributes for ${printer.name}:`);
      let [supportsDuplex, supportsColor] = await Promise.all([printer.supportsDuplex, printer.supportsColor]);
      info(`* supportsDuplex: ${supportsDuplex}`);
      info(`* supportsColor: ${supportsColor}`);
    }

    ok(true, "Retrieved printer basic attributes successfully.");
  } catch (e) {
    ok(false, `Error thrown while retrieving printer basic attributes: ${e}.`);
    console.error(e);
  }
  SimpleTest.finish();
}

</script>
</body>
</html>