Merge revision 1428 changes:

- Specify a background color for tests so that they're easier to read when transparent rendering is enabled.

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1547@1429 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-09-03 22:00:50 +00:00
parent acc9111108
commit c104c17c8a
12 changed files with 496 additions and 489 deletions

View File

@@ -84,7 +84,8 @@ void RunGetSourceTest(CefRefPtr<CefBrowser> browser) {
std::string source = StringReplace(string, "<", "&lt;");
source = StringReplace(source, ">", "&gt;");
std::stringstream ss;
ss << "<html><body>Source:<pre>" << source << "</pre></body></html>";
ss << "<html><body bgcolor=\"white\">Source:<pre>" << source <<
"</pre></body></html>";
browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/getsource");
}
private:
@@ -103,7 +104,8 @@ void RunGetTextTest(CefRefPtr<CefBrowser> browser) {
std::string text = StringReplace(string, "<", "&lt;");
text = StringReplace(text, ">", "&gt;");
std::stringstream ss;
ss << "<html><body>Text:<pre>" << text << "</pre></body></html>";
ss << "<html><body bgcolor=\"white\">Text:<pre>" << text <<
"</pre></body></html>";
browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/gettext");
}
private:
@@ -150,7 +152,8 @@ void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
public:
explicit Visitor(CefRefPtr<CefBrowser> browser)
: browser_(browser) {
html_ = "<html><head><title>Plugin Info Test</title></head><body>"
html_ = "<html><head><title>Plugin Info Test</title></head>"
"<body bgcolor=\"white\">"
"\n<b>Installed plugins:</b>";
}
~Visitor() {

View File

@@ -438,7 +438,8 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
// Display a load error message.
std::stringstream ss;
ss << "<html><body><h2>Failed to load URL " << std::string(failedUrl) <<
ss << "<html><body bgcolor=\"white\">"
"<h2>Failed to load URL " << std::string(failedUrl) <<
" with error " << std::string(errorText) << " (" << errorCode <<
").</h2></body></html>";
frame->LoadString(ss.str(), failedUrl);
@@ -469,12 +470,14 @@ CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
// Show the request contents.
std::string dump;
DumpRequestContents(request, dump);
std::string str = "<html><body bgcolor=\"white\"><pre>" + dump +
"</pre></body></html>";
CefRefPtr<CefStreamReader> stream =
CefStreamReader::CreateForData(
static_cast<void*>(const_cast<char*>(dump.c_str())),
dump.size());
static_cast<void*>(const_cast<char*>(str.c_str())),
str.size());
ASSERT(stream.get());
return new CefStreamResourceHandler("text/plain", stream);
return new CefStreamResourceHandler("text/html", stream);
} else {
// Load the resource from file.
CefRefPtr<CefStreamReader> stream =

View File

@@ -16,7 +16,7 @@ function sendMessage() {
</script>
</head>
<body>
<body bgcolor="white">
<form>
Message: <input type="text" id="message" value="My Message">
<br/><input type="button" onclick="sendMessage();" value="Send Message">

View File

@@ -48,7 +48,7 @@ function show_file_dialog(element, test) {
window.addEventListener('load', setup, false);
</script>
</head>
<body>
<body bgcolor="white">
<form>
Click a button to show the associated dialog type.
<br/><input type="button" onclick="show_alert();" value="Show Alert">

View File

@@ -1,5 +1,5 @@
<html>
<body>
<body bgcolor="white">
<p id="instructions">Select some portion of the below page content and click the "Describe Selection" button. The selected region will then be described below.</p>
<p id="p1">This is p1</p>
<p id="p2">This is p2</p>

View File

@@ -1,5 +1,5 @@
<html>
<body>
<body bgcolor="white">
<script language="JavaScript">
var val = window.localStorage.getItem('val');
function addLine() {

View File

@@ -1,32 +1,32 @@
<html>
<head>
<title>Other Tests</title>
</head>
<body>
<h3>Various other internal and external tests.</h3>
<ul>
<li><a href="http://mudcu.be/labs/JS1k/BreathingGalaxies.html">Accelerated 2D Canvas</a></li>
<li><a href="http://webkit.org/blog-files/3d-transforms/poster-circle.html">Accelerated Layers</a></li>
<li><a href="http://html5advent2011.digitpaint.nl/3/index.html">Cursors</a></li>
<li><a href="http://tests/dialogs">Dialogs</a></li>
<li><a href="http://tests/domaccess">DOM Access</a></li>
<li><a href="http://html5demos.com/drag">Drag & Drop</a></li>
<li><a href="http://www.adobe.com/software/flash/about/">Flash Plugin</a></li>
<li><a href="http://html5demos.com/geo">Geolocation</a></li>
<li><a href="http://www.html5test.com">HTML5 Feature Test</a></li>
<li><a href="http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True">HTML5 Video</a></li>
<li><a href="http://tests/binding">JavaScript Binding</a></li>
<li><a href="http://tests/performance">JavaScript Performance Tests</a></li>
<li><a href="http://tests/performance2">JavaScript Performance (2) Tests</a></li>
<li><a href="http://tests/window">JavaScript Window Manipulation</a></li>
<li><a href="http://tests/localstorage">Local Storage</a></li>
<li><a href="http://mrdoob.com/lab/javascript/requestanimationframe/">requestAnimationFrame</a></li>
<li><a href="client://tests/handler.html">Scheme Handler</a></li>
<li><a href="http://slides.html5rocks.com/#speech-input">Speech Input</a> - requires "enable-speech-input" flag</li>
<li><a href="http://tests/transparency">Transparency</a></li>
<li><a href="http://webglsamples.googlecode.com/hg/field/field.html">WebGL</a></li>
<li><a href="http://apprtc.appspot.com/">WebRTC</a> - requires "enable-media-stream" flag</li>
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>
</ul>
</body>
</html>
<html>
<head>
<title>Other Tests</title>
</head>
<body bgcolor="white">
<h3>Various other internal and external tests.</h3>
<ul>
<li><a href="http://mudcu.be/labs/JS1k/BreathingGalaxies.html">Accelerated 2D Canvas</a></li>
<li><a href="http://webkit.org/blog-files/3d-transforms/poster-circle.html">Accelerated Layers</a></li>
<li><a href="http://html5advent2011.digitpaint.nl/3/index.html">Cursors</a></li>
<li><a href="http://tests/dialogs">Dialogs</a></li>
<li><a href="http://tests/domaccess">DOM Access</a></li>
<li><a href="http://html5demos.com/drag">Drag & Drop</a></li>
<li><a href="http://www.adobe.com/software/flash/about/">Flash Plugin</a></li>
<li><a href="http://html5demos.com/geo">Geolocation</a></li>
<li><a href="http://www.html5test.com">HTML5 Feature Test</a></li>
<li><a href="http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True">HTML5 Video</a></li>
<li><a href="http://tests/binding">JavaScript Binding</a></li>
<li><a href="http://tests/performance">JavaScript Performance Tests</a></li>
<li><a href="http://tests/performance2">JavaScript Performance (2) Tests</a></li>
<li><a href="http://tests/window">JavaScript Window Manipulation</a></li>
<li><a href="http://tests/localstorage">Local Storage</a></li>
<li><a href="http://mrdoob.com/lab/javascript/requestanimationframe/">requestAnimationFrame</a></li>
<li><a href="client://tests/handler.html">Scheme Handler</a></li>
<li><a href="http://slides.html5rocks.com/#speech-input">Speech Input</a> - requires "enable-speech-input" flag</li>
<li><a href="http://tests/transparency">Transparency</a></li>
<li><a href="http://webglsamples.googlecode.com/hg/field/field.html">WebGL</a></li>
<li><a href="http://apprtc.appspot.com/">WebRTC</a> - requires "enable-media-stream" flag</li>
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>
</ul>
</body>
</html>

View File

@@ -6,7 +6,7 @@
body { font-family: Tahoma, Serif; font-size: 9pt; }
</style>
</head>
<body>
<body bgcolor="white">
<h1>Performance Tests</h1>
<input type="button" value="Run Tests" onClick="run();" id="run"/> Filter: <input type="text" size="50" id="filters"/>
<div><span id="statusBox"></span> <progress id="progressBox" value="0" style="display:none"></progress></div>

View File

@@ -1,442 +1,442 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Performance Tests (2)</title>
<style>
body { font-family: Tahoma, Serif; font-size: 9pt; }
.left { text-align: left; }
.right { text-align: right; }
.center { text-align: center; }
table.resultTable
{
border: 1px solid black;
border-collapse: collapse;
empty-cells: show;
width: 100%;
}
table.resultTable td
{
padding: 2px 4px;
border: 1px solid black;
}
table.resultTable > thead > tr
{
font-weight: bold;
background: lightblue;
}
table.resultTable > tbody > tr:nth-child(odd)
{
background: white;
}
table.resultTable > tbody > tr:nth-child(even)
{
background: lightgray;
}
.hide { display: none; }
</style>
</head>
<body>
<h1>Performance Tests (2)</h1>
<form id="sForm" onsubmit="runTestSuite();return false">
<table>
<tr>
<td colspan="2">Settings:</td>
</tr>
<tr>
<td class="right">Iterations:</td>
<td><input id="sIterations" type="text" value="1000" required pattern="[0-9]+" /></td>
</tr>
<tr>
<td class="right">Samples:</td>
<td><input id="sSamples" type="text" value="100" required pattern="[0-9]+" /></td>
</tr>
<tr>
<td class="right">Mode:</td>
<td><input id="sAsync" name="sMode" type="radio" value="async" checked>Asynchronous</input>
<input id="sSync" name="sMode" type="radio" value="sync">Synchronous</input>
</td>
</tr>
<tr>
<td colspan="2"><button type="submit" id="sRun" autofocus>Run!</button></td>
</tr>
</table>
</form>
<div><span id="statusBox"></span> <progress id="progressBox" value="0" style="display:none"></progress></div>
<div style="padding-top:10px; padding-bottom:10px">
<table id="resultTable" class="resultTable">
<thead>
<tr>
<td class="center" style="width:1%">Enabled</td>
<td class="center" style="width:10%">Name</td>
<td class="center" style="width:5%">Samples x Iterations</td>
<td class="center" style="width:5%">Min,&nbsp;ms</td>
<td class="center" style="width:5%">Avg,&nbsp;ms</td>
<td class="center" style="width:5%">Max,&nbsp;ms</td>
<td class="center" style="width:5%">Average calls/sec</td>
<td class="center" style="width:5%">Measuring Inacurracy</td>
<td class="center hide" style="width:5%">Memory, MB</td>
<td class="center hide" style="width:5%">Memory delta, MB</td>
<td class="center" style="width:55%">Description</td>
</tr>
</thead>
<tbody>
<!-- result rows here -->
</tbody>
</table>
</div>
<script type="text/javascript">
(function () {
function getPrivateWorkingSet() {
return 0; // TODO: window.PerfTestGetPrivateWorkingSet();
}
var disableWarmUp = true;
var asyncExecution = true;
var testIterations = 1000;
var totalSamples = 100;
var sampleDelay = 0;
var collectSamples = false;
var tests = [];
var testIndex = -1;
function execTestFunc(test) {
try {
var begin = new Date();
test.func(test.totalIterations);
var end = new Date();
return (end - begin);
} catch (e) {
test.error = e.toString();
return 0;
}
}
function execTest(test) {
if (disableWarmUp) { test.warmedUp = true; }
function nextStep() {
if (asyncExecution) {
setTimeout(function () { execTest(test); }, sampleDelay);
} else {
execTest(test);
}
}
function nextTest() {
updateStatus(test);
appendResult(test);
return execNextTest();
}
updateStatus(test);
if (!test.warmedUp) {
execTestFunc(test);
if (!test.error) {
test.warmedUp = true;
test.beginMemory = getPrivateWorkingSet();
return nextStep();
} else {
return nextTest();
}
}
if (test.sample >= test.totalSamples) {
test.avg = test.total / test.totalSamples;
test.endMemory = getPrivateWorkingSet();
return nextTest();
}
if (test.skipped) return nextTest();
var elapsed = execTestFunc(test);
if (!test.error) {
test.total += elapsed;
if (!test.min) test.min = elapsed;
else if (test.min > elapsed) test.min = elapsed;
if (!test.max) test.max = elapsed;
else if (test.max < elapsed) test.max = elapsed;
if (collectSamples) {
test.results.push(elapsed);
}
test.sample++;
return nextStep();
} else {
return nextTest();
}
}
function updateStatus(test) {
var statusBox = document.getElementById("statusBox");
var progressBox = document.getElementById("progressBox");
if (test.skipped || test.error || test.sample >= test.totalSamples) {
statusBox.innerText = "";
progressBox.style.display = "none";
} else {
statusBox.innerText = (testIndex + 1) + "/" + tests.length + ": " + test.name + " (" + test.sample + "/" + test.totalSamples + ")";
progressBox.value = (test.sample / test.totalSamples);
progressBox.style.display = "inline";
}
}
function appendResult(test) {
if (test.name == "warmup") return;
var id = "testResultRow_" + test.index;
var nearBound = (test.max - test.avg) < (test.avg - test.min) ? test.max : test.min;
var memoryDelta = test.endMemory - test.beginMemory;
if (memoryDelta < 0) memoryDelta = "-" + Math.abs(memoryDelta).toFixed(2);
else memoryDelta = "+" + Math.abs(memoryDelta).toFixed(2);
var markup = ["<tr id='" + id + "'>",
"<td class='left'><input type='checkbox' id='test_enabled_", test.index ,"' ", (!test.skipped ? "checked" : "") ," /></td>",
"<td class='left'>", test.name, "</td>",
"<td class='right'>", test.totalSamples, "x", test.totalIterations, "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : test.min.toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : test.avg.toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : test.max.toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : (test.totalIterations * 1000 / test.avg).toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : ("&#x00B1; " + (Math.abs(test.avg - nearBound) / (test.avg) * (100)).toFixed(2) + "%"), "</td>",
"<td class='right hide'>", test.skipped || test.error || !test.prepared ? "-" : test.endMemory.toFixed(2), "</td>",
"<td class='right hide'>", test.skipped || test.error || !test.prepared ? "-" : memoryDelta, "</td>",
"<td class='left'>", test.description, test.error ? (test.description ? "<br/>" : "") + "<span style='color:red'>" + test.error + "</span>" : "", "</td>",
"</tr>"
].join("");
// test.results.join(", "), "<br/>",
var row = document.getElementById(id);
if (row) {
row.outerHTML = markup;
} else {
var tbody = document.getElementById("resultTable").tBodies[0];
tbody.insertAdjacentHTML("beforeEnd", markup);
}
}
function prepareQueuedTests() {
testIndex = -1;
for (var i = 0; i < tests.length; i++) {
var test = tests[i];
test.index = i;
test.prepared = false;
test.warmedUp = false;
test.sample = 0;
test.total = 0;
test.results = [];
test.error = false;
test.min = null;
test.avg = null;
test.max = null;
test.beginMemory = null;
test.endMemory = null;
test.totalIterations = parseInt(testIterations / test.complex);
test.totalSamples = parseInt(totalSamples / test.complex);
var skipElement = document.getElementById('test_enabled_' + test.index);
test.skipped = skipElement ? !skipElement.checked : (test.skipped || false);
if (test.totalIterations <= 0) test.totalIterations = 1;
if (test.totalSamples <= 0) test.totalSamples = 1;
appendResult(test);
test.prepared = true;
}
}
function queueTest(func, name, description) {
var test;
if (typeof func === "function") {
test = {
name: name,
func: func,
description: description
};
} else {
test = func;
}
test.warmedUp = false;
test.complex = test.complex || 1;
tests.push(test);
}
function execNextTest() {
testIndex++;
if (tests.length <= testIndex) {
return testSuiteFinished();
} else {
return execTest(tests[testIndex]);
}
}
function execQueuedTests() {
prepareQueuedTests();
execNextTest();
}
function setSettingsState(disabled) {
document.getElementById('sIterations').disabled = disabled;
document.getElementById('sSamples').disabled = disabled;
document.getElementById('sAsync').disabled = disabled;
document.getElementById('sSync').disabled = disabled;
document.getElementById('sRun').disabled = disabled;
}
function testSuiteFinished() {
setSettingsState(false);
}
window.runTestSuite = function () {
setSettingsState(true);
testIterations = parseInt(document.getElementById('sIterations').value);
totalSamples = parseInt(document.getElementById('sSamples').value);
asyncExecution = document.getElementById('sAsync').checked;
setTimeout(execQueuedTests, 0);
}
setTimeout(prepareQueuedTests, 0);
// Test queue.
queueTest({
name: "PerfTestReturnValue Default",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue();
}
},
description: "No arguments, returns int32 value.",
skipped: true,
});
queueTest({
name: "PerfTestReturnValue (0, Undefined)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(0);
}
},
description: "Int argument, returns undefined value."
});
queueTest({
name: "PerfTestReturnValue (1, Null)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(1);
}
},
description: "Int argument, returns null value."
});
queueTest({
name: "PerfTestReturnValue (2, Bool)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(2);
}
},
description: "Int argument, returns bool value."
});
queueTest({
name: "PerfTestReturnValue (3, Int)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(3);
}
},
description: "Int argument, returns int value."
});
queueTest({
name: "PerfTestReturnValue (4, UInt)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(4);
}
},
description: "Int argument, returns uint value."
});
queueTest({
name: "PerfTestReturnValue (5, Double)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(5);
}
},
description: "Int argument, returns double value."
});
queueTest({
name: "PerfTestReturnValue (6, Date)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(6);
}
},
description: "Int argument, returns date value.",
skipped: true,
});
queueTest({
name: "PerfTestReturnValue (7, String)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(7);
}
},
description: "Int argument, returns string value."
});
queueTest({
name: "PerfTestReturnValue (8, Object)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(8);
}
},
description: "Int argument, returns object value."
});
queueTest({
name: "PerfTestReturnValue (9, Array)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(9);
}
},
description: "Int argument, returns array value."
});
queueTest({
name: "PerfTestReturnValue (10, Function)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(10);
}
},
description: "Int argument, returns function value.",
skipped: true,
});
// add more tests to queueTest
})();
</script>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<title>Performance Tests (2)</title>
<style>
body { font-family: Tahoma, Serif; font-size: 9pt; }
.left { text-align: left; }
.right { text-align: right; }
.center { text-align: center; }
table.resultTable
{
border: 1px solid black;
border-collapse: collapse;
empty-cells: show;
width: 100%;
}
table.resultTable td
{
padding: 2px 4px;
border: 1px solid black;
}
table.resultTable > thead > tr
{
font-weight: bold;
background: lightblue;
}
table.resultTable > tbody > tr:nth-child(odd)
{
background: white;
}
table.resultTable > tbody > tr:nth-child(even)
{
background: lightgray;
}
.hide { display: none; }
</style>
</head>
<body bgcolor="white">
<h1>Performance Tests (2)</h1>
<form id="sForm" onsubmit="runTestSuite();return false">
<table>
<tr>
<td colspan="2">Settings:</td>
</tr>
<tr>
<td class="right">Iterations:</td>
<td><input id="sIterations" type="text" value="1000" required pattern="[0-9]+" /></td>
</tr>
<tr>
<td class="right">Samples:</td>
<td><input id="sSamples" type="text" value="100" required pattern="[0-9]+" /></td>
</tr>
<tr>
<td class="right">Mode:</td>
<td><input id="sAsync" name="sMode" type="radio" value="async" checked>Asynchronous</input>
<input id="sSync" name="sMode" type="radio" value="sync">Synchronous</input>
</td>
</tr>
<tr>
<td colspan="2"><button type="submit" id="sRun" autofocus>Run!</button></td>
</tr>
</table>
</form>
<div><span id="statusBox"></span> <progress id="progressBox" value="0" style="display:none"></progress></div>
<div style="padding-top:10px; padding-bottom:10px">
<table id="resultTable" class="resultTable">
<thead>
<tr>
<td class="center" style="width:1%">Enabled</td>
<td class="center" style="width:10%">Name</td>
<td class="center" style="width:5%">Samples x Iterations</td>
<td class="center" style="width:5%">Min,&nbsp;ms</td>
<td class="center" style="width:5%">Avg,&nbsp;ms</td>
<td class="center" style="width:5%">Max,&nbsp;ms</td>
<td class="center" style="width:5%">Average calls/sec</td>
<td class="center" style="width:5%">Measuring Inacurracy</td>
<td class="center hide" style="width:5%">Memory, MB</td>
<td class="center hide" style="width:5%">Memory delta, MB</td>
<td class="center" style="width:55%">Description</td>
</tr>
</thead>
<tbody>
<!-- result rows here -->
</tbody>
</table>
</div>
<script type="text/javascript">
(function () {
function getPrivateWorkingSet() {
return 0; // TODO: window.PerfTestGetPrivateWorkingSet();
}
var disableWarmUp = true;
var asyncExecution = true;
var testIterations = 1000;
var totalSamples = 100;
var sampleDelay = 0;
var collectSamples = false;
var tests = [];
var testIndex = -1;
function execTestFunc(test) {
try {
var begin = new Date();
test.func(test.totalIterations);
var end = new Date();
return (end - begin);
} catch (e) {
test.error = e.toString();
return 0;
}
}
function execTest(test) {
if (disableWarmUp) { test.warmedUp = true; }
function nextStep() {
if (asyncExecution) {
setTimeout(function () { execTest(test); }, sampleDelay);
} else {
execTest(test);
}
}
function nextTest() {
updateStatus(test);
appendResult(test);
return execNextTest();
}
updateStatus(test);
if (!test.warmedUp) {
execTestFunc(test);
if (!test.error) {
test.warmedUp = true;
test.beginMemory = getPrivateWorkingSet();
return nextStep();
} else {
return nextTest();
}
}
if (test.sample >= test.totalSamples) {
test.avg = test.total / test.totalSamples;
test.endMemory = getPrivateWorkingSet();
return nextTest();
}
if (test.skipped) return nextTest();
var elapsed = execTestFunc(test);
if (!test.error) {
test.total += elapsed;
if (!test.min) test.min = elapsed;
else if (test.min > elapsed) test.min = elapsed;
if (!test.max) test.max = elapsed;
else if (test.max < elapsed) test.max = elapsed;
if (collectSamples) {
test.results.push(elapsed);
}
test.sample++;
return nextStep();
} else {
return nextTest();
}
}
function updateStatus(test) {
var statusBox = document.getElementById("statusBox");
var progressBox = document.getElementById("progressBox");
if (test.skipped || test.error || test.sample >= test.totalSamples) {
statusBox.innerText = "";
progressBox.style.display = "none";
} else {
statusBox.innerText = (testIndex + 1) + "/" + tests.length + ": " + test.name + " (" + test.sample + "/" + test.totalSamples + ")";
progressBox.value = (test.sample / test.totalSamples);
progressBox.style.display = "inline";
}
}
function appendResult(test) {
if (test.name == "warmup") return;
var id = "testResultRow_" + test.index;
var nearBound = (test.max - test.avg) < (test.avg - test.min) ? test.max : test.min;
var memoryDelta = test.endMemory - test.beginMemory;
if (memoryDelta < 0) memoryDelta = "-" + Math.abs(memoryDelta).toFixed(2);
else memoryDelta = "+" + Math.abs(memoryDelta).toFixed(2);
var markup = ["<tr id='" + id + "'>",
"<td class='left'><input type='checkbox' id='test_enabled_", test.index ,"' ", (!test.skipped ? "checked" : "") ," /></td>",
"<td class='left'>", test.name, "</td>",
"<td class='right'>", test.totalSamples, "x", test.totalIterations, "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : test.min.toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : test.avg.toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : test.max.toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : (test.totalIterations * 1000 / test.avg).toFixed(2), "</td>",
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : ("&#x00B1; " + (Math.abs(test.avg - nearBound) / (test.avg) * (100)).toFixed(2) + "%"), "</td>",
"<td class='right hide'>", test.skipped || test.error || !test.prepared ? "-" : test.endMemory.toFixed(2), "</td>",
"<td class='right hide'>", test.skipped || test.error || !test.prepared ? "-" : memoryDelta, "</td>",
"<td class='left'>", test.description, test.error ? (test.description ? "<br/>" : "") + "<span style='color:red'>" + test.error + "</span>" : "", "</td>",
"</tr>"
].join("");
// test.results.join(", "), "<br/>",
var row = document.getElementById(id);
if (row) {
row.outerHTML = markup;
} else {
var tbody = document.getElementById("resultTable").tBodies[0];
tbody.insertAdjacentHTML("beforeEnd", markup);
}
}
function prepareQueuedTests() {
testIndex = -1;
for (var i = 0; i < tests.length; i++) {
var test = tests[i];
test.index = i;
test.prepared = false;
test.warmedUp = false;
test.sample = 0;
test.total = 0;
test.results = [];
test.error = false;
test.min = null;
test.avg = null;
test.max = null;
test.beginMemory = null;
test.endMemory = null;
test.totalIterations = parseInt(testIterations / test.complex);
test.totalSamples = parseInt(totalSamples / test.complex);
var skipElement = document.getElementById('test_enabled_' + test.index);
test.skipped = skipElement ? !skipElement.checked : (test.skipped || false);
if (test.totalIterations <= 0) test.totalIterations = 1;
if (test.totalSamples <= 0) test.totalSamples = 1;
appendResult(test);
test.prepared = true;
}
}
function queueTest(func, name, description) {
var test;
if (typeof func === "function") {
test = {
name: name,
func: func,
description: description
};
} else {
test = func;
}
test.warmedUp = false;
test.complex = test.complex || 1;
tests.push(test);
}
function execNextTest() {
testIndex++;
if (tests.length <= testIndex) {
return testSuiteFinished();
} else {
return execTest(tests[testIndex]);
}
}
function execQueuedTests() {
prepareQueuedTests();
execNextTest();
}
function setSettingsState(disabled) {
document.getElementById('sIterations').disabled = disabled;
document.getElementById('sSamples').disabled = disabled;
document.getElementById('sAsync').disabled = disabled;
document.getElementById('sSync').disabled = disabled;
document.getElementById('sRun').disabled = disabled;
}
function testSuiteFinished() {
setSettingsState(false);
}
window.runTestSuite = function () {
setSettingsState(true);
testIterations = parseInt(document.getElementById('sIterations').value);
totalSamples = parseInt(document.getElementById('sSamples').value);
asyncExecution = document.getElementById('sAsync').checked;
setTimeout(execQueuedTests, 0);
}
setTimeout(prepareQueuedTests, 0);
// Test queue.
queueTest({
name: "PerfTestReturnValue Default",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue();
}
},
description: "No arguments, returns int32 value.",
skipped: true,
});
queueTest({
name: "PerfTestReturnValue (0, Undefined)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(0);
}
},
description: "Int argument, returns undefined value."
});
queueTest({
name: "PerfTestReturnValue (1, Null)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(1);
}
},
description: "Int argument, returns null value."
});
queueTest({
name: "PerfTestReturnValue (2, Bool)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(2);
}
},
description: "Int argument, returns bool value."
});
queueTest({
name: "PerfTestReturnValue (3, Int)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(3);
}
},
description: "Int argument, returns int value."
});
queueTest({
name: "PerfTestReturnValue (4, UInt)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(4);
}
},
description: "Int argument, returns uint value."
});
queueTest({
name: "PerfTestReturnValue (5, Double)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(5);
}
},
description: "Int argument, returns double value."
});
queueTest({
name: "PerfTestReturnValue (6, Date)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(6);
}
},
description: "Int argument, returns date value.",
skipped: true,
});
queueTest({
name: "PerfTestReturnValue (7, String)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(7);
}
},
description: "Int argument, returns string value."
});
queueTest({
name: "PerfTestReturnValue (8, Object)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(8);
}
},
description: "Int argument, returns object value."
});
queueTest({
name: "PerfTestReturnValue (9, Array)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(9);
}
},
description: "Int argument, returns array value."
});
queueTest({
name: "PerfTestReturnValue (10, Function)",
func: function (count) {
for (var i = 0; i < count; i++) {
window.PerfTestReturnValue(10);
}
},
description: "Int argument, returns function value.",
skipped: true,
});
// add more tests to queueTest
})();
</script>
</body>
</html>

View File

@@ -32,7 +32,7 @@ function position() {
}
</script>
</head>
<body>
<body bgcolor="white">
<form>
Click a button to perform the associated window action.
<br/><input type="button" onclick="minimize();" value="Minimize">

View File

@@ -1,5 +1,5 @@
<html>
<body>
<body bgcolor="white">
<script language="JavaScript">
function execXMLHttpRequest()
{

View File

@@ -41,7 +41,8 @@ class ClientSchemeHandler : public CefResourceHandler {
std::string url = request->GetURL();
if (strstr(url.c_str(), "handler.html") != NULL) {
// Build the response html
data_ = "<html><head><title>Client Scheme Handler</title></head><body>"
data_ = "<html><head><title>Client Scheme Handler</title></head>"
"<body bgcolor=\"white\">"
"This contents of this page page are served by the "
"ClientSchemeHandler class handling the client:// protocol."
"<br/>You should see an image:"