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

Side by Side Diff: remoting/webapp/base/js/xmpp_error_cache_unittest.js

Issue 1410563006: [Chromoting] SessionLogger refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 (function() { 5 (function() {
6 6
7 'use strict'; 7 'use strict';
8 8
9 QUnit.module('XmppErrorCache'); 9 QUnit.module('XmppErrorCache');
10 10
11 /** 11 /**
12 * @param {string} stanza 12 * @param {string} stanza
13 * @param {string} expected 13 * @param {string} expected
14 * @param {QUnit.Assert} assert 14 * @param {QUnit.Assert} assert
15 */ 15 */
16 function runStanzaTest(stanza, expected, assert) { 16 function runStanzaTest(stanza, expected, assert) {
17 var monitor = new remoting.XmppErrorCache(); 17 var monitor = new remoting.XmppErrorCache();
18 var parser = new DOMParser(); 18 var parser = new DOMParser();
19 var xml = parser.parseFromString(stanza, 'text/xml'); 19 var xml = parser.parseFromString(stanza, 'text/xml');
20 monitor.processStanza(xml.firstElementChild); 20 monitor.processStanza(xml.firstElementChild);
21 var error = monitor.getFirstError(); 21 var errorStanza = monitor.getFirstErrorStanza();
22 assert.equal(error.raw_stanza, expected); 22 assert.equal(errorStanza, expected);
23 } 23 }
24 24
25 QUnit.test('should strip PII from session-initiate.', function(assert) { 25 QUnit.test('should strip PII from session-initiate.', function(assert) {
26 var input = 26 var input =
27 '<iq xmlns="jabber:client" to="foo@google.com/chromotingE5A" ' + 27 '<iq xmlns="jabber:client" to="foo@google.com/chromotingE5A" ' +
28 'type="error" id="12747556118995360108" ' + 28 'type="error" id="12747556118995360108" ' +
29 'from="123@chromoting.gserviceaccount.com/chromoting21B21C01">' + 29 'from="123@chromoting.gserviceaccount.com/chromoting21B21C01">' +
30 '<jingle xmlns="urn:xmpp:jingle:1" sid="3953621430175055977" ' + 30 '<jingle xmlns="urn:xmpp:jingle:1" sid="3953621430175055977" ' +
31 'action="session-initiate" ' + 31 'action="session-initiate" ' +
32 'initiator="foo@google.com/chromotingE5A">' + 32 'initiator="foo@google.com/chromotingE5A">' +
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 '</content>' + 86 '</content>' +
87 '</jingle>' + 87 '</jingle>' +
88 '<error code="503" type="cancel">' + 88 '<error code="503" type="cancel">' +
89 '<service-unavailable xmlns="urn:ietf:xml:ns:xmpp-stanzas"/>' + 89 '<service-unavailable xmlns="urn:ietf:xml:ns:xmpp-stanzas"/>' +
90 '</error>' + 90 '</error>' +
91 '</iq>'; 91 '</iq>';
92 runStanzaTest(input, expected, assert); 92 runStanzaTest(input, expected, assert);
93 }); 93 });
94 94
95 })(); 95 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698