| 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 // TODO(akalin): Add mocking code for e.g. chrome.send() so that we | 6 // TODO(akalin): Add mocking code for e.g. chrome.send() so that we |
| 7 // can test this without rebuilding chrome. | 7 // can test this without rebuilding chrome. |
| 8 chrome.sync = chrome.sync || {}; | 8 chrome.sync = chrome.sync || {}; |
| 9 (function () { | 9 (function () { |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Notification functions. See chrome/browser/sync/engine/syncapi.h | 134 // Notification functions. See chrome/browser/sync/engine/syncapi.h |
| 135 // for docs. | 135 // for docs. |
| 136 'getNotificationState', | 136 'getNotificationState', |
| 137 'getNotificationInfo', | 137 'getNotificationInfo', |
| 138 | 138 |
| 139 // Node lookup functions. See chrome/browser/sync/engine/syncapi.h | 139 // Node lookup functions. See chrome/browser/sync/engine/syncapi.h |
| 140 // for docs. | 140 // for docs. |
| 141 'getRootNodeDetails', | 141 'getRootNodeDetails', |
| 142 'getNodeSummariesById', | 142 'getNodeSummariesById', |
| 143 'getNodeDetailsById', | 143 'getNodeDetailsById', |
| 144 'getChildNodeIds', | 144 'getAllNodes', |
| 145 'findNodesContainingString' | 145 'getChildNodeIds' |
| 146 ]; | 146 ]; |
| 147 | 147 |
| 148 for (var i = 0; i < syncFunctions.length; ++i) { | 148 for (var i = 0; i < syncFunctions.length; ++i) { |
| 149 var syncFunction = syncFunctions[i]; | 149 var syncFunction = syncFunctions[i]; |
| 150 chrome.sync[syncFunction] = makeSyncFunction(syncFunction); | 150 chrome.sync[syncFunction] = makeSyncFunction(syncFunction); |
| 151 } | 151 } |
| 152 | 152 |
| 153 /** | 153 /** |
| 154 * Returns an object which measures elapsed time. | 154 * Returns an object which measures elapsed time. |
| 155 */ | 155 */ |
| 156 chrome.sync.makeTimer = function() { | 156 chrome.sync.makeTimer = function() { |
| 157 var start = new Date(); | 157 var start = new Date(); |
| 158 | 158 |
| 159 return { | 159 return { |
| 160 /** | 160 /** |
| 161 * @return {number} The number of seconds since the timer was | 161 * @return {number} The number of seconds since the timer was |
| 162 * created. | 162 * created. |
| 163 */ | 163 */ |
| 164 get elapsedSeconds() { | 164 get elapsedSeconds() { |
| 165 return ((new Date()).getTime() - start.getTime()) / 1000.0; | 165 return ((new Date()).getTime() - start.getTime()) / 1000.0; |
| 166 } | 166 } |
| 167 }; | 167 }; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 })(); | 170 })(); |
| OLD | NEW |