Bug 1137527 - Part 2: Add a test for GC MemoryActor events. r=jryans

--HG--
extra : rebase_source : ba19473ed6147df6f478fe3f33b1f0aa737d578e
This commit is contained in:
Nick Fitzgerald 2015-04-23 16:26:00 -04:00
Родитель a5e4501ce2
Коммит db0be39304
2 изменённых файлов: 43 добавлений и 0 удалений

Просмотреть файл

@ -76,6 +76,7 @@ skip-if = buildapp == 'mulet'
[test_memory_attach_02.html]
[test_memory_census.html]
[test_memory_gc_01.html]
[test_memory_gc_events.html]
[test_preference.html]
[test_settings.html]
[test_connectToChild.html]

Просмотреть файл

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<!--
Bug 1137527 - Test receiving GC events from the memory actor.
-->
<head>
<meta charset="utf-8">
<title>Memory monitoring actor test</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<pre id="test">
<script src="memory-helpers.js" type="application/javascript;version=1.8"></script>
<script>
window.onload = function() {
SimpleTest.waitForExplicitFinish();
var event = require("sdk/event/core");
Task.spawn(function* () {
var { memory, client } = yield startServerAndGetSelectedTabMemory();
yield memory.attach();
var gotGcEvent = new Promise(resolve => {
event.on(memory, "garbage-collection", gcData => {
ok(gcData, "Got GC data");
resolve();
});
});
memory.forceGarbageCollection();
yield gotGcEvent;
yield memory.detach();
destroyServerAndFinish(client);
});
};
</script>
</pre>
</body>
</html>