| Index: chrome/test/data/extensions/api_test/popup/popup_main/dom_ui_popup_dismissal.html
|
| ===================================================================
|
| --- chrome/test/data/extensions/api_test/popup/popup_main/dom_ui_popup_dismissal.html (revision 74596)
|
| +++ chrome/test/data/extensions/api_test/popup/popup_main/dom_ui_popup_dismissal.html (working copy)
|
| @@ -1,67 +0,0 @@
|
| -<html xmlns="http://www.w3.org/1999/xhtml">
|
| -<head>
|
| -<script>
|
| -var onbeforeunloadInvoked= false;
|
| -var onunloadInvoked = false;
|
| -var popupDismissed = false;
|
| -var testingWindow = locateTestingWindow();
|
| -
|
| -// Helper function that locates the main tab that is being used
|
| -// to drive the popup tests.
|
| -function locateTestingWindow() {
|
| - var extensionViews = chrome.extension.getViews();
|
| - for (var i = 0; i < extensionViews.length; ++i) {
|
| - // Look for the magic token defined on the testing page.
|
| - if (typeof extensionViews[i].TESTING_TOKEN != "undefined" &&
|
| - !!extensionViews[i].TESTING_TOKEN) {
|
| - return extensionViews[i];
|
| - }
|
| - }
|
| - return null;
|
| -}
|
| -
|
| -// Onload handler that tests the popup dismissal behaviour when closing the
|
| -// current tab. A popup is launched and the timing of the onClosed callback
|
| -// is tested wrt the onbeforeunload and onunload callbacks.
|
| -window.onload = function() {
|
| - chrome.experimental.popup.onClosed.addListener(function() {
|
| - testingWindow.assertTrue(onbeforeunloadInvoked,
|
| - "Popup dismissed before onbeforeunload called.");
|
| - testingWindow.assertTrue(!onunloadInvoked,
|
| - "Popup dismissed after onunload called.");
|
| - popupDismissed = true;
|
| - });
|
| -
|
| - var showDetails = {
|
| - "relativeTo": document.getElementById("popupAnchor")
|
| - };
|
| - chrome.experimental.popup.show("dom_ui_popup.html",
|
| - showDetails,
|
| - function() {
|
| - chrome.tabs.getSelected(null, function(tab) {
|
| - chrome.tabs.remove(tab.id);
|
| - });
|
| - });
|
| -}
|
| -
|
| -window.onbeforeunload = function() {
|
| - onbeforeunloadInvoked = true;
|
| -}
|
| -
|
| -window.onunload = function() {
|
| - onunloadInvoked = true;
|
| -
|
| - // If the popup was not yet dismissed, do not signal that the test has
|
| - // completed. Let the test time-out to signal failure.
|
| - if (popupDismissed)
|
| - testingWindow.testCompleted();
|
| -};
|
| -</script>
|
| -</head>
|
| -<body>
|
| -Testing Popup Sizing
|
| -<div id='popupAnchor'>
|
| -<span>Anchor Temporary Popup Here</span>
|
| -</div>
|
| -</body>
|
| -</html>
|
|
|