X Tutup
Skip to content

Commit 1dde33f

Browse files
committed
Added cefclient tests - the files/ directory.
1 parent 8c81f4c commit 1dde33f

File tree

11 files changed

+645
-0
lines changed

11 files changed

+645
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<html>
2+
<head>
3+
<title>Binding Test</title>
4+
<script language="JavaScript">
5+
6+
// Register the callback for messages from the browser process.
7+
app.setMessageCallback('binding_test', function(name, args) {
8+
document.getElementById('result').value = "Response: "+args[0];
9+
});
10+
11+
// Send a message to the browser process.
12+
function sendMessage() {
13+
var msg = document.getElementById("message").value;
14+
app.sendMessage('binding_test', [msg]);
15+
}
16+
</script>
17+
18+
</head>
19+
<body>
20+
<form>
21+
Message: <input type="text" id="message" value="My Message">
22+
<br/><input type="button" onclick="sendMessage();" value="Send Message">
23+
<br/>You should see the reverse of your message below:
24+
<br/><textarea rows="10" cols="40" id="result"></textarea>
25+
</form>
26+
</body>
27+
</html>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<html>
2+
<head>
3+
<title>Dialog Test</title>
4+
<script>
5+
function show_alert() {
6+
alert("I am an alert box!");
7+
}
8+
9+
function show_confirm() {
10+
var r = confirm("Press a button");
11+
var msg = r ? "You pressed OK!" : "You pressed Cancel!";
12+
document.getElementById('cm').innerText = msg;
13+
}
14+
15+
function show_prompt() {
16+
var name = prompt("Please enter your name" ,"Harry Potter");
17+
if (name != null && name != "")
18+
document.getElementById('pm').innerText = "Hello " + name + "!";
19+
}
20+
21+
window.onbeforeunload = function() {
22+
return 'This is an onbeforeunload message.';
23+
}
24+
25+
function update_time() {
26+
document.getElementById('time').innerText = new Date().toLocaleString();
27+
}
28+
29+
function setup() {
30+
update_time();
31+
setInterval(update_time, 1000);
32+
}
33+
34+
function show_file_dialog(element, test) {
35+
var message = 'DialogTest.' + test;
36+
var target = document.getElementById(element);
37+
38+
// Register for the callback from OnFileDialogDismissed in dialog_test.cpp.
39+
app.setMessageCallback(message, function(msg, paths) {
40+
target.innerText = paths.join();
41+
app.removeMessageCallback(message);
42+
});
43+
44+
// This will result in a call to OnProcessMessageReceived in dialog_test.cpp.
45+
app.sendMessage(message);
46+
}
47+
48+
window.addEventListener('load', setup, false);
49+
</script>
50+
</head>
51+
<body>
52+
<form>
53+
Click a button to show the associated dialog type.
54+
<br/><input type="button" onclick="show_alert();" value="Show Alert">
55+
<br/><input type="button" onclick="show_confirm();" value="Show Confirm"> <span id="cm"></span>
56+
<br/><input type="button" onclick="show_prompt();" value="Show Prompt"> <span id="pm"></span>
57+
<br/>input type="file": <input type="file" name="pic" accept="text/*,.js,.css,image/*">
58+
<br/><input type="button" onclick="show_file_dialog('fo', 'FileOpen');" value="Show File Open"> <span id="fo"></span>
59+
<br/><input type="button" onclick="show_file_dialog('fom', 'FileOpenMultiple');" value="Show File Open Multiple"> <span id="fom"></span>
60+
<br/><input type="button" onclick="show_file_dialog('fs', 'FileSave');" value="Show File Save"> <span id="fs"></span>
61+
<p id="time"></p>
62+
</form>
63+
</body>
64+
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<body>
3+
<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>
4+
<p id="p1">This is p1</p>
5+
<p id="p2">This is p2</p>
6+
<p id="p3">This is p3</p>
7+
<p id="p4">This is p4</p>
8+
<form>
9+
<input type="button" id="button" value="Describe Selection">
10+
<p id="description">The description will appear here.</p>
11+
</form>
12+
</body>
13+
</html>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<html>
2+
<body>
3+
<script language="JavaScript">
4+
var val = window.localStorage.getItem('val');
5+
function addLine() {
6+
if(val == null)
7+
val = '<br/>One Line.';
8+
else
9+
val += '<br/>Another Line.';
10+
window.localStorage.setItem('val', val);
11+
document.getElementById('out').innerHTML = val;
12+
}
13+
</script>
14+
Click the "Add Line" button to add a line or the "Clear" button to clear.<br/>
15+
This data will persist across sessions if a cache path was specified.<br/>
16+
<input type="button" value="Add Line" onClick="addLine();"/>
17+
<input type="button" value="Clear" onClick="window.localStorage.removeItem('val'); window.location.reload();"/>
18+
<div id="out"></div>
19+
<script language="JavaScript">
20+
if(val != null)
21+
document.getElementById('out').innerHTML = val;
22+
</script>
23+
</body>
24+
</html>
19.4 KB
Loading
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<html>
2+
<head><title>OSR Test</title></head>
3+
<style>
4+
.red_hover:hover {color:red;}
5+
#li { width: 530px; }
6+
body {background:rgba(255, 0, 0, 0.5); }
7+
input {-webkit-appearance: none; }
8+
#LI11select {width: 75px;}
9+
</style>
10+
<script>
11+
function sendBrowserMessage(paramString) {
12+
app.sendMessage("osrtest", [paramString]);
13+
}
14+
15+
function getElement(id) { return document.getElementById(id); }
16+
function makeH1Red() { getElement('LI00').style.color='red'; }
17+
function makeH1Black() { getElement('LI00').style.color='black'; }
18+
function navigate() { location.href='?k='+getElement('editbox').value; }
19+
function load() { var select = document.getElementById('LI11select');
20+
for (var i = 1; i < 21; i++)
21+
select.options.add(new Option('Option ' + i, i));
22+
}
23+
24+
function onEventTest(event) {
25+
var param = event.type;
26+
27+
if (event.type == "click")
28+
param += event.button;
29+
30+
sendBrowserMessage(param);
31+
}
32+
33+
</script>
34+
<body onfocus='onEventTest(event)' onblur='onEventTest(event)' onload='load();'>
35+
<h1 id='LI00' onclick="onEventTest(event)">
36+
OSR Testing h1 - Focus and blur
37+
<select id='LI11select'>
38+
<option value='0'>Default</option>
39+
</select>
40+
this page and will get this red black
41+
</h1>
42+
<ol>
43+
<li id='LI01'>OnPaint should be called each time a page loads</li>
44+
<li id='LI02' style='cursor:pointer;'><span>Move mouse
45+
to require an OnCursorChange call</span></li>
46+
<li id='LI03' onmousemove="onEventTest(event)"><span>Hover will color this with
47+
red. Will trigger OnPaint once on enter and once on leave</span></li>
48+
<li id='LI04'>Right clicking will show contextual menu and will request
49+
GetScreenPoint</li>
50+
<li id='LI05'>IsWindowRenderingDisabled should be true</li>
51+
<li id='LI06'>WasResized should trigger full repaint if size changes.
52+
</li>
53+
<li id='LI07'>Invalidate should trigger OnPaint once</li>
54+
<li id='LI08'>Click and write here with SendKeyEvent to trigger repaints:
55+
<input id='editbox' type='text' value='' size="5"></li>
56+
<li id='LI09'>Click here with SendMouseClickEvent to navigate:
57+
<input id='btnnavigate' type='button' onclick='navigate()'
58+
value='Click here to navigate' id='editbox' /></li>
59+
<li id='LI10' title='EXPECTED_TOOLTIP'>Mouse over this element will
60+
trigger show a tooltip</li>
61+
</ol>
62+
<br />
63+
<br />
64+
<br />
65+
<br />
66+
<br />
67+
<br />
68+
</body>
69+
</html>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<html>
2+
<head>
3+
<title>Other Tests</title>
4+
</head>
5+
<body>
6+
<h3>Various other internal and external tests.</h3>
7+
<ul>
8+
<li><a href="http://mudcu.be/labs/JS1k/BreathingGalaxies.html">Accelerated 2D Canvas</a></li>
9+
<li><a href="http://webkit.org/blog-files/3d-transforms/poster-circle.html">Accelerated Layers</a></li>
10+
<li><a href="http://html5advent2011.digitpaint.nl/3/index.html">Cursors</a></li>
11+
<li><a href="http://tests/dialogs">Dialogs</a></li>
12+
<li><a href="http://tests/domaccess">DOM Access</a></li>
13+
<li><a href="http://html5demos.com/drag">Drag & Drop</a></li>
14+
<li><a href="http://www.adobe.com/software/flash/about/">Flash Plugin</a></li>
15+
<li><a href="http://html5demos.com/geo">Geolocation</a></li>
16+
<li><a href="http://www.html5test.com">HTML5 Feature Test</a></li>
17+
<li><a href="http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True">HTML5 Video</a></li>
18+
<li><a href="http://tests/binding">JavaScript Binding</a></li>
19+
<li><a href="http://tests/performance">JavaScript Performance Tests</a></li>
20+
<li><a href="http://tests/window">JavaScript Window Manipulation</a></li>
21+
<li><a href="http://tests/localstorage">Local Storage</a></li>
22+
<li><a href="http://mrdoob.com/lab/javascript/requestanimationframe/">requestAnimationFrame</a></li>
23+
<li><a href="client://tests/handler.html">Scheme Handler</a></li>
24+
<li><a href="http://tests/transparency">Transparency</a></li>
25+
<li><a href="http://webglsamples.googlecode.com/hg/field/field.html">WebGL</a></li>
26+
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>
27+
</ul>
28+
</body>
29+
</html>

0 commit comments

Comments
 (0)
X Tutup