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

Side by Side Diff: remoting/webapp/browser_test/mock_identity.js

Issue 927373005: [Chromoting] Enable jscompile for browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests; More review comments Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * @fileoverview 6 * @fileoverview
7 * Mock implementation of chrome.identity. 7 * Mock implementation of chrome.identity.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 /** 61 /**
62 * @param {remoting.MockIdentity.AccessToken} accessToken 62 * @param {remoting.MockIdentity.AccessToken} accessToken
63 */ 63 */
64 remoting.MockIdentity.prototype.setAccessToken = function(accessToken) { 64 remoting.MockIdentity.prototype.setAccessToken = function(accessToken) {
65 this.accessToken_ = accessToken; 65 this.accessToken_ = accessToken;
66 }; 66 };
67 67
68 /** 68 /**
69 * @param {string} token 69 * @param {string} token
70 * @param {function()} onDone 70 * @param {Function} onDone
71 * @param {function()} onError 71 * @param {function(remoting.Error)} onError
72 * @param {Array<*>} values 72 * @param {Array<*>} values
73 */ 73 */
74 remoting.MockIdentity.validateTokenAndCall = 74 remoting.MockIdentity.validateTokenAndCall =
75 function(token, onDone, onError, values) { 75 function(token, onDone, onError, values) {
76 if (token == remoting.MockIdentity.AccessToken.VALID) { 76 if (token == remoting.MockIdentity.AccessToken.VALID) {
77 window.setTimeout( 77 window.setTimeout(
78 onDone.apply.bind(onDone, null, values), 78 onDone.apply.bind(onDone, null, values),
79 0); 79 0);
80 } else { 80 } else {
81 window.setTimeout( 81 window.setTimeout(
82 onError.bind(null, remoting.Error.AUTHENTICATION_FAILED), 82 onError.bind(null, remoting.Error.AUTHENTICATION_FAILED),
83 0); 83 0);
84 } 84 }
85 }; 85 };
86 86
87 /** 87 /**
88 * @param {function()} onDone 88 * @param {Function} onDone
89 * @param {function()} onError 89 * @param {function(remoting.Error)} onError
90 * @param {Array<*>} values 90 * @param {Array<*>} values
91 */ 91 */
92 remoting.MockIdentity.prototype.validateTokenAndCall = 92 remoting.MockIdentity.prototype.validateTokenAndCall =
93 function(onDone, onError, values) { 93 function(onDone, onError, values) {
94 remoting.MockIdentity.validateTokenAndCall( 94 remoting.MockIdentity.validateTokenAndCall(
95 this.accessToken_, onDone, onError, values); 95 this.accessToken_, onDone, onError, values);
96 }; 96 };
97 97
98 /** 98 /**
99 * @param {boolean} active 99 * @param {boolean} active
100 */ 100 */
101 remoting.MockIdentity.setActive = function(active) { 101 remoting.MockIdentity.setActive = function(active) {
102 chrome.identity = active ? remoting.mockIdentity 102 chrome.identity = active ? remoting.mockIdentity
103 : remoting.savedIdentityApi; 103 : remoting.savedIdentityApi;
104 }; 104 };
105 105
106 /** @type {Object} */ 106 /** @type {Object} */
107 remoting.savedIdentityApi = chrome.identity; 107 remoting.savedIdentityApi = chrome.identity;
108 108
109 /** @type {remoting.MockIdentity} */ 109 /** @type {remoting.MockIdentity} */
110 remoting.mockIdentity = new remoting.MockIdentity(); 110 remoting.mockIdentity = new remoting.MockIdentity();
OLDNEW
« no previous file with comments | « remoting/webapp/browser_test/mock_host_list_api.js ('k') | remoting/webapp/browser_test/mock_oauth2_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698