michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]. michael@0: getService(Ci.mozIJSSubScriptLoader); michael@0: let ChromeUtils = {}; michael@0: scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils); michael@0: michael@0: // ---- Test dragging the proxy icon --- michael@0: var value = content.location.href; michael@0: var urlString = value + "\n" + content.document.title; michael@0: var htmlString = "" + value + ""; michael@0: var expected = [ [ michael@0: { type : "text/x-moz-url", michael@0: data : urlString }, michael@0: { type : "text/uri-list", michael@0: data : value }, michael@0: { type : "text/plain", michael@0: data : value }, michael@0: { type : "text/html", michael@0: data : htmlString } michael@0: ] ]; michael@0: // set the valid attribute so dropping is allowed michael@0: var oldstate = gURLBar.getAttribute("pageproxystate"); michael@0: gURLBar.setAttribute("pageproxystate", "valid"); michael@0: var dt = EventUtils.synthesizeDragStart(document.getElementById("identity-box"), expected); michael@0: is(dt, null, "drag on proxy icon"); michael@0: gURLBar.setAttribute("pageproxystate", oldstate); michael@0: // Now, the identity information panel is opened by the proxy icon click. michael@0: // We need to close it for next tests. michael@0: EventUtils.synthesizeKey("VK_ESCAPE", {}, window); michael@0: michael@0: // now test dragging onto a tab michael@0: var tab = gBrowser.addTab("about:blank", {skipAnimation: true}); michael@0: var browser = gBrowser.getBrowserForTab(tab); michael@0: michael@0: browser.addEventListener("load", function () { michael@0: is(browser.contentWindow.location, "http://mochi.test:8888/", "drop on tab"); michael@0: gBrowser.removeTab(tab); michael@0: finish(); michael@0: }, true); michael@0: michael@0: ChromeUtils.synthesizeDrop(tab, tab, [[{type: "text/uri-list", data: "http://mochi.test:8888/"}]], "copy", window); michael@0: }