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

Side by Side Diff: remoting/webapp/unittests/chrome_mocks.js

Issue 917093003: Shorten Closure template notation from Array.<*> to Array<*>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove cvox 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
« no previous file with comments | « remoting/webapp/js_proto/remoting_proto.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file contains various mock objects for the chrome platform to make 5 // This file contains various mock objects for the chrome platform to make
6 // unit testing easier. 6 // unit testing easier.
7 7
8 Entry = function() {}; 8 Entry = function() {};
9 9
10 (function(scope){ 10 (function(scope){
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 chromeMocks.StorageArea.prototype.clear = function() { 111 chromeMocks.StorageArea.prototype.clear = function() {
112 this.storage_ = null; 112 this.storage_ = null;
113 }; 113 };
114 114
115 chromeMocks.storage.local = new chromeMocks.StorageArea(); 115 chromeMocks.storage.local = new chromeMocks.StorageArea();
116 116
117 var originals_ = null; 117 var originals_ = null;
118 118
119 /** 119 /**
120 * Activates a list of Chrome components to mock 120 * Activates a list of Chrome components to mock
121 * @param {Array.<string>} components 121 * @param {Array<string>} components
122 */ 122 */
123 chromeMocks.activate = function(components) { 123 chromeMocks.activate = function(components) {
124 if (originals_) { 124 if (originals_) {
125 throw new Error('chromeMocks.activate() can only be called once.'); 125 throw new Error('chromeMocks.activate() can only be called once.');
126 } 126 }
127 originals_ = {}; 127 originals_ = {};
128 components.forEach(function(component) { 128 components.forEach(function(component) {
129 if (!chromeMocks[component]) { 129 if (!chromeMocks[component]) {
130 throw new Error('No mocks defined for chrome.' + component); 130 throw new Error('No mocks defined for chrome.' + component);
131 } 131 }
132 originals_[component] = chrome[component]; 132 originals_[component] = chrome[component];
133 chrome[component] = chromeMocks[component]; 133 chrome[component] = chromeMocks[component];
134 }); 134 });
135 }; 135 };
136 136
137 chromeMocks.restore = function() { 137 chromeMocks.restore = function() {
138 if (!originals_) { 138 if (!originals_) {
139 throw new Error('You must call activate() before restore().'); 139 throw new Error('You must call activate() before restore().');
140 } 140 }
141 for (var components in originals_) { 141 for (var components in originals_) {
142 chrome[components] = originals_[components]; 142 chrome[components] = originals_[components];
143 } 143 }
144 originals_ = null; 144 originals_ = null;
145 }; 145 };
146 146
147 scope.chromeMocks = chromeMocks; 147 scope.chromeMocks = chromeMocks;
148 148
149 })(window); 149 })(window);
OLDNEW
« no previous file with comments | « remoting/webapp/js_proto/remoting_proto.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698