Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/plugins/refcount-leaks.html |
| diff --git a/third_party/WebKit/LayoutTests/plugins/refcount-leaks.html b/third_party/WebKit/LayoutTests/plugins/refcount-leaks.html |
| index 0980fe1b275022a35f3739c7ced425f67bdc1bb6..6a18fa14fadd69d0008eed5a178dda1e87823e5c 100644 |
| --- a/third_party/WebKit/LayoutTests/plugins/refcount-leaks.html |
| +++ b/third_party/WebKit/LayoutTests/plugins/refcount-leaks.html |
| @@ -7,24 +7,13 @@ |
| window.GCController.collectAll(); |
| } |
| } |
| + var countOrig; |
| + var countAfterCreate; |
| + var countAfterGC; |
| - function runtest() { |
| - if (window.testRunner) |
| - testRunner.dumpAsText(); |
| - |
| - |
| - var output = document.getElementById("output"); |
| - output.innerHTML = ""; |
| - |
| - // Test that objects are deleted after their JS references are released. |
| - var countOrig = plug.testObjectCount; |
| - o1 = plug.testCreateTestObject(); |
| - o2 = plug.testCreateTestObject(); |
| - o3 = plug.testCreateTestObject(); |
| - var countAfterCreate = plug.testObjectCount; |
| - o1 = o2 = o3 = null; |
| + function finishTest() { |
| doGC(); |
| - var countAfterGC = plug.testObjectCount; |
| + var countAfterGC2 = plug.testObjectCount; |
| output.innerHTML += "--- num test objects:<br>"; |
| output.innerHTML += "countAfterCreate == countOrig + 3? " |
| @@ -33,35 +22,53 @@ |
| output.innerHTML += "countOrig == countAfterGC? " |
| + ((countOrig == countAfterGC) ? "PASS" : "FAIL") |
| + "<br>"; |
| + output.innerHTML += "countOrig == countAfterGC2? " |
| + + ((countOrig == countAfterGC2) ? "PASS" : "FAIL") |
| + + "<br>"; |
| output.innerHTML += "<br>"; |
| - // Test that the object refcount returns to normal after JS references |
| - // are released. |
| - var testObj = plug.testObject; |
| - var refOrig = testObj.refCount; |
| - var o1 = plug.testObject; |
| - var o2 = plug.testObject; |
| - var o3 = plug.testObject; |
| - var refAfterGet = testObj.refCount; |
| - o1 = o2 = o3 = null; |
| + var success = (countAfterGC == countOrig) && (countAfterGC2 == countOrig); |
| + output.innerHTML += (success ? "SUCCESS" : "FAILURE"); |
| + |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + } |
| + |
| + function step2() { |
| doGC(); |
| - var refAfterGetGC = testObj.refCount; |
| + countAfterGC = plug.testObjectCount; |
| - // Test that calling NPN_Invoke with our object as a parameter returns |
| - // our refcount to normal (may require a GC). |
| + var testObj = plug.testCreateTestObject(); |
| plug.testPassTestObject("noop", testObj); |
| plug.testPassTestObject("noop", testObj); |
| plug.testPassTestObject("noop", testObj); |
| + |
|
dcheng
2016/03/29 03:15:24
No test expectations here because we can't get to
piman
2016/03/29 05:09:29
Oh, yeah I should add a comment. This will refcoun
|
| doGC(); |
| - var refAfterPass = testObj.refCount; |
| + // PPAPI requires the main loop to run to fully release references. See |
| + // PPB_Var_Deprecated_Proxy::OnMsgReleaseObject. |
| + setTimeout(finishTest, 0); |
| + } |
| - output.innerHTML += "--- refcount on plug.testObject:<br>"; |
| - output.innerHTML += "originally: " + refOrig + "<br>"; |
| - output.innerHTML += "after GC: " + refAfterGetGC + "<br>"; |
| - output.innerHTML += "after passing: " + refAfterPass + "<br>"; |
| + function runtest() { |
| + if (window.testRunner) { |
| + testRunner.dumpAsText(); |
| + testRunner.waitUntilDone(); |
| + } |
| - var success = (countAfterGC == countOrig) && (refAfterPass == refOrig); |
| - output.innerHTML += (success ? "SUCCESS" : "FAILURE"); |
| + var output = document.getElementById("output"); |
| + output.innerHTML = ""; |
| + |
| + // Test that objects are deleted after their JS references are released. |
| + countOrig = plug.testObjectCount; |
| + o1 = plug.testCreateTestObject(); |
| + o2 = plug.testCreateTestObject(); |
| + o3 = plug.testCreateTestObject(); |
| + countAfterCreate = plug.testObjectCount; |
| + o1 = o2 = o3 = null; |
| + doGC(); |
| + // PPAPI requires the main loop to run to fully release references. See |
| + // PPB_Var_Deprecated_Proxy::OnMsgReleaseObject. |
| + setTimeout(step2, 0); |
| } |
| </script> |
| @@ -72,7 +79,7 @@ an NPAPI Object.<P> |
| Prints "SUCCESS" on success, "FAILURE" on failure. |
| -<embed name="plug" type="application/x-webkit-test-netscape"> |
| +<embed name="plug" type="application/x-blink-deprecated-test-plugin"> |
| <div id=output>FAILURE</div> |