|
| 1 | +// Copyright 2016 Intel Corporation |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +// The file names for client and server are reversed in this test, because the test suite uses the |
| 16 | +// file name to decide which to run first ("server.js"). In the case of presence, however, the |
| 17 | +// client must run first, because it must catch the announcement from the server when it comes up. |
| 18 | + |
| 19 | +var client = require( process.argv[ 3 ] ).client; |
| 20 | + |
| 21 | +console.log( JSON.stringify( { assertionCount: 1 } ) ); |
| 22 | + |
| 23 | +client |
| 24 | + .on( "devicefound", function( device ) { |
| 25 | + if ( device.name === "test-device-" + process.argv[ 2 ] ) { |
| 26 | + console.log( JSON.stringify( { assertion: "ok", arguments: [ |
| 27 | + true, "Client: test device has appeared" |
| 28 | + ] } ) ); |
| 29 | + console.log( JSON.stringify( { finished: 0 } ) ); |
| 30 | + } |
| 31 | + } ); |
| 32 | + |
| 33 | +console.log( JSON.stringify( { ready: true } ) ); |
0 commit comments