2011-01-20 14:30:15 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=627498
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test hardware acceleration</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=627498">Mozilla Bug 627498</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
// Make sure that acceleration is enabled/disabled the way we expect it to be
|
|
|
|
// based on platform.
|
|
|
|
|
2012-08-03 13:19:54 -07:00
|
|
|
var importObj = {};
|
2011-01-20 14:30:15 -08:00
|
|
|
|
2012-08-03 13:19:54 -07:00
|
|
|
var Cc = SpecialPowers.wrap(Components).classes;
|
2011-01-20 14:30:15 -08:00
|
|
|
var Ci = Components.interfaces;
|
|
|
|
|
|
|
|
var sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
|
|
|
|
|
2012-08-03 13:19:54 -07:00
|
|
|
var windows = SpecialPowers.Services.ww.getWindowEnumerator();
|
2011-01-29 21:06:09 -08:00
|
|
|
var windowutils;
|
2011-01-20 14:30:15 -08:00
|
|
|
var acceleratedWindows = 0;
|
|
|
|
while (windows.hasMoreElements()) {
|
2011-01-29 21:06:09 -08:00
|
|
|
windowutils = windows.getNext().QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIDOMWindowUtils);
|
2011-01-20 14:30:15 -08:00
|
|
|
if (windowutils.layerManagerType != "Basic") {
|
|
|
|
acceleratedWindows++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 21:08:14 -08:00
|
|
|
var osName = sysInfo.getProperty("name");
|
|
|
|
switch(osName)
|
2011-01-20 14:30:15 -08:00
|
|
|
{
|
2012-01-16 12:52:18 -08:00
|
|
|
case "Darwin": // Mac OS X.
|
2011-01-29 21:06:09 -08:00
|
|
|
// We only enable OpenGL layers on machines that don't support QuickDraw
|
|
|
|
// plugins. x86-64 architecture is a good proxy for this plugin support.
|
2011-01-29 21:08:14 -08:00
|
|
|
if (sysInfo.getProperty("arch") != "x86-64") {
|
|
|
|
is(acceleratedWindows, 0, "Acceleration not supported on x86 OS X");
|
2011-01-29 21:06:09 -08:00
|
|
|
} else {
|
2012-01-16 12:52:18 -08:00
|
|
|
// Workaround for SeaMonkey tinderboxes which don't support acceleration.
|
|
|
|
if (navigator.userAgent.match(/ SeaMonkey\//)) {
|
|
|
|
if (acceleratedWindows == 0) {
|
|
|
|
todo(false, "Acceleration not supported on x86-64 OS X" +
|
|
|
|
" (This is expected on SeaMonkey (tinderboxes).)");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 21:08:14 -08:00
|
|
|
isnot(acceleratedWindows, 0, "Acceleration enabled on x86-64 OS X");
|
2011-01-29 21:06:09 -08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-01-16 12:52:18 -08:00
|
|
|
case "Windows_NT": // Windows.
|
2011-01-20 14:30:15 -08:00
|
|
|
var version = parseFloat(sysInfo.getProperty("version"));
|
2011-01-29 21:08:14 -08:00
|
|
|
if (version == 5.0) {
|
|
|
|
is(acceleratedWindows, 0, "Acceleration not supported on Windows 2000");
|
|
|
|
} else {
|
2012-01-16 12:52:18 -08:00
|
|
|
// Workaround for SeaMonkey tinderboxes which don't support acceleration.
|
|
|
|
if (navigator.userAgent.match(/ SeaMonkey\//)) {
|
|
|
|
if (acceleratedWindows == 0) {
|
|
|
|
todo(false, "Acceleration not supported on Windows XP or newer" +
|
|
|
|
" (This is expected on SeaMonkey (tinderboxes).)");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 21:08:14 -08:00
|
|
|
isnot(acceleratedWindows, 0, "Acceleration enabled on Windows XP or newer");
|
|
|
|
}
|
|
|
|
|
|
|
|
var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
|
|
|
|
if (version < 6.0) {
|
|
|
|
ok(!gfxInfo.D2DEnabled, "Direct2D not supported on Windows 2003 or older");
|
2011-01-29 21:33:00 -08:00
|
|
|
ok(!gfxInfo.DWriteEnabled, "DirectWrite not supported on Windows 2003 or older");
|
2011-01-29 21:08:14 -08:00
|
|
|
} else {
|
|
|
|
ok(gfxInfo.D2DEnabled, "Direct2D enabled on Windows Vista or newer");
|
2011-01-29 21:33:00 -08:00
|
|
|
ok(gfxInfo.DWriteEnabled, "DirectWrite enabled on Windows Vista or newer");
|
2011-01-20 14:30:15 -08:00
|
|
|
}
|
|
|
|
break;
|
2011-01-29 21:08:14 -08:00
|
|
|
|
2012-01-16 12:52:18 -08:00
|
|
|
default: // Linux and others.
|
2011-01-29 21:08:14 -08:00
|
|
|
is(acceleratedWindows, 0, "Acceleration not supported on '" + osName + "'");
|
2011-01-20 14:30:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|