Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sky/tests/services/event-sender.sky

Issue 716043002: Implement event sender service for testing (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <sky> 1 <sky>
2 <import src="../resources/chai.sky" /> 2 <import src="../resources/chai.sky" />
3 <import src="../resources/mocha.sky" /> 3 <import src="../resources/mocha.sky" />
4 4 <import src="/mojo/services/public/interfaces/input_events/input_event_constants .mojom.sky" as="constants" />
5 <import src="/mojo/services/public/interfaces/input_events/input_events.mojom.sk y" as="events" /> 5 <import src="/mojo/services/public/interfaces/input_events/input_events.mojom.sk y" as="events" />
6 <import src="/sky/framework/shell.sky" as="shell" /> 6 <import src="/sky/framework/shell.sky" as="shell" />
7 <import src="/sky/services/testing/test_harness.mojom.sky" as="harness" />
7 8
8 <script> 9 <script>
9 describe('Mojo network_service', function() { 10 describe('Sky event sender', function() {
10 it('should be able to fetch text files', function(done) { 11 it('should be able to send events', function(done) {
12 var sky = document.querySelector('sky')
13 sky.focus();
14 sky.addEventListener('keypress', function(event) {
15 assert.equal(event.type, 'keypress');
16 assert.equal(event.keyCode, 0x41);
17 done();
18 });
11 19
12 20 var testHarness = shell.connectToService(
13 21 "mojo:sky_tester", harness.TestHarness);
14 done(); 22 testHarness.dispatchInputEvent(new events.Event({
23 action: constants.EventType.KEY_PRESSED,
24 key_data: new events.KeyData({
25 native_key_code: 0x41,
26 text: 0x41,
27 unmodified_text: 0x41,
28 is_char: true,
29 character: 0x41,
30 }),
31 }));
15 }); 32 });
16 }); 33 });
17 </script> 34 </script>
18 </sky> 35 </sky>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698