OLD | NEW |
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; |
11 var startedConnection = null; | 11 var startedConnection = null; |
12 var reconnectedSession = null; | 12 var reconnectedSession = null; |
13 var presentationUrl = null; | 13 var presentationUrl = null; |
14 if (window.location.href.indexOf('__is_android__=true') >= 0) { | 14 if (window.location.href.indexOf('__is_android__=true') >= 0) { |
15 // For android, "google.com/cast" is required in presentation URL. | 15 // For android, "google.com/cast" is required in presentation URL. |
16 // TODO(zqzhang): this requirement may be removed in the future. | 16 // TODO(zqzhang): this requirement may be removed in the future. |
17 presentationUrl = "http://google.com/cast#__castAppId__=CCCCCCCC/"; | 17 presentationUrl = "http://google.com/cast#__castAppId__=CCCCCCCC/"; |
18 } else { | 18 } else { |
19 presentationUrl = "http://www.google.com/#__testprovider__=true"; | 19 presentationUrl = "http://www.google.com/#__testprovider__=true"; |
20 } | 20 } |
21 var startSessionRequest = new PresentationRequest(presentationUrl); | 21 var startSessionRequest = new PresentationRequest([presentationUrl]); |
22 var defaultRequestSessionId = null; | 22 var defaultRequestSessionId = null; |
23 var lastExecutionResult = null; | 23 var lastExecutionResult = null; |
24 var useDomAutomationController = !!window.domAutomationController; | 24 var useDomAutomationController = !!window.domAutomationController; |
25 | 25 |
26 window.navigator.presentation.defaultRequest = startSessionRequest; | 26 window.navigator.presentation.defaultRequest = startSessionRequest; |
27 window.navigator.presentation.defaultRequest.onconnectionavailable = function(e) | 27 window.navigator.presentation.defaultRequest.onconnectionavailable = function(e) |
28 { | 28 { |
29 defaultRequestSessionId = e.connection.id; | 29 defaultRequestSessionId = e.connection.id; |
30 }; | 30 }; |
31 | 31 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 passed: passed, | 212 passed: passed, |
213 errorMessage: errorMessage | 213 errorMessage: errorMessage |
214 })); | 214 })); |
215 } else { | 215 } else { |
216 lastExecutionResult = JSON.stringify({ | 216 lastExecutionResult = JSON.stringify({ |
217 passed: passed, | 217 passed: passed, |
218 errorMessage: errorMessage | 218 errorMessage: errorMessage |
219 }); | 219 }); |
220 } | 220 } |
221 } | 221 } |
OLD | NEW |