Update web-nfc nfc_watch.https.html (#15666)

* Update web-nfc nfc_watch.https.html
* Make code nicer
* Change NFCReader tests to manual tests
* Address @Honry's comments
* Delete redundant code and s/enable/enabled
diff --git a/web-nfc/NFCReader-manual.https.html b/web-nfc/NFCReader-manual.https.html
new file mode 100644
index 0000000..a3171c3
--- /dev/null
+++ b/web-nfc/NFCReader-manual.https.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Web NFC: NFCReader tests</title>
+<link rel="author" title="Intel" href="http://www.intel.com"/>
+<link rel="help" href="https://w3c.github.io/web-nfc/"/>
+<meta name="timeout" content="long">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<meta name="flags" content="interact">
+
+<p>Tap an NFC tag to the test device with NFC support.</p>
+
+<p>Note: All the actions need to be done in 60 seconds, otherwise it will get TIMEOUT.</p>
+
+<div id="log"></div>
+
+<script>
+
+"use strict";
+
+promise_test(async t => {
+  const reader = new NFCReader();
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("reading");
+  assert_true(event instanceof NFCReadingEvent);
+}, 'Test that nfc watch success if NFC HW is enabled.');
+
+promise_test(async t => {
+  const reader = new NFCReader({url: "https://a.com"});
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("reading");
+  assert_true(event instanceof NFCReadingEvent);
+}, 'Test that NFCReader.start succeeds if NFCReaderOptions.url is valid URL.');
+
+promise_test(async t => {
+  const reader = new NFCReader({url: "https://a.com/*"});
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("reading");
+  assert_true(event instanceof NFCReadingEvent);
+}, 'Test that NFCReader.start succeeds if NFCReaderOptions.url is valid URL with "*"' +
+   ' wildcard character in path.');
+
+promise_test(async t => {
+  const reader = new NFCReader({url: "https://a.com/*/bar"});
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("reading");
+  assert_true(event instanceof NFCReadingEvent);
+}, 'Test that NFCReader.start succeeds if NFCReaderOptions.url is valid URL with "*"' +
+   ' wildcard character in the beginning of path component followed by' +
+   ' subpath.');
+
+promise_test(async t => {
+  const reader = new NFCReader({url: ""});
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("reading");
+  assert_true(event instanceof NFCReadingEvent);
+}, 'Test that NFCReader.start succeeds if NFCReaderOptions.url is empty.');
+
+</script>
diff --git a/web-nfc/NFCReader.html b/web-nfc/NFCReader.html
new file mode 100644
index 0000000..5a0e884
--- /dev/null
+++ b/web-nfc/NFCReader.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Web NFC: NFCReader tests</title>
+<link rel="author" title="Intel" href="http://www.intel.com"/>
+<link rel="help" href="https://w3c.github.io/web-nfc/"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<div id="log"></div>
+
+<script>
+
+"use strict";
+
+promise_test(async t => {
+  const reader = new NFCReader({url: "www.a.com"});
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("error");
+  assert_equals(event.error.name, 'SyntaxError');
+}, 'Test that NFCReader.start fails if NFCReaderOptions.url is missing components.');
+
+promise_test(async t => {
+  const reader = new NFCReader({url: "invalid"});
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("error");
+  assert_equals(event.error.name, 'SyntaxError');
+}, 'Test that NFCReader.start fails if NFCReaderOptions.url is invalid.');
+
+promise_test(async t => {
+  const reader = new NFCReader({url: "http://a.com"});
+  const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
+  reader.start();
+  const event = await readerWatcher.wait_for("error");
+  assert_equals(event.error.name, 'SyntaxError');
+}, 'Test that NFCReader.start fails if NFCReaderOptions.url has wrong protocol.');
+
+</script>
diff --git a/web-nfc/nfc_watch.https.html b/web-nfc/nfc_watch.https.html
deleted file mode 100644
index 455b643..0000000
--- a/web-nfc/nfc_watch.https.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>Web NFC: nfc.watch tests</title>
-<link rel="author" title="Intel" href="http://www.intel.com"/>
-<link rel="help" href="https://w3c.github.io/web-nfc/"/>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/nfc_help.js"></script>
-
-<div id="log"></div>
-
-<script>
-
-"use strict";
-
-promise_test(t => {
-  return promise_rejects(t, 'NotFoundError', navigator.nfc.cancelWatch(1));
-}, "Test that nfc.cancelWatch fails if invalid watch ID is provided.");
-
-promise_test(t => {
-  return promise_rejects(t, 'NotFoundError', navigator.nfc.cancelWatch());
-}, "Test that nfc.cancelWatch fails if there are no active watchers.");
-
-promise_test(t => {
-  return navigator.nfc.watch(noop).then(id => {
-    assert_equals(typeof(id), "number");
-    assert_greater_than(id, 0, "greater than zero");
-  });
-}, "Test that nfc watch success if NFC HW is enable.");
-
-promise_test(t => {
-  return navigator.nfc.watch(noop).
-      then(id => navigator.nfc.cancelWatch(id));
-}, "Test that nfc.cancelWatch succeeds if correct watch id is provided.");
-
-promise_test(t => {
-  return navigator.nfc.watch(noop).then(() => {
-    navigator.nfc.cancelWatch();
-  });
-}, "Test that nfc.cancelWatch succeeds if there are active watchers.");
-
-promise_test(t => {
-  return promise_rejects(t, 'SyntaxError', navigator.nfc.watch(noop, {url:"www.a.com"}));
-}, 'Test that nfc.watch fails if NFCWatchOptions.url is missing components.');
-
-promise_test(t => {
-  return promise_rejects(t, 'SyntaxError', navigator.nfc.watch(noop, {url:"invalid"}));
-}, 'Test that nfc.watch fails if NFCWatchOptions.url is invalid.');
-
-promise_test(t => {
-  return promise_rejects(t, 'SyntaxError', navigator.nfc.watch(noop, {url:"http://a.com"}));
-}, 'Test that nfc.watch fails if NFCWatchOptions.url has wrong protocol.');
-
-promise_test(t => {
-  return navigator.nfc.watch(noop, {url:"https://a.com"});
-}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is valid URL.');
-
-promise_test(t => {
-  return navigator.nfc.watch(noop, {url:"https://a.com/*"});
-}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is valid URL with "*"' +
-   ' wildcard character in path.');
-
-promise_test(t => {
-  return navigator.nfc.watch(noop, {url:"https://a.com/*/bar"});
-}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is valid URL with "*"' +
-   ' wildcard character in the beginning of path component followed by' +
-   ' subpath.');
-
-promise_test(t => {
-  return navigator.nfc.watch(noop, {url:""});
-}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is empty.');
-
-</script>