OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var chrome = chrome || {}; | 5 var chrome = chrome || {}; |
6 | 6 |
7 // TODO(akalin): Add mocking code for e.g. chrome.send() so that we | 7 // TODO(akalin): Add mocking code for e.g. chrome.send() so that we |
8 // can test this without rebuilding chrome. | 8 // can test this without rebuilding chrome. |
9 | 9 |
10 /** | 10 /** |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 var syncFunctions = [ | 140 var syncFunctions = [ |
141 // Sync service functions. | 141 // Sync service functions. |
142 'getAboutInfo', | 142 'getAboutInfo', |
143 | 143 |
144 // Notification functions. See chrome/browser/sync/engine/syncapi.h | 144 // Notification functions. See chrome/browser/sync/engine/syncapi.h |
145 // for docs. | 145 // for docs. |
146 'getNotificationState', | 146 'getNotificationState', |
147 'getNotificationInfo', | 147 'getNotificationInfo', |
148 | 148 |
| 149 // Get a static list of available data types. |
| 150 'getListOfTypes', |
| 151 |
149 // Client server communication logging functions. | 152 // Client server communication logging functions. |
150 'getClientServerTraffic', | 153 'getClientServerTraffic', |
151 | 154 |
152 // Node lookup functions. See chrome/browser/sync/engine/syncapi.h | 155 // Get an array containing a JSON representations of all known sync nodes. |
153 // for docs. | |
154 'getRootNodeDetails', | |
155 'getNodeSummariesById', | |
156 'getNodeDetailsById', | |
157 'getChildNodeIds', | |
158 'getAllNodes', | 156 'getAllNodes', |
159 ]; | 157 ]; |
160 | 158 |
161 for (var i = 0; i < syncFunctions.length; ++i) { | 159 for (var i = 0; i < syncFunctions.length; ++i) { |
162 var syncFunction = syncFunctions[i]; | 160 var syncFunction = syncFunctions[i]; |
163 chrome.sync[syncFunction] = makeSyncFunction(syncFunction); | 161 chrome.sync[syncFunction] = makeSyncFunction(syncFunction); |
164 } | 162 } |
165 | 163 |
166 /** | 164 /** |
167 * Returns an object which measures elapsed time. | 165 * Returns an object which measures elapsed time. |
168 */ | 166 */ |
169 chrome.sync.makeTimer = function() { | 167 chrome.sync.makeTimer = function() { |
170 var start = new Date(); | 168 var start = new Date(); |
171 | 169 |
172 return { | 170 return { |
173 /** | 171 /** |
174 * @return {number} The number of seconds since the timer was | 172 * @return {number} The number of seconds since the timer was |
175 * created. | 173 * created. |
176 */ | 174 */ |
177 get elapsedSeconds() { | 175 get elapsedSeconds() { |
178 return ((new Date()).getTime() - start.getTime()) / 1000.0; | 176 return ((new Date()).getTime() - start.getTime()) / 1000.0; |
179 } | 177 } |
180 }; | 178 }; |
181 }; | 179 }; |
182 | 180 |
183 })(); | 181 })(); |
OLD | NEW |