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

Unified Diff: remoting/webapp/browser_test/mock_identity.js

Issue 984203003: Move mocks and unittest JS files to sit alongside production code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/browser_test/mock_identity.js
diff --git a/remoting/webapp/browser_test/mock_identity.js b/remoting/webapp/browser_test/mock_identity.js
deleted file mode 100644
index 48d0366efcd24a0e4b7f4aa0a5ae554678b74031..0000000000000000000000000000000000000000
--- a/remoting/webapp/browser_test/mock_identity.js
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview
- * Mock implementation of chrome.identity.
- */
-
-'use strict';
-
-/** @suppress {duplicate} */
-var remoting = remoting || {};
-
-/**
- * @constructor
- */
-remoting.MockIdentity = function() {
- /**
- * @type {remoting.MockIdentity.AccessToken}
- * @private
- */
- this.accessToken_ = remoting.MockIdentity.AccessToken.NONE;
-};
-
-/**
- * @param {Object} details
- * @param {function(string)} callback
- */
-remoting.MockIdentity.prototype.getAuthToken = function(details, callback) {
- window.setTimeout(callback.bind(null, this.accessToken_), 0);
-};
-
-/**
- * @param {Object} details
- * @param {function()} callback
- */
-remoting.MockIdentity.prototype.removeCachedAuthToken =
- function(details, callback) {
- window.setTimeout(callback, 0);
-};
-
-/**
- * @param {Object} details
- * @param {function()} callback
- */
-remoting.MockIdentity.prototype.launchWebAuthFlow =
- function(details, callback) {
- // TODO(jamiewalch): Work out how to test third-party auth.
- console.error('No mock implementation for launchWebAuthFlow.');
-};
-
-
-/** @enum {string} */
-remoting.MockIdentity.AccessToken = {
- VALID: 'valid-token',
- INVALID: 'invalid-token',
- NONE: ''
-};
-
-/**
- * @param {remoting.MockIdentity.AccessToken} accessToken
- */
-remoting.MockIdentity.prototype.setAccessToken = function(accessToken) {
- this.accessToken_ = accessToken;
-};
-
-/**
- * @param {string} token
- * @param {Function} onDone
- * @param {function(!remoting.Error)} onError
- * @param {Array<*>} values
- */
-remoting.MockIdentity.validateTokenAndCall =
- function(token, onDone, onError, values) {
- if (token == remoting.MockIdentity.AccessToken.VALID) {
- window.setTimeout(
- onDone.apply.bind(onDone, null, values),
- 0);
- } else {
- window.setTimeout(
- onError.bind(null, remoting.Error.AUTHENTICATION_FAILED),
- 0);
- }
-};
-
-/**
- * @param {Function} onDone
- * @param {function(!remoting.Error)} onError
- * @param {Array<*>} values
- */
-remoting.MockIdentity.prototype.validateTokenAndCall =
- function(onDone, onError, values) {
- remoting.MockIdentity.validateTokenAndCall(
- this.accessToken_, onDone, onError, values);
-};
-
-/**
- * @param {boolean} active
- */
-remoting.MockIdentity.setActive = function(active) {
- chrome.identity = active ? remoting.mockIdentity
- : remoting.savedIdentityApi;
-};
-
-/** @type {Object} */
-remoting.savedIdentityApi = chrome.identity;
-
-/** @type {remoting.MockIdentity} */
-remoting.mockIdentity = new remoting.MockIdentity();
« 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