Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/test/media_router/resources/common.js

Issue 2470023002: [Presentation API] change initial state of PresentationConnection to 'connecting' (Closed)
Patch Set: add integration test to check connection state Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/presentation/presentation_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright 2015 The Chromium Authors. All rights reserved. 2 * Copyright 2015 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 * 5 *
6 * @fileoverview Common APIs for presentation integration tests. 6 * @fileoverview Common APIs for presentation integration tests.
7 * 7 *
8 */ 8 */
9 9
10 var startSessionPromise = null; 10 var startSessionPromise = null;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 /** 61 /**
62 * Checks if the session has been started successfully. 62 * Checks if the session has been started successfully.
63 */ 63 */
64 function checkSession() { 64 function checkSession() {
65 if (!startSessionPromise) { 65 if (!startSessionPromise) {
66 sendResult(false, 'Did not attempt to start session'); 66 sendResult(false, 'Did not attempt to start session');
67 } else { 67 } else {
68 startSessionPromise.then(function(session) { 68 startSessionPromise.then(function(session) {
69 if(!session) { 69 if(!session) {
70 sendResult(false, 'Failed to start session'); 70 sendResult(false, 'Failed to start session: connection is null');
71 } else { 71 } else {
72 // set the new session 72 // set the new session
73 startedConnection = session; 73 startedConnection = session;
74 sendResult(true, ''); 74 if (startedConnection.state != "connecting") {
75 sendResult(false,
76 'Expect connection state to be "connecting", actual "' +
77 startedConnection.state + '"');
78 }
79 startedConnection.onconnect = () => {
80 sendResult(true, '');
81 };
75 } 82 }
76 }).catch(function() { 83 }).catch(function(e) {
77 // terminate old session if exists 84 // terminate old session if exists
78 startedConnection && startedConnection.terminate(); 85 startedConnection && startedConnection.terminate();
79 sendResult(false, 'Failed to start session'); 86 sendResult(false, 'Failed to start session: encounter exception ' + e);
imcheng 2016/11/09 00:38:25 s/encounter/encountered
80 }) 87 })
81 } 88 }
82 } 89 }
83 90
84 /** 91 /**
85 * Checks the start() request fails with expected error and message substring. 92 * Checks the start() request fails with expected error and message substring.
86 * @param {!string} expectedErrorName 93 * @param {!string} expectedErrorName
87 * @param {!string} expectedErrorMessageSubstring 94 * @param {!string} expectedErrorMessageSubstring
88 */ 95 */
89 function checkStartFailed(expectedErrorName, expectedErrorMessageSubstring) { 96 function checkStartFailed(expectedErrorName, expectedErrorMessageSubstring) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 passed: passed, 219 passed: passed,
213 errorMessage: errorMessage 220 errorMessage: errorMessage
214 })); 221 }));
215 } else { 222 } else {
216 lastExecutionResult = JSON.stringify({ 223 lastExecutionResult = JSON.stringify({
217 passed: passed, 224 passed: passed,
218 errorMessage: errorMessage 225 errorMessage: errorMessage
219 }); 226 });
220 } 227 }
221 } 228 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/presentation/presentation_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698