Commit 067cbde1 authored by Leon Han's avatar Leon Han Committed by Commit Bot

[webnfc] A follow-up for nfc-mock.js

This is a follow-up CL for addressing comments in crrev.com/c/1737993:
https://chromium-review.googlesource.com/c/chromium/src/+/1737993/14/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js#276

BUG=520391

Change-Id: I92ac1229d59d1a76d830f2a1d58acf04c2846f3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1760596
Auto-Submit: Leon Han <leon.han@intel.com>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688155}
parent 1f9c5108
...@@ -273,13 +273,11 @@ var WebNFCTest = (() => { ...@@ -273,13 +273,11 @@ var WebNFCTest = (() => {
this.watchers_.push({id: id, options: options}); this.watchers_.push({id: id, options: options});
// Triggers onWatch if the new watcher matches existing messages // Triggers onWatch if the new watcher matches existing messages
if (this.reading_messages_.length !== 0) { for (let message of this.reading_messages_) {
for(let message of this.reading_messages_) { if (matchesWatchOptions(
if (matchesWatchOptions(message.message, message.message, message.compatibility, options)) {
message.compatibility, options)) { this.client_.onWatch(
this.client_.onWatch([id], fake_tag_serial_number, [id], fake_tag_serial_number, toMojoNDEFMessage(message.message));
toMojoNDEFMessage(message.message));
}
} }
} }
...@@ -362,16 +360,15 @@ var WebNFCTest = (() => { ...@@ -362,16 +360,15 @@ var WebNFCTest = (() => {
this.reading_messages_.push({message: message, this.reading_messages_.push({message: message,
compatibility: toMojoNDEFCompatibility(compatibility)}); compatibility: toMojoNDEFCompatibility(compatibility)});
// Triggers onWatch if the new message matches existing watchers // Triggers onWatch if the new message matches existing watchers
if (this.watchers_.length !== 0) {
for (let watcher of this.watchers_) { for (let watcher of this.watchers_) {
if (matchesWatchOptions(message, if (matchesWatchOptions(
message.compatibility, watcher.options)) { message, message.compatibility, watcher.options)) {
this.client_.onWatch([watcher.id], fake_tag_serial_number, this.client_.onWatch(
[watcher.id], fake_tag_serial_number,
toMojoNDEFMessage(message.message)); toMojoNDEFMessage(message.message));
} }
} }
} }
}
setPushShouldTimeout(result) { setPushShouldTimeout(result) {
this.push_should_timeout_ = result; this.push_should_timeout_ = result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment