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

Unified Diff: chrome/browser/resources/file_manager/js/mock_chrome.js

Issue 10391103: [File Manager] Add/remove Google Drive folder in the open File Manager when Drive enabled/disabled … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 7 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
Index: chrome/browser/resources/file_manager/js/mock_chrome.js
diff --git a/chrome/browser/resources/file_manager/js/mock_chrome.js b/chrome/browser/resources/file_manager/js/mock_chrome.js
index dba6022e041d23885b61b01545b608c9369f712e..10a7498f1c53f5b05ecadbd00cd72a9dc48c9d8d 100644
--- a/chrome/browser/resources/file_manager/js/mock_chrome.js
+++ b/chrome/browser/resources/file_manager/js/mock_chrome.js
@@ -26,6 +26,14 @@ MockEventSource.prototype.notify = function(var_args) {
}.bind(this, arguments), 0);
};
+function cloneShallow(object) {
+ var clone = {};
+ for (var key in object)
+ if (object.hasOwnProperty(key))
+ clone[key] = object[key];
+ return clone;
+}
+
/**
* Mock out the chrome.fileBrowserPrivate API for use in the harness.
*/
@@ -327,6 +335,7 @@ chrome.fileBrowserPrivate = {
},
gdataPreferences_: {
+ driveEnabled: true,
cellularDisabled: true,
hostedFilesDisabled: false
},
@@ -334,7 +343,8 @@ chrome.fileBrowserPrivate = {
onGDataPreferencesChanged: new MockEventSource(),
getGDataPreferences: function(callback) {
- setTimeout(callback, 0, chrome.fileBrowserPrivate.gdataPreferences_);
+ setTimeout(callback, 0, cloneShallow(
+ chrome.fileBrowserPrivate.gdataPreferences_));
},
setGDataPreferences: function(preferences) {
@@ -352,7 +362,8 @@ chrome.fileBrowserPrivate = {
onNetworkConnectionChanged: new MockEventSource(),
getNetworkConnectionState: function(callback) {
- setTimeout(callback, 0, chrome.fileBrowserPrivate.networkConnectionState_);
+ setTimeout(callback, 0, cloneShallow(
+ chrome.fileBrowserPrivate.networkConnectionState_));
},
setConnectionState_: function(state) {
@@ -389,7 +400,7 @@ chrome.fileBrowserPrivate = {
getStrings: function(callback) {
// Keep this list in sync with the strings in generated_resources.grd and
// extension_file_browser_private_api.cc!
- callback({
+ setTimeout(callback, 0, {
// These two are from locale_settings*.grd
WEB_FONT_FAMILY: 'Open Sans,Chrome Droid Sans,' +
'Droid Sans Fallback,sans-serif',
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_manager.js ('k') | chrome/common/extensions/api/file_browser_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698