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

Side by Side Diff: remoting/webapp/crd/js/me2me_telemetry_integration_test.js

Issue 1397463003: Report the Auth method for me2me connections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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
OLDNEW
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 5
6 /** @suppress {duplicate} */ 6 /** @suppress {duplicate} */
7 var remoting = remoting || {}; 7 var remoting = remoting || {};
8 8
9 (function() { 9 (function() {
10 10
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 }); 277 });
278 278
279 var count = 0; 279 var count = 0;
280 function onPluginCreated(/** remoting.MockClientPlugin */ plugin) { 280 function onPluginCreated(/** remoting.MockClientPlugin */ plugin) {
281 count++; 281 count++;
282 if (count == 1) { 282 if (count == 1) {
283 plugin.mock$returnErrorOnConnect( 283 plugin.mock$returnErrorOnConnect(
284 remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE); 284 remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE);
285 } else if (count == 2) { 285 } else if (count == 2) {
286 plugin.mock$useDefaultBehavior( 286 plugin.mock$useDefaultBehavior(
287 remoting.MockClientPlugin.AuthMethod.PIN); 287 remoting.ChromotingEvent.AuthMethod.PIN);
288 } 288 }
289 } 289 }
290 290
291 /** 291 /**
292 * @param {remoting.MockClientPlugin} plugin 292 * @param {remoting.MockClientPlugin} plugin
293 * @param {remoting.ClientSession.State} state 293 * @param {remoting.ClientSession.State} state
294 */ 294 */
295 function onStatusChanged(plugin, state) { 295 function onStatusChanged(plugin, state) {
296 if (state == remoting.ClientSession.State.CONNECTED) { 296 if (state == remoting.ClientSession.State.CONNECTED) {
297 testDriver.me2meActivity().stop(); 297 testDriver.me2meActivity().stop();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 } 400 }
401 } 401 }
402 402
403 testDriver.mockConnection().pluginFactory().mock$setPluginStatusChanged( 403 testDriver.mockConnection().pluginFactory().mock$setPluginStatusChanged(
404 onStatusChanged); 404 onStatusChanged);
405 405
406 return testDriver.startTest(); 406 return testDriver.startTest();
407 }); 407 });
408 408
409
410 /**
411 * @param {remoting.Me2MeTestDriver} testDriver
412 * @param {remoting.ChromotingEvent.AuthMethod} authMethod
413 * @return {Promise}
414 */
415 function createAuthMethodTest(testDriver, authMethod) {
416 var ChromotingEvent = remoting.ChromotingEvent;
417 expectSequence(
418 testDriver,
419 {
420 session_entry_point: ChromotingEvent.SessionEntryPoint.CONNECT_BUTTON,
421 role: ChromotingEvent.Role.CLIENT,
422 mode: ChromotingEvent.Mode.ME2ME,
423 },
424 [
425 ChromotingEvent.SessionState.STARTED,
426 ChromotingEvent.SessionState.SIGNALING,
427 ChromotingEvent.SessionState.CREATING_PLUGIN,
428 ChromotingEvent.SessionState.CONNECTING,
429 ]);
430 expectSequence(
431 testDriver,
432 {
433 session_entry_point: ChromotingEvent.SessionEntryPoint.CONNECT_BUTTON,
434 role: ChromotingEvent.Role.CLIENT,
435 mode: ChromotingEvent.Mode.ME2ME,
436 auth_method: authMethod
437 },
438 [
439 ChromotingEvent.SessionState.AUTHENTICATED,
440 ChromotingEvent.SessionState.CONNECTED,
441 ChromotingEvent.SessionState.CLOSED
442 ]);
443
444 /**
445 * @param {remoting.MockClientPlugin} plugin
446 * @param {remoting.ClientSession.State} state
447 */
448 function onStatusChanged(plugin, state) {
449 if (state == remoting.ClientSession.State.CONNECTED) {
450 testDriver.me2meActivity().stop();
451 testDriver.endTest();
452 }
453 }
454 function onPluginCreated(/** remoting.MockClientPlugin */ plugin) {
455 plugin.mock$useDefaultBehavior(authMethod);
456 }
457
458 testDriver.mockConnection().pluginFactory().mock$setPluginCreated(
459 onPluginCreated);
460 testDriver.mockConnection().pluginFactory().mock$setPluginStatusChanged(
461 onStatusChanged);
462
463 return testDriver.startTest();
464 }
465
466 QUnit.test('Auth method - THIRD_PARTY (connected)', function() {
467 return createAuthMethodTest(testDriver,
468 remoting.ChromotingEvent.AuthMethod.THIRD_PARTY);
469 });
470
471 QUnit.test('Auth method - PINLESS (connected)', function() {
472 return createAuthMethodTest(testDriver,
473 remoting.ChromotingEvent.AuthMethod.PINLESS);
474 });
475
476 QUnit.test('Auth method - PIN (connected)', function() {
477 return createAuthMethodTest(testDriver,
478 remoting.ChromotingEvent.AuthMethod.PIN);
479 });
480
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.
409 })(); 481 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698