OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var testGetAvailableSinks = function() { | 5 var testGetAvailableSinks = function() { |
6 var callback = function(sinks) { | 6 var callback = function(sinks) { |
7 chrome.test.assertEq(1, sinks.length); | 7 chrome.test.assertEq(1, sinks.length); |
8 var sink = sinks[0]; | 8 var sink = sinks[0]; |
9 chrome.test.assertEq(1, sink.id); | 9 chrome.test.assertEq(1, sink.id); |
10 chrome.test.assertEq("Disconnected", sink.state); | 10 chrome.test.assertEq("Disconnected", sink.state); |
(...skipping 16 matching lines...) Expand all Loading... |
27 }; | 27 }; |
28 | 28 |
29 var testRequestAuthentication = function() { | 29 var testRequestAuthentication = function() { |
30 var callback = function(auth_info) { | 30 var callback = function(auth_info) { |
31 chrome.test.assertEq("PBC", auth_info.method); | 31 chrome.test.assertEq("PBC", auth_info.method); |
32 chrome.test.succeed("RequestAuthentication succeded"); | 32 chrome.test.succeed("RequestAuthentication succeded"); |
33 }; | 33 }; |
34 chrome.displaySource.requestAuthentication(1, callback); | 34 chrome.displaySource.requestAuthentication(1, callback); |
35 }; | 35 }; |
36 | 36 |
| 37 var testStartSessionErrorReport = function() { |
| 38 var callback = function() { |
| 39 chrome.test.assertLastError('Invalid stream arguments'); |
| 40 chrome.test.succeed(); |
| 41 }; |
| 42 var session_info = { sinkId: 1, authenticationInfo: { method: "PBC" } }; |
| 43 chrome.displaySource.startSession(session_info, callback); |
| 44 }; |
| 45 |
| 46 var testTerminateSessionErrorReport = function() { |
| 47 var callback = function() { |
| 48 chrome.test.assertLastError('Session not found'); |
| 49 chrome.test.succeed(); |
| 50 }; |
| 51 chrome.displaySource.terminateSession(1, callback); |
| 52 }; |
| 53 |
37 chrome.test.runTests([testGetAvailableSinks, | 54 chrome.test.runTests([testGetAvailableSinks, |
38 testOnSinksUpdated, | 55 testOnSinksUpdated, |
39 testRequestAuthentication]); | 56 testRequestAuthentication, |
| 57 testStartSessionErrorReport, |
| 58 testTerminateSessionErrorReport]); |
OLD | NEW |