Chromium Code Reviews| 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 function MockEventSource() { | 5 function MockEventSource() { |
| 6 this.listeners_ = []; | 6 this.listeners_ = []; |
| 7 } | 7 } |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Add a listener. | 10 * Add a listener. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 function cloneShallow(object) { | 41 function cloneShallow(object) { |
| 42 var clone = {}; | 42 var clone = {}; |
| 43 for (var key in object) | 43 for (var key in object) |
| 44 if (object.hasOwnProperty(key)) | 44 if (object.hasOwnProperty(key)) |
| 45 clone[key] = object[key]; | 45 clone[key] = object[key]; |
| 46 return clone; | 46 return clone; |
| 47 } | 47 } |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Mock for |chrome| namespace. | |
| 51 */ | |
| 52 var chrome = {}; | |
| 53 | |
| 54 /** | |
| 50 * Mock out the chrome.fileBrowserPrivate API for use in the harness. | 55 * Mock out the chrome.fileBrowserPrivate API for use in the harness. |
| 51 */ | 56 */ |
| 52 chrome.fileBrowserPrivate = { | 57 chrome.fileBrowserPrivate = { |
| 53 /** | 58 /** |
| 54 * Used to distinguish the mock object from the real one. | 59 * Used to distinguish the mock object from the real one. |
| 55 */ | 60 */ |
| 56 mocked: true, | 61 mocked: true, |
| 57 | 62 |
| 58 /** | 63 /** |
| 59 * window.PERSISTENT is a little nicer but not yet supported by packaged apps. | 64 * window.PERSISTENT is a little nicer but not yet supported by packaged apps. |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 890 playAudio: function(urls, position) { | 895 playAudio: function(urls, position) { |
| 891 this.audioPlaylist_ = { items: urls, position: position }; | 896 this.audioPlaylist_ = { items: urls, position: position }; |
| 892 this.onPlaylistChanged.notify(); | 897 this.onPlaylistChanged.notify(); |
| 893 }, | 898 }, |
| 894 | 899 |
| 895 playVideo: function(url) { | 900 playVideo: function(url) { |
| 896 this.videoUrl_ = url; | 901 this.videoUrl_ = url; |
| 897 this.onVideoLaunched.notify(); | 902 this.onVideoLaunched.notify(); |
| 898 } | 903 } |
| 899 }; | 904 }; |
| 905 | |
| 906 /** | |
| 907 * Mock for |v8Intl| namespace. | |
| 908 */ | |
| 909 var v8Intl = {}; | |
|
mtomasz
2013/02/14 05:26:24
Why do we mock this? It is always available on chr
yoshiki
2013/02/14 06:20:28
It needs to compile with closure compiler, but not
| |
| 910 | |
| 911 /** | |
| 912 * Mock constructor of |v8Intl.Collator|. | |
| 913 * @constructor | |
| 914 * @param {Array<*>} locales //TODO(JSDOC). | |
| 915 * @param {Object.<*, *>} options //TODO(JSDOC). | |
| 916 */ | |
| 917 v8Intl.Collator = function(locales, options) {}; | |
| 918 | |
| 919 /** | |
| 920 * Mock constructor of |v8Intl.DateTimeFormat|. | |
| 921 * @constructor | |
| 922 * @param {Array<*>} locales //TODO(JSDOC). | |
| 923 * @param {Object.<*, *>} options //TODO(JSDOC). | |
| 924 */ | |
| 925 v8Intl.DateTimeFormat = function(locales, options) {}; | |
| OLD | NEW |