Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 description("Verify that using invalid or detached documents on internal test me thods does not crash."); | 1 description("Verify that using invalid or detached documents on internal test me thods does not crash."); |
|
Michael van Ouwerkerk
2016/05/04 13:52:16
Please rename this file to invalid-mock-arguments.
Sam McNally
2016/05/05 11:50:23
This isn't used anymore and should have been delet
| |
| 2 | 2 |
| 3 // The internals object and these test methods aren't available in production | 3 // The mock object and these test methods aren't available in production |
| 4 // builds, but they are exposed to fuzzers. | 4 // builds, but they are exposed to fuzzers. |
| 5 | 5 |
| 6 if (!window.testRunner || !window.internals) | 6 if (!window.testRunner || !window.mojo) |
| 7 debug('This test can not run without testRunner or internals'); | 7 debug('This test can not run without testRunner or mojo'); |
| 8 | 8 |
| 9 shouldThrow("internals.setGeolocationClientMock(null);"); | 9 shouldThrow("mock.setGeolocationPosition(null, 1, 2, 3);"); |
| 10 shouldThrow("internals.setGeolocationPosition(null, 1, 2, 3);"); | 10 shouldThrow("mock.setGeolocationPermission(window.notThere, true);"); |
| 11 shouldThrow("internals.setGeolocationPermission(window.notThere, true);"); | 11 shouldThrow("mock.setGeolocationPositionUnavailableError(null, 'not available'); "); |
| 12 shouldThrow("internals.setGeolocationPositionUnavailableError(null, 'not availab le');"); | 12 shouldThrow("mock.numberOfPendingGeolocationPermissionRequests(null)"); |
| 13 shouldThrow("internals.numberOfPendingGeolocationPermissionRequests(null)"); | |
| 14 | 13 |
| 15 var ifr = document.getElementById("ifr"); | 14 var ifr = document.getElementById("ifr"); |
| 16 var iframe = ifr.contentWindow; | 15 var iframe = ifr.contentWindow; |
| 17 // Must access it first so it exists, we cannot get internals from a detached fr ame window. | 16 // Must access it first so it exists, we cannot get mock from a detached frame w indow. |
| 18 var iframeInternals = iframe.internals; | 17 var iframeInternals = iframe.mock; |
| 19 ifr.remove(); | 18 ifr.remove(); |
| 20 | |
| 21 // Verify that detached documents do not crash. | |
| 22 shouldBeUndefined("iframeInternals.setGeolocationClientMock(iframe.document)"); | |
| 23 shouldBeUndefined("iframeInternals.setGeolocationPosition(iframe.document, 1, 2, 3)"); | |
| 24 shouldBeUndefined("iframeInternals.setGeolocationPermission(iframe.document, tru e)"); | |
| 25 shouldBeUndefined("iframeInternals.setGeolocationPositionUnavailableError(iframe .document, 'not available')"); | |
| 26 shouldBe("iframeInternals.numberOfPendingGeolocationPermissionRequests(iframe.do cument)", "-1"); | |
| OLD | NEW |