Chromium Code Reviews| Index: remoting/webapp/crd/js/me2me_telemetry_integration_test.js |
| diff --git a/remoting/webapp/crd/js/me2me_telemetry_integration_test.js b/remoting/webapp/crd/js/me2me_telemetry_integration_test.js |
| index b7d36cfc40707541f9f6044986a181185f495556..f7d34ee41c35e8c4a38b434922344558c68aad10 100644 |
| --- a/remoting/webapp/crd/js/me2me_telemetry_integration_test.js |
| +++ b/remoting/webapp/crd/js/me2me_telemetry_integration_test.js |
| @@ -284,7 +284,7 @@ QUnit.test('HOST_OFFLINE - JID refresh succeeded', function() { |
| remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE); |
| } else if (count == 2) { |
| plugin.mock$useDefaultBehavior( |
| - remoting.MockClientPlugin.AuthMethod.PIN); |
| + remoting.ChromotingEvent.AuthMethod.PIN); |
| } |
| } |
| @@ -406,4 +406,76 @@ QUnit.test('Connection dropped - Auto Reconnect', function() { |
| return testDriver.startTest(); |
| }); |
| + |
| +/** |
| + * @param {remoting.Me2MeTestDriver} testDriver |
| + * @param {remoting.ChromotingEvent.AuthMethod} authMethod |
| + * @return {Promise} |
| + */ |
| +function createAuthMethodTest(testDriver, authMethod) { |
| + var ChromotingEvent = remoting.ChromotingEvent; |
| + expectSequence( |
| + testDriver, |
| + { |
| + session_entry_point: ChromotingEvent.SessionEntryPoint.CONNECT_BUTTON, |
| + role: ChromotingEvent.Role.CLIENT, |
| + mode: ChromotingEvent.Mode.ME2ME, |
| + }, |
| + [ |
| + ChromotingEvent.SessionState.STARTED, |
| + ChromotingEvent.SessionState.SIGNALING, |
| + ChromotingEvent.SessionState.CREATING_PLUGIN, |
| + ChromotingEvent.SessionState.CONNECTING, |
| + ]); |
| + expectSequence( |
| + testDriver, |
| + { |
| + session_entry_point: ChromotingEvent.SessionEntryPoint.CONNECT_BUTTON, |
| + role: ChromotingEvent.Role.CLIENT, |
| + mode: ChromotingEvent.Mode.ME2ME, |
| + auth_method: authMethod |
| + }, |
| + [ |
| + ChromotingEvent.SessionState.AUTHENTICATED, |
| + ChromotingEvent.SessionState.CONNECTED, |
| + ChromotingEvent.SessionState.CLOSED |
| + ]); |
| + |
| + /** |
| + * @param {remoting.MockClientPlugin} plugin |
| + * @param {remoting.ClientSession.State} state |
| + */ |
| + function onStatusChanged(plugin, state) { |
| + if (state == remoting.ClientSession.State.CONNECTED) { |
| + testDriver.me2meActivity().stop(); |
| + testDriver.endTest(); |
| + } |
| + } |
| + function onPluginCreated(/** remoting.MockClientPlugin */ plugin) { |
| + plugin.mock$useDefaultBehavior(authMethod); |
| + } |
| + |
| + testDriver.mockConnection().pluginFactory().mock$setPluginCreated( |
| + onPluginCreated); |
| + testDriver.mockConnection().pluginFactory().mock$setPluginStatusChanged( |
| + onStatusChanged); |
| + |
| + return testDriver.startTest(); |
| +} |
| + |
| +QUnit.test('Auth method - THIRD_PARTY (connected)', function() { |
| + return createAuthMethodTest(testDriver, |
| + remoting.ChromotingEvent.AuthMethod.THIRD_PARTY); |
| +}); |
| + |
| +QUnit.test('Auth method - PINLESS (connected)', function() { |
| + return createAuthMethodTest(testDriver, |
| + remoting.ChromotingEvent.AuthMethod.PINLESS); |
| +}); |
| + |
| +QUnit.test('Auth method - PIN (connected)', function() { |
| + return createAuthMethodTest(testDriver, |
| + remoting.ChromotingEvent.AuthMethod.PIN); |
| +}); |
| + |
|
Jamie
2015/10/09 01:17:21
Add a test that the auth method is set for failed
kelvinp
2015/10/09 18:00:34
Done.
|
| })(); |