| Index: chrome/test/media_router/resources/common.js
|
| diff --git a/chrome/test/media_router/resources/common.js b/chrome/test/media_router/resources/common.js
|
| index 42ce095fb441d7c173c9221e2e32f51999be7504..d356a65f632c3b3c7e23e697432c3b573f6bd26a 100644
|
| --- a/chrome/test/media_router/resources/common.js
|
| +++ b/chrome/test/media_router/resources/common.js
|
| @@ -67,16 +67,23 @@ function checkSession() {
|
| } else {
|
| startSessionPromise.then(function(session) {
|
| if(!session) {
|
| - sendResult(false, 'Failed to start session');
|
| + sendResult(false, 'Failed to start session: connection is null');
|
| } else {
|
| // set the new session
|
| startedConnection = session;
|
| - sendResult(true, '');
|
| + if (startedConnection.state != "connecting") {
|
| + sendResult(false,
|
| + 'Expect connection state to be "connecting", actual "' +
|
| + startedConnection.state + '"');
|
| + }
|
| + startedConnection.onconnect = () => {
|
| + sendResult(true, '');
|
| + };
|
| }
|
| - }).catch(function() {
|
| + }).catch(function(e) {
|
| // terminate old session if exists
|
| startedConnection && startedConnection.terminate();
|
| - sendResult(false, 'Failed to start session');
|
| + sendResult(false, 'Failed to start session: encountered exception ' + e);
|
| })
|
| }
|
| }
|
|
|