diff --git a/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_01.js b/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_01.js index be7eea3621e..656e0694730 100644 --- a/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_01.js +++ b/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_01.js @@ -17,7 +17,7 @@ let test = asyncTest(function*() { is ( resources.map(r=>r.basename).join("|"), - "ProjectEditor|css|styles.css|data|img|icons|128x128.png|16x16.png|32x32.png|vector.svg|fake.png|js|script.js|index.html|LICENSE|README.md", + TEMP_FOLDER_NAME + "|css|styles.css|data|img|icons|128x128.png|16x16.png|32x32.png|vector.svg|fake.png|js|script.js|index.html|LICENSE|README.md", "Resources came through in proper order" ); diff --git a/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_02.js b/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_02.js index f6608d6e304..b9f1ed7cc5f 100644 --- a/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_02.js +++ b/browser/devtools/projecteditor/test/browser_projecteditor_tree_selection_02.js @@ -18,7 +18,7 @@ let test = asyncTest(function*() { is ( resources.map(r=>r.basename).join("|"), - "ProjectEditor|css|styles.css|data|img|icons|128x128.png|16x16.png|32x32.png|vector.svg|fake.png|js|script.js|index.html|LICENSE|README.md", + TEMP_FOLDER_NAME + "|css|styles.css|data|img|icons|128x128.png|16x16.png|32x32.png|vector.svg|fake.png|js|script.js|index.html|LICENSE|README.md", "Resources came through in proper order" ); diff --git a/browser/devtools/projecteditor/test/head.js b/browser/devtools/projecteditor/test/head.js index ca7d671bba1..95626eea1d5 100644 --- a/browser/devtools/projecteditor/test/head.js +++ b/browser/devtools/projecteditor/test/head.js @@ -14,6 +14,7 @@ const ProjectEditor = devtools.require("projecteditor/projecteditor"); const TEST_URL_ROOT = "http://mochi.test:8888/browser/browser/devtools/projecteditor/test/"; const SAMPLE_WEBAPP_URL = TEST_URL_ROOT + "/helper_homepage.html"; let TEMP_PATH; +let TEMP_FOLDER_NAME = "ProjectEditor" + (new Date().getTime()); // All test are asynchronous waitForExplicitFinish(); @@ -29,6 +30,7 @@ registerCleanupFunction(() => gDevTools.testing = false); registerCleanupFunction(() => { // Services.prefs.clearUserPref("devtools.dump.emit"); TEMP_PATH = null; + TEMP_FOLDER_NAME = null; }); // Auto close the toolbox and close the test tabs when the test ends @@ -105,6 +107,7 @@ function addProjectEditorTabForTempDirectory(opts = {}) { projectOverviewURL: SAMPLE_WEBAPP_URL }; + info ("Adding a project editor tab for editing at: " + TEMP_PATH); return addProjectEditorTab(opts).then((projecteditor) => { return projecteditor.setProjectToAppPath(TEMP_PATH, customOpts).then(() => { return projecteditor; @@ -136,19 +139,22 @@ function addProjectEditorTab(opts = {}) { */ function buildTempDirectoryStructure() { + let dirName = TEMP_FOLDER_NAME; + info ("Building a temporary directory at " + dirName); + // First create (and remove) the temp dir to discard any changes - let TEMP_DIR = FileUtils.getDir("TmpD", ["ProjectEditor"], true); + let TEMP_DIR = FileUtils.getDir("TmpD", [dirName], true); TEMP_DIR.remove(true); // Now rebuild our fake project. - TEMP_DIR = FileUtils.getDir("TmpD", ["ProjectEditor"], true); + TEMP_DIR = FileUtils.getDir("TmpD", [dirName], true); - FileUtils.getDir("TmpD", ["ProjectEditor", "css"], true); - FileUtils.getDir("TmpD", ["ProjectEditor", "data"], true); - FileUtils.getDir("TmpD", ["ProjectEditor", "img", "icons"], true); - FileUtils.getDir("TmpD", ["ProjectEditor", "js"], true); + FileUtils.getDir("TmpD", [dirName, "css"], true); + FileUtils.getDir("TmpD", [dirName, "data"], true); + FileUtils.getDir("TmpD", [dirName, "img", "icons"], true); + FileUtils.getDir("TmpD", [dirName, "js"], true); - let htmlFile = FileUtils.getFile("TmpD", ["ProjectEditor", "index.html"]); + let htmlFile = FileUtils.getFile("TmpD", [dirName, "index.html"]); htmlFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); writeToFileSync(htmlFile, [ '', @@ -164,14 +170,14 @@ function buildTempDirectoryStructure() { ''].join("\n") ); - let readmeFile = FileUtils.getFile("TmpD", ["ProjectEditor", "README.md"]); + let readmeFile = FileUtils.getFile("TmpD", [dirName, "README.md"]); readmeFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); writeToFileSync(readmeFile, [ '## Readme' ].join("\n") ); - let licenseFile = FileUtils.getFile("TmpD", ["ProjectEditor", "LICENSE"]); + let licenseFile = FileUtils.getFile("TmpD", [dirName, "LICENSE"]); licenseFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); writeToFileSync(licenseFile, [ '/* This Source Code Form is subject to the terms of the Mozilla Public', @@ -180,7 +186,7 @@ function buildTempDirectoryStructure() { ].join("\n") ); - let cssFile = FileUtils.getFile("TmpD", ["ProjectEditor", "css", "styles.css"]); + let cssFile = FileUtils.getFile("TmpD", [dirName, "css", "styles.css"]); cssFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); writeToFileSync(cssFile, [ 'body {', @@ -189,13 +195,13 @@ function buildTempDirectoryStructure() { ].join("\n") ); - FileUtils.getFile("TmpD", ["ProjectEditor", "js", "script.js"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); + FileUtils.getFile("TmpD", [dirName, "js", "script.js"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); - FileUtils.getFile("TmpD", ["ProjectEditor", "img", "fake.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); - FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "16x16.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); - FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "32x32.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); - FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "128x128.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); - FileUtils.getFile("TmpD", ["ProjectEditor", "img", "icons", "vector.svg"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); + FileUtils.getFile("TmpD", [dirName, "img", "fake.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); + FileUtils.getFile("TmpD", [dirName, "img", "icons", "16x16.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); + FileUtils.getFile("TmpD", [dirName, "img", "icons", "32x32.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); + FileUtils.getFile("TmpD", [dirName, "img", "icons", "128x128.png"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); + FileUtils.getFile("TmpD", [dirName, "img", "icons", "vector.svg"]).createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); return TEMP_DIR.path; } @@ -249,7 +255,7 @@ function writeToFileSync(file, data) { } function getTempFile(path) { - let parts = ["ProjectEditor"]; + let parts = [TEMP_FOLDER_NAME]; parts = parts.concat(path.split("/")); return FileUtils.getFile("TmpD", parts); }