PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/content/branches/1.10/net/1308/issue1308-1.6.js

http://fbug.googlecode.com/
JavaScript | 60 lines | 44 code | 10 blank | 6 comment | 0 complexity | 5f91fc0222563dcfef950e4123fa4ba7 MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0
  1. function runTest()
  2. {
  3. FBTest.sysout("issue1308.START");
  4. var pageURI = basePath + "net/1308/issue1308-1.6.html";
  5. var scriptURI = basePath + "net/1308/issue1308.js";
  6. FBTest.openNewTab(pageURI, function(win)
  7. {
  8. FBTest.enableNetPanel(function()
  9. {
  10. var options = {
  11. tagName: "tr",
  12. classes: "netRow category-xhr hasHeaders loaded"
  13. };
  14. // Asynchronously wait for the request beeing displayed.
  15. FBTest.waitForDisplayedElement("net", options, function(netRow)
  16. {
  17. var panel = FBTest.getPanel("net");
  18. // Test the "Copy Location With Parameters action" available in the context menu
  19. // for specific Net panel entry.
  20. panel.copyParams(netRow.repObject);
  21. checkCopyLocationWithParametersAction(netRow, function() {
  22. FBTest.testDone("issue1308.DONE");
  23. });
  24. });
  25. FBTest.click(win.document.getElementById("testButton"));
  26. });
  27. });
  28. }
  29. function checkCopyLocationWithParametersAction(netRow, callback)
  30. {
  31. setTimeout(function()
  32. {
  33. // Get data from the clipboard.
  34. var clipboard = FW.FBL.CCSV("@mozilla.org/widget/clipboard;1", "nsIClipboard");
  35. var trans = FW.FBL.CCIN("@mozilla.org/widget/transferable;1", "nsITransferable");
  36. trans.addDataFlavor("text/unicode");
  37. clipboard.getData(trans, Ci.nsIClipboard.kGlobalClipboard);
  38. var str = new Object();
  39. var strLength = new Object();
  40. trans.getTransferData("text/unicode", str, strLength);
  41. str = str.value.QueryInterface(Ci.nsISupportsString);
  42. var actual = str.data.substring(0, strLength.value / 2);
  43. // Complete expected result.
  44. var requestUri = FBTest.getHTTPURLBase() + "net/1308/issue1308.txt";
  45. var expected = requestUri + "?param1=1%20%2B%202";
  46. // Verification.
  47. FBTest.compare(expected, actual, "Verify that the copied URL is properly encoded.");
  48. callback();
  49. }, 1000);
  50. }