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

Unified Diff: chrome/browser/resources/quota_internals/mock_chrome_message.js

Issue 7053009: Add chrome://quota-internals/ resources (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add descriptions Created 9 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/quota_internals/mock_chrome_message.js
diff --git a/chrome/browser/resources/quota_internals/mock_chrome_message.js b/chrome/browser/resources/quota_internals/mock_chrome_message.js
new file mode 100644
index 0000000000000000000000000000000000000000..e19f9b5a3b42061a7721eeca3c7d36e336b86779
--- /dev/null
+++ b/chrome/browser/resources/quota_internals/mock_chrome_message.js
@@ -0,0 +1,107 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+'use strict';
+
+if (!window.chrome || !chrome.send) {
+ document.title += ' (test mode)';
+
+ /**
+ * @type {string}
+ */
+ var available_space = '1000000000000';
+
+ /**
+ * @type {{
Evan Stade 2011/06/01 00:48:25 needs textual explanation
+ * type: {!string},
Evan Stade 2011/06/01 00:48:25 these need textual explanations as well
+ * usage: {?string},
+ * quota: {?string}
+ * }}
+ */
+ var global_data_temporary = {
+ type: 'temporary',
+ usage: '1000',
+ unlimited_usage: '100',
Evan Stade 2011/06/01 00:48:25 this one is not documented
tzik 2011/06/03 16:13:47 Done.
+ quota: '1000000'
+ };
+ var global_data_persistent = {
+ type: 'persistent',
+ usage: '10',
+ quota: '10000'
+ };
+
+ /**
+ * @type {Array.<{
+ * host: {!string},
+ * type: {!string},
+ * usage: {?string},
+ * quota: {?string}
+ * }>}
+ */
+ var host_data = [
+ {
Evan Stade 2011/06/01 00:48:25 http://google-styleguide.googlecode.com/svn/trunk/
tzik 2011/06/03 16:13:47 Done.
+ host: 'example.com',
+ type: 'temporary',
+ usage: '0'
+ },
+ {
+ host: 'example.com',
+ type: 'persistent',
+ usage: '0',
+ quota: '0'
+ }
+ ];
+
+ /**
+ * @type {Array.<{
+ * origin: {!string},
+ * type: {!string},
+ * host: {!string},
+ * in_use: {?boolean}
+ * used_count: {?number},
+ * last_access_time: {?number}
+ * }>}
+ */
+ var origin_data = [
+ {
+ origin: 'http://example.com/',
+ type: 'temporary',
+ host: 'example.com',
+ in_use: true,
+ used_count: 1,
+ last_access_time: Date.now()
+ },
+ {
+ origin: 'http://example.com/',
+ type: 'persistent',
+ host: 'example.com'
+ }
+ ];
+
+ var stat_data = {
+ 'eviction-rounds': '1000',
+ 'evicted-origins': '123'
+ };
+
+ if (!window.chrome)
+ window.chrome = {};
+ window.chrome.send = function(msg, param) {
+ switch (msg) {
+ case 'requestData':
+ cr.quota.messageHandler_('AvailableSpaceUpdated', available_space);
+ cr.quota.messageHandler_('GlobalDataUpdated', global_data_temporary);
+ cr.quota.messageHandler_('GlobalDataUpdated', global_data_persistent);
+ cr.quota.messageHandler_('HostDataUpdated', host_data);
+ cr.quota.messageHandler_('OriginDataUpdated', origin_data);
+ cr.quota.messageHandler_('StatisticsUpdated', stat_data);
+ break;
+ default:
+ console.log('Unknown Message: ' + msg);
+ break;
+ }
+ };
+}
+
+})();

Powered by Google App Engine
This is Rietveld 408576698