mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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:
@@ -84,7 +84,8 @@ void RunGetSourceTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
std::string source = StringReplace(string, "<", "<");
|
std::string source = StringReplace(string, "<", "<");
|
||||||
source = StringReplace(source, ">", ">");
|
source = StringReplace(source, ">", ">");
|
||||||
std::stringstream ss;
|
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");
|
browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/getsource");
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@@ -103,7 +104,8 @@ void RunGetTextTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
std::string text = StringReplace(string, "<", "<");
|
std::string text = StringReplace(string, "<", "<");
|
||||||
text = StringReplace(text, ">", ">");
|
text = StringReplace(text, ">", ">");
|
||||||
std::stringstream ss;
|
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");
|
browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/gettext");
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@@ -150,7 +152,8 @@ void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
public:
|
public:
|
||||||
explicit Visitor(CefRefPtr<CefBrowser> browser)
|
explicit Visitor(CefRefPtr<CefBrowser> browser)
|
||||||
: browser_(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>";
|
"\n<b>Installed plugins:</b>";
|
||||||
}
|
}
|
||||||
~Visitor() {
|
~Visitor() {
|
||||||
|
@@ -438,7 +438,8 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
|||||||
|
|
||||||
// Display a load error message.
|
// Display a load error message.
|
||||||
std::stringstream ss;
|
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 <<
|
" with error " << std::string(errorText) << " (" << errorCode <<
|
||||||
").</h2></body></html>";
|
").</h2></body></html>";
|
||||||
frame->LoadString(ss.str(), failedUrl);
|
frame->LoadString(ss.str(), failedUrl);
|
||||||
@@ -469,12 +470,14 @@ CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
|
|||||||
// Show the request contents.
|
// Show the request contents.
|
||||||
std::string dump;
|
std::string dump;
|
||||||
DumpRequestContents(request, dump);
|
DumpRequestContents(request, dump);
|
||||||
|
std::string str = "<html><body bgcolor=\"white\"><pre>" + dump +
|
||||||
|
"</pre></body></html>";
|
||||||
CefRefPtr<CefStreamReader> stream =
|
CefRefPtr<CefStreamReader> stream =
|
||||||
CefStreamReader::CreateForData(
|
CefStreamReader::CreateForData(
|
||||||
static_cast<void*>(const_cast<char*>(dump.c_str())),
|
static_cast<void*>(const_cast<char*>(str.c_str())),
|
||||||
dump.size());
|
str.size());
|
||||||
ASSERT(stream.get());
|
ASSERT(stream.get());
|
||||||
return new CefStreamResourceHandler("text/plain", stream);
|
return new CefStreamResourceHandler("text/html", stream);
|
||||||
} else {
|
} else {
|
||||||
// Load the resource from file.
|
// Load the resource from file.
|
||||||
CefRefPtr<CefStreamReader> stream =
|
CefRefPtr<CefStreamReader> stream =
|
||||||
|
@@ -16,7 +16,7 @@ function sendMessage() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<form>
|
<form>
|
||||||
Message: <input type="text" id="message" value="My Message">
|
Message: <input type="text" id="message" value="My Message">
|
||||||
<br/><input type="button" onclick="sendMessage();" value="Send Message">
|
<br/><input type="button" onclick="sendMessage();" value="Send Message">
|
||||||
|
@@ -48,7 +48,7 @@ function show_file_dialog(element, test) {
|
|||||||
window.addEventListener('load', setup, false);
|
window.addEventListener('load', setup, false);
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<form>
|
<form>
|
||||||
Click a button to show the associated dialog type.
|
Click a button to show the associated dialog type.
|
||||||
<br/><input type="button" onclick="show_alert();" value="Show Alert">
|
<br/><input type="button" onclick="show_alert();" value="Show Alert">
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<html>
|
<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="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="p1">This is p1</p>
|
||||||
<p id="p2">This is p2</p>
|
<p id="p2">This is p2</p>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
var val = window.localStorage.getItem('val');
|
var val = window.localStorage.getItem('val');
|
||||||
function addLine() {
|
function addLine() {
|
||||||
|
@@ -1,32 +1,32 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Other Tests</title>
|
<title>Other Tests</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<h3>Various other internal and external tests.</h3>
|
<h3>Various other internal and external tests.</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="http://mudcu.be/labs/JS1k/BreathingGalaxies.html">Accelerated 2D Canvas</a></li>
|
<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://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://html5advent2011.digitpaint.nl/3/index.html">Cursors</a></li>
|
||||||
<li><a href="http://tests/dialogs">Dialogs</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://tests/domaccess">DOM Access</a></li>
|
||||||
<li><a href="http://html5demos.com/drag">Drag & Drop</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://www.adobe.com/software/flash/about/">Flash Plugin</a></li>
|
||||||
<li><a href="http://html5demos.com/geo">Geolocation</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.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://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/binding">JavaScript Binding</a></li>
|
||||||
<li><a href="http://tests/performance">JavaScript Performance Tests</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/performance2">JavaScript Performance (2) Tests</a></li>
|
||||||
<li><a href="http://tests/window">JavaScript Window Manipulation</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://tests/localstorage">Local Storage</a></li>
|
||||||
<li><a href="http://mrdoob.com/lab/javascript/requestanimationframe/">requestAnimationFrame</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="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://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://tests/transparency">Transparency</a></li>
|
||||||
<li><a href="http://webglsamples.googlecode.com/hg/field/field.html">WebGL</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://apprtc.appspot.com/">WebRTC</a> - requires "enable-media-stream" flag</li>
|
||||||
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>
|
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
body { font-family: Tahoma, Serif; font-size: 9pt; }
|
body { font-family: Tahoma, Serif; font-size: 9pt; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<h1>Performance Tests</h1>
|
<h1>Performance Tests</h1>
|
||||||
<input type="button" value="Run Tests" onClick="run();" id="run"/> Filter: <input type="text" size="50" id="filters"/>
|
<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>
|
<div><span id="statusBox"></span> <progress id="progressBox" value="0" style="display:none"></progress></div>
|
||||||
|
@@ -1,442 +1,442 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Performance Tests (2)</title>
|
<title>Performance Tests (2)</title>
|
||||||
<style>
|
<style>
|
||||||
body { font-family: Tahoma, Serif; font-size: 9pt; }
|
body { font-family: Tahoma, Serif; font-size: 9pt; }
|
||||||
|
|
||||||
.left { text-align: left; }
|
.left { text-align: left; }
|
||||||
.right { text-align: right; }
|
.right { text-align: right; }
|
||||||
.center { text-align: center; }
|
.center { text-align: center; }
|
||||||
|
|
||||||
table.resultTable
|
table.resultTable
|
||||||
{
|
{
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
empty-cells: show;
|
empty-cells: show;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
table.resultTable td
|
table.resultTable td
|
||||||
{
|
{
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
table.resultTable > thead > tr
|
table.resultTable > thead > tr
|
||||||
{
|
{
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background: lightblue;
|
background: lightblue;
|
||||||
}
|
}
|
||||||
table.resultTable > tbody > tr:nth-child(odd)
|
table.resultTable > tbody > tr:nth-child(odd)
|
||||||
{
|
{
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
table.resultTable > tbody > tr:nth-child(even)
|
table.resultTable > tbody > tr:nth-child(even)
|
||||||
{
|
{
|
||||||
background: lightgray;
|
background: lightgray;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide { display: none; }
|
.hide { display: none; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<h1>Performance Tests (2)</h1>
|
<h1>Performance Tests (2)</h1>
|
||||||
|
|
||||||
<form id="sForm" onsubmit="runTestSuite();return false">
|
<form id="sForm" onsubmit="runTestSuite();return false">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">Settings:</td>
|
<td colspan="2">Settings:</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="right">Iterations:</td>
|
<td class="right">Iterations:</td>
|
||||||
<td><input id="sIterations" type="text" value="1000" required pattern="[0-9]+" /></td>
|
<td><input id="sIterations" type="text" value="1000" required pattern="[0-9]+" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="right">Samples:</td>
|
<td class="right">Samples:</td>
|
||||||
<td><input id="sSamples" type="text" value="100" required pattern="[0-9]+" /></td>
|
<td><input id="sSamples" type="text" value="100" required pattern="[0-9]+" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="right">Mode:</td>
|
<td class="right">Mode:</td>
|
||||||
<td><input id="sAsync" name="sMode" type="radio" value="async" checked>Asynchronous</input>
|
<td><input id="sAsync" name="sMode" type="radio" value="async" checked>Asynchronous</input>
|
||||||
<input id="sSync" name="sMode" type="radio" value="sync">Synchronous</input>
|
<input id="sSync" name="sMode" type="radio" value="sync">Synchronous</input>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><button type="submit" id="sRun" autofocus>Run!</button></td>
|
<td colspan="2"><button type="submit" id="sRun" autofocus>Run!</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<div><span id="statusBox"></span> <progress id="progressBox" value="0" style="display:none"></progress></div>
|
<div><span id="statusBox"></span> <progress id="progressBox" value="0" style="display:none"></progress></div>
|
||||||
|
|
||||||
<div style="padding-top:10px; padding-bottom:10px">
|
<div style="padding-top:10px; padding-bottom:10px">
|
||||||
<table id="resultTable" class="resultTable">
|
<table id="resultTable" class="resultTable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="center" style="width:1%">Enabled</td>
|
<td class="center" style="width:1%">Enabled</td>
|
||||||
<td class="center" style="width:10%">Name</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%">Samples x Iterations</td>
|
||||||
<td class="center" style="width:5%">Min, ms</td>
|
<td class="center" style="width:5%">Min, ms</td>
|
||||||
<td class="center" style="width:5%">Avg, ms</td>
|
<td class="center" style="width:5%">Avg, ms</td>
|
||||||
<td class="center" style="width:5%">Max, ms</td>
|
<td class="center" style="width:5%">Max, ms</td>
|
||||||
<td class="center" style="width:5%">Average calls/sec</td>
|
<td class="center" style="width:5%">Average calls/sec</td>
|
||||||
<td class="center" style="width:5%">Measuring Inacurracy</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, MB</td>
|
||||||
<td class="center hide" style="width:5%">Memory delta, MB</td>
|
<td class="center hide" style="width:5%">Memory delta, MB</td>
|
||||||
<td class="center" style="width:55%">Description</td>
|
<td class="center" style="width:55%">Description</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- result rows here -->
|
<!-- result rows here -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function () {
|
(function () {
|
||||||
function getPrivateWorkingSet() {
|
function getPrivateWorkingSet() {
|
||||||
return 0; // TODO: window.PerfTestGetPrivateWorkingSet();
|
return 0; // TODO: window.PerfTestGetPrivateWorkingSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
var disableWarmUp = true;
|
var disableWarmUp = true;
|
||||||
|
|
||||||
var asyncExecution = true;
|
var asyncExecution = true;
|
||||||
var testIterations = 1000;
|
var testIterations = 1000;
|
||||||
var totalSamples = 100;
|
var totalSamples = 100;
|
||||||
var sampleDelay = 0;
|
var sampleDelay = 0;
|
||||||
|
|
||||||
var collectSamples = false;
|
var collectSamples = false;
|
||||||
|
|
||||||
var tests = [];
|
var tests = [];
|
||||||
var testIndex = -1;
|
var testIndex = -1;
|
||||||
|
|
||||||
function execTestFunc(test) {
|
function execTestFunc(test) {
|
||||||
try {
|
try {
|
||||||
var begin = new Date();
|
var begin = new Date();
|
||||||
test.func(test.totalIterations);
|
test.func(test.totalIterations);
|
||||||
var end = new Date();
|
var end = new Date();
|
||||||
return (end - begin);
|
return (end - begin);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
test.error = e.toString();
|
test.error = e.toString();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function execTest(test) {
|
function execTest(test) {
|
||||||
if (disableWarmUp) { test.warmedUp = true; }
|
if (disableWarmUp) { test.warmedUp = true; }
|
||||||
|
|
||||||
function nextStep() {
|
function nextStep() {
|
||||||
if (asyncExecution) {
|
if (asyncExecution) {
|
||||||
setTimeout(function () { execTest(test); }, sampleDelay);
|
setTimeout(function () { execTest(test); }, sampleDelay);
|
||||||
} else {
|
} else {
|
||||||
execTest(test);
|
execTest(test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextTest() {
|
function nextTest() {
|
||||||
updateStatus(test);
|
updateStatus(test);
|
||||||
appendResult(test);
|
appendResult(test);
|
||||||
|
|
||||||
return execNextTest();
|
return execNextTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus(test);
|
updateStatus(test);
|
||||||
if (!test.warmedUp) {
|
if (!test.warmedUp) {
|
||||||
execTestFunc(test);
|
execTestFunc(test);
|
||||||
if (!test.error) {
|
if (!test.error) {
|
||||||
test.warmedUp = true;
|
test.warmedUp = true;
|
||||||
test.beginMemory = getPrivateWorkingSet();
|
test.beginMemory = getPrivateWorkingSet();
|
||||||
return nextStep();
|
return nextStep();
|
||||||
} else {
|
} else {
|
||||||
return nextTest();
|
return nextTest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test.sample >= test.totalSamples) {
|
if (test.sample >= test.totalSamples) {
|
||||||
test.avg = test.total / test.totalSamples;
|
test.avg = test.total / test.totalSamples;
|
||||||
test.endMemory = getPrivateWorkingSet();
|
test.endMemory = getPrivateWorkingSet();
|
||||||
return nextTest();
|
return nextTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test.skipped) return nextTest();
|
if (test.skipped) return nextTest();
|
||||||
|
|
||||||
var elapsed = execTestFunc(test);
|
var elapsed = execTestFunc(test);
|
||||||
if (!test.error) {
|
if (!test.error) {
|
||||||
test.total += elapsed;
|
test.total += elapsed;
|
||||||
if (!test.min) test.min = elapsed;
|
if (!test.min) test.min = elapsed;
|
||||||
else if (test.min > elapsed) test.min = elapsed;
|
else if (test.min > elapsed) test.min = elapsed;
|
||||||
if (!test.max) test.max = elapsed;
|
if (!test.max) test.max = elapsed;
|
||||||
else if (test.max < elapsed) test.max = elapsed;
|
else if (test.max < elapsed) test.max = elapsed;
|
||||||
if (collectSamples) {
|
if (collectSamples) {
|
||||||
test.results.push(elapsed);
|
test.results.push(elapsed);
|
||||||
}
|
}
|
||||||
test.sample++;
|
test.sample++;
|
||||||
return nextStep();
|
return nextStep();
|
||||||
} else {
|
} else {
|
||||||
return nextTest();
|
return nextTest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateStatus(test) {
|
function updateStatus(test) {
|
||||||
var statusBox = document.getElementById("statusBox");
|
var statusBox = document.getElementById("statusBox");
|
||||||
var progressBox = document.getElementById("progressBox");
|
var progressBox = document.getElementById("progressBox");
|
||||||
|
|
||||||
if (test.skipped || test.error || test.sample >= test.totalSamples) {
|
if (test.skipped || test.error || test.sample >= test.totalSamples) {
|
||||||
statusBox.innerText = "";
|
statusBox.innerText = "";
|
||||||
progressBox.style.display = "none";
|
progressBox.style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
statusBox.innerText = (testIndex + 1) + "/" + tests.length + ": " + test.name + " (" + test.sample + "/" + test.totalSamples + ")";
|
statusBox.innerText = (testIndex + 1) + "/" + tests.length + ": " + test.name + " (" + test.sample + "/" + test.totalSamples + ")";
|
||||||
progressBox.value = (test.sample / test.totalSamples);
|
progressBox.value = (test.sample / test.totalSamples);
|
||||||
progressBox.style.display = "inline";
|
progressBox.style.display = "inline";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendResult(test) {
|
function appendResult(test) {
|
||||||
if (test.name == "warmup") return;
|
if (test.name == "warmup") return;
|
||||||
|
|
||||||
var id = "testResultRow_" + test.index;
|
var id = "testResultRow_" + test.index;
|
||||||
|
|
||||||
var nearBound = (test.max - test.avg) < (test.avg - test.min) ? test.max : test.min;
|
var nearBound = (test.max - test.avg) < (test.avg - test.min) ? test.max : test.min;
|
||||||
var memoryDelta = test.endMemory - test.beginMemory;
|
var memoryDelta = test.endMemory - test.beginMemory;
|
||||||
if (memoryDelta < 0) memoryDelta = "-" + Math.abs(memoryDelta).toFixed(2);
|
if (memoryDelta < 0) memoryDelta = "-" + Math.abs(memoryDelta).toFixed(2);
|
||||||
else memoryDelta = "+" + Math.abs(memoryDelta).toFixed(2);
|
else memoryDelta = "+" + Math.abs(memoryDelta).toFixed(2);
|
||||||
|
|
||||||
var markup = ["<tr id='" + id + "'>",
|
var markup = ["<tr id='" + id + "'>",
|
||||||
"<td class='left'><input type='checkbox' id='test_enabled_", test.index ,"' ", (!test.skipped ? "checked" : "") ," /></td>",
|
"<td class='left'><input type='checkbox' id='test_enabled_", test.index ,"' ", (!test.skipped ? "checked" : "") ," /></td>",
|
||||||
"<td class='left'>", test.name, "</td>",
|
"<td class='left'>", test.name, "</td>",
|
||||||
"<td class='right'>", test.totalSamples, "x", test.totalIterations, "</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.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.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.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 ? "-" : (test.totalIterations * 1000 / test.avg).toFixed(2), "</td>",
|
||||||
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : ("± " + (Math.abs(test.avg - nearBound) / (test.avg) * (100)).toFixed(2) + "%"), "</td>",
|
"<td class='right'>", test.skipped || test.error || !test.prepared ? "-" : ("± " + (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 ? "-" : test.endMemory.toFixed(2), "</td>",
|
||||||
"<td class='right hide'>", test.skipped || test.error || !test.prepared ? "-" : memoryDelta, "</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>",
|
"<td class='left'>", test.description, test.error ? (test.description ? "<br/>" : "") + "<span style='color:red'>" + test.error + "</span>" : "", "</td>",
|
||||||
"</tr>"
|
"</tr>"
|
||||||
].join("");
|
].join("");
|
||||||
// test.results.join(", "), "<br/>",
|
// test.results.join(", "), "<br/>",
|
||||||
|
|
||||||
var row = document.getElementById(id);
|
var row = document.getElementById(id);
|
||||||
if (row) {
|
if (row) {
|
||||||
row.outerHTML = markup;
|
row.outerHTML = markup;
|
||||||
} else {
|
} else {
|
||||||
var tbody = document.getElementById("resultTable").tBodies[0];
|
var tbody = document.getElementById("resultTable").tBodies[0];
|
||||||
tbody.insertAdjacentHTML("beforeEnd", markup);
|
tbody.insertAdjacentHTML("beforeEnd", markup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareQueuedTests() {
|
function prepareQueuedTests() {
|
||||||
testIndex = -1;
|
testIndex = -1;
|
||||||
for (var i = 0; i < tests.length; i++) {
|
for (var i = 0; i < tests.length; i++) {
|
||||||
var test = tests[i];
|
var test = tests[i];
|
||||||
test.index = i;
|
test.index = i;
|
||||||
test.prepared = false;
|
test.prepared = false;
|
||||||
test.warmedUp = false;
|
test.warmedUp = false;
|
||||||
test.sample = 0;
|
test.sample = 0;
|
||||||
test.total = 0;
|
test.total = 0;
|
||||||
test.results = [];
|
test.results = [];
|
||||||
test.error = false;
|
test.error = false;
|
||||||
test.min = null;
|
test.min = null;
|
||||||
test.avg = null;
|
test.avg = null;
|
||||||
test.max = null;
|
test.max = null;
|
||||||
test.beginMemory = null;
|
test.beginMemory = null;
|
||||||
test.endMemory = null;
|
test.endMemory = null;
|
||||||
test.totalIterations = parseInt(testIterations / test.complex);
|
test.totalIterations = parseInt(testIterations / test.complex);
|
||||||
test.totalSamples = parseInt(totalSamples / test.complex);
|
test.totalSamples = parseInt(totalSamples / test.complex);
|
||||||
|
|
||||||
var skipElement = document.getElementById('test_enabled_' + test.index);
|
var skipElement = document.getElementById('test_enabled_' + test.index);
|
||||||
test.skipped = skipElement ? !skipElement.checked : (test.skipped || false);
|
test.skipped = skipElement ? !skipElement.checked : (test.skipped || false);
|
||||||
|
|
||||||
if (test.totalIterations <= 0) test.totalIterations = 1;
|
if (test.totalIterations <= 0) test.totalIterations = 1;
|
||||||
if (test.totalSamples <= 0) test.totalSamples = 1;
|
if (test.totalSamples <= 0) test.totalSamples = 1;
|
||||||
|
|
||||||
appendResult(test);
|
appendResult(test);
|
||||||
test.prepared = true;
|
test.prepared = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function queueTest(func, name, description) {
|
function queueTest(func, name, description) {
|
||||||
var test;
|
var test;
|
||||||
if (typeof func === "function") {
|
if (typeof func === "function") {
|
||||||
test = {
|
test = {
|
||||||
name: name,
|
name: name,
|
||||||
func: func,
|
func: func,
|
||||||
description: description
|
description: description
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
test = func;
|
test = func;
|
||||||
}
|
}
|
||||||
test.warmedUp = false;
|
test.warmedUp = false;
|
||||||
test.complex = test.complex || 1;
|
test.complex = test.complex || 1;
|
||||||
tests.push(test);
|
tests.push(test);
|
||||||
}
|
}
|
||||||
|
|
||||||
function execNextTest() {
|
function execNextTest() {
|
||||||
testIndex++;
|
testIndex++;
|
||||||
if (tests.length <= testIndex) {
|
if (tests.length <= testIndex) {
|
||||||
return testSuiteFinished();
|
return testSuiteFinished();
|
||||||
} else {
|
} else {
|
||||||
return execTest(tests[testIndex]);
|
return execTest(tests[testIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function execQueuedTests() {
|
function execQueuedTests() {
|
||||||
prepareQueuedTests();
|
prepareQueuedTests();
|
||||||
execNextTest();
|
execNextTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSettingsState(disabled) {
|
function setSettingsState(disabled) {
|
||||||
document.getElementById('sIterations').disabled = disabled;
|
document.getElementById('sIterations').disabled = disabled;
|
||||||
document.getElementById('sSamples').disabled = disabled;
|
document.getElementById('sSamples').disabled = disabled;
|
||||||
document.getElementById('sAsync').disabled = disabled;
|
document.getElementById('sAsync').disabled = disabled;
|
||||||
document.getElementById('sSync').disabled = disabled;
|
document.getElementById('sSync').disabled = disabled;
|
||||||
document.getElementById('sRun').disabled = disabled;
|
document.getElementById('sRun').disabled = disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSuiteFinished() {
|
function testSuiteFinished() {
|
||||||
setSettingsState(false);
|
setSettingsState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.runTestSuite = function () {
|
window.runTestSuite = function () {
|
||||||
setSettingsState(true);
|
setSettingsState(true);
|
||||||
|
|
||||||
testIterations = parseInt(document.getElementById('sIterations').value);
|
testIterations = parseInt(document.getElementById('sIterations').value);
|
||||||
totalSamples = parseInt(document.getElementById('sSamples').value);
|
totalSamples = parseInt(document.getElementById('sSamples').value);
|
||||||
asyncExecution = document.getElementById('sAsync').checked;
|
asyncExecution = document.getElementById('sAsync').checked;
|
||||||
|
|
||||||
setTimeout(execQueuedTests, 0);
|
setTimeout(execQueuedTests, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(prepareQueuedTests, 0);
|
setTimeout(prepareQueuedTests, 0);
|
||||||
|
|
||||||
// Test queue.
|
// Test queue.
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue Default",
|
name: "PerfTestReturnValue Default",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue();
|
window.PerfTestReturnValue();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "No arguments, returns int32 value.",
|
description: "No arguments, returns int32 value.",
|
||||||
skipped: true,
|
skipped: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (0, Undefined)",
|
name: "PerfTestReturnValue (0, Undefined)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(0);
|
window.PerfTestReturnValue(0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns undefined value."
|
description: "Int argument, returns undefined value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (1, Null)",
|
name: "PerfTestReturnValue (1, Null)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(1);
|
window.PerfTestReturnValue(1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns null value."
|
description: "Int argument, returns null value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (2, Bool)",
|
name: "PerfTestReturnValue (2, Bool)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(2);
|
window.PerfTestReturnValue(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns bool value."
|
description: "Int argument, returns bool value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (3, Int)",
|
name: "PerfTestReturnValue (3, Int)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(3);
|
window.PerfTestReturnValue(3);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns int value."
|
description: "Int argument, returns int value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (4, UInt)",
|
name: "PerfTestReturnValue (4, UInt)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(4);
|
window.PerfTestReturnValue(4);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns uint value."
|
description: "Int argument, returns uint value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (5, Double)",
|
name: "PerfTestReturnValue (5, Double)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(5);
|
window.PerfTestReturnValue(5);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns double value."
|
description: "Int argument, returns double value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (6, Date)",
|
name: "PerfTestReturnValue (6, Date)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(6);
|
window.PerfTestReturnValue(6);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns date value.",
|
description: "Int argument, returns date value.",
|
||||||
skipped: true,
|
skipped: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (7, String)",
|
name: "PerfTestReturnValue (7, String)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(7);
|
window.PerfTestReturnValue(7);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns string value."
|
description: "Int argument, returns string value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (8, Object)",
|
name: "PerfTestReturnValue (8, Object)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(8);
|
window.PerfTestReturnValue(8);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns object value."
|
description: "Int argument, returns object value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (9, Array)",
|
name: "PerfTestReturnValue (9, Array)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(9);
|
window.PerfTestReturnValue(9);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns array value."
|
description: "Int argument, returns array value."
|
||||||
});
|
});
|
||||||
|
|
||||||
queueTest({
|
queueTest({
|
||||||
name: "PerfTestReturnValue (10, Function)",
|
name: "PerfTestReturnValue (10, Function)",
|
||||||
func: function (count) {
|
func: function (count) {
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
window.PerfTestReturnValue(10);
|
window.PerfTestReturnValue(10);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description: "Int argument, returns function value.",
|
description: "Int argument, returns function value.",
|
||||||
skipped: true,
|
skipped: true,
|
||||||
});
|
});
|
||||||
// add more tests to queueTest
|
// add more tests to queueTest
|
||||||
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -32,7 +32,7 @@ function position() {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<form>
|
<form>
|
||||||
Click a button to perform the associated window action.
|
Click a button to perform the associated window action.
|
||||||
<br/><input type="button" onclick="minimize();" value="Minimize">
|
<br/><input type="button" onclick="minimize();" value="Minimize">
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body bgcolor="white">
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
function execXMLHttpRequest()
|
function execXMLHttpRequest()
|
||||||
{
|
{
|
||||||
|
@@ -41,7 +41,8 @@ class ClientSchemeHandler : public CefResourceHandler {
|
|||||||
std::string url = request->GetURL();
|
std::string url = request->GetURL();
|
||||||
if (strstr(url.c_str(), "handler.html") != NULL) {
|
if (strstr(url.c_str(), "handler.html") != NULL) {
|
||||||
// Build the response html
|
// 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 "
|
"This contents of this page page are served by the "
|
||||||
"ClientSchemeHandler class handling the client:// protocol."
|
"ClientSchemeHandler class handling the client:// protocol."
|
||||||
"<br/>You should see an image:"
|
"<br/>You should see an image:"
|
||||||
|
Reference in New Issue
Block a user