gecko/toolkit/profile/test/test_create_profile.xul

65 lines
1.8 KiB
XML

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=543854
-->
<window title="Mozilla Bug 543854"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=543854"
target="_blank">Mozilla Bug 543854</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 543854 **/
SimpleTest.waitForExplicitFinish();
const Cc = Components.classes;
const Ci = Components.interfaces;
const ASCIIName = "myprofile";
const UnicodeName = "\u09A0\u09BE\u0995\u09C1\u09B0"; // A Bengali name
var gProfileService;
gProfileService = Cc["@mozilla.org/toolkit/profile-service;1"].
getService(Ci.nsIToolkitProfileService);
createProfile(ASCIIName);
createProfile(UnicodeName);
SimpleTest.finish();
function createProfile(profileName)
{
var profile = gProfileService.createProfile(null, null, profileName);
// check that the directory was created
isnot(profile, null, "Profile " + profileName + " created");
var profileDir = profile.rootDir;
ok(profileDir.exists(), "Profile dir created");
ok(profileDir.isDirectory(), "Profile dir is a directory");
var profileDirPath = profileDir.path;
is(profileDirPath.substr(profileDirPath.length - profileName.length),
profileName, "Profile dir has expected name");
// clean up the profile
profile.remove(true);
}
]]>
</script>
</window>