summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit_ipc/test_is_proxy_used.js
blob: 2678ffa1b891b45e2ff357182670d0e22c81ac1a (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
"use strict";
/* global NodeHTTPServer, NodeHTTPProxyServer*/

add_task(async function run_test() {
  let proxy = new NodeHTTPProxyServer();
  await proxy.start();
  registerCleanupFunction(async () => {
    await proxy.stop();
  });

  let server = new NodeHTTPServer();

  await server.start();
  registerCleanupFunction(async () => {
    await server.stop();
  });

  await server.registerPathHandler("/test", (req, resp) => {
    let content = "content";
    resp.writeHead(200);
    resp.end(content);
  });

  do_await_remote_message("start-test").then(() => {
    do_send_remote_message(
      "start-test-done",
      `http://localhost:${server.port()}/test`
    );
  });

  run_test_in_child("child_is_proxy_used.js");
});