| 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 let params = (new URL(window.location.href)).searchParams; | 14 let params = (new URL(window.location.href)).searchParams; |
| 15 | 15 |
| 16 if (params.get('__is_android__') == 'true') { | 16 if (params.get('__is_android__') == 'true') { |
| 17 // For android, "google.com/cast" is required in presentation URL. | 17 // For android, "google.com/cast" is required in presentation URL. |
| 18 // TODO(zqzhang): this requirement may be removed in the future. | 18 // TODO(zqzhang): this requirement may be removed in the future. |
| 19 presentationUrl = "https://google.com/cast#__castAppId__=CCCCCCCC/"; | 19 presentationUrl = "https://google.com/cast#__castAppId__=CCCCCCCC/"; |
| 20 } else if (params.get('__oneUA__') == 'true') { | 20 } else if (params.get('__oneUA__') == 'true') { |
| 21 presentationUrl = | 21 presentationUrl = "presentation_receiver.html"; |
| 22 "presentation_receiver.html#__testprovider__=true&__oneUA__=true"; | |
| 23 } else if (params.get('__oneUANoReceiver__') == 'true') { | 22 } else if (params.get('__oneUANoReceiver__') == 'true') { |
| 24 presentationUrl = "https://www.google.com#__testprovider__=true&__oneUA__=true
"; | 23 presentationUrl = "https://www.google.com"; |
| 25 } else { | 24 } else { |
| 26 presentationUrl = "http://www.google.com/#__testprovider__=true"; | 25 presentationUrl = "test://test"; |
| 27 } | 26 } |
| 28 | 27 |
| 29 var startSessionRequest = new PresentationRequest([presentationUrl]); | 28 var startSessionRequest = new PresentationRequest([presentationUrl]); |
| 30 var defaultRequestSessionId = null; | 29 var defaultRequestSessionId = null; |
| 31 var lastExecutionResult = null; | 30 var lastExecutionResult = null; |
| 32 var useDomAutomationController = !!window.domAutomationController; | 31 var useDomAutomationController = !!window.domAutomationController; |
| 33 | 32 |
| 34 window.navigator.presentation.defaultRequest = startSessionRequest; | 33 window.navigator.presentation.defaultRequest = startSessionRequest; |
| 35 window.navigator.presentation.defaultRequest.onconnectionavailable = function(e) | 34 window.navigator.presentation.defaultRequest.onconnectionavailable = function(e) |
| 36 { | 35 { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 passed: passed, | 302 passed: passed, |
| 304 errorMessage: errorMessage | 303 errorMessage: errorMessage |
| 305 })); | 304 })); |
| 306 } else { | 305 } else { |
| 307 lastExecutionResult = JSON.stringify({ | 306 lastExecutionResult = JSON.stringify({ |
| 308 passed: passed, | 307 passed: passed, |
| 309 errorMessage: errorMessage | 308 errorMessage: errorMessage |
| 310 }); | 309 }); |
| 311 } | 310 } |
| 312 } | 311 } |
| OLD | NEW |