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

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

Issue 928393003: Remove the concept of document.documentElement (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « sky/tests/modules/load-event.sky ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!mojo mojo:sky_viewer 1 #!mojo mojo:sky_viewer
2 <sky> 2 <sky>
3 <script> 3 <script>
4 import "../resources/third_party/unittest/unittest.dart"; 4 import "../resources/third_party/unittest/unittest.dart";
5 import "../resources/unit.dart"; 5 import "../resources/unit.dart";
6 import "/sky/framework/shell.dart" as shell; 6 import "/sky/framework/shell.dart" as shell;
7 import "dart:sky"; 7 import "dart:sky";
8 import "package:mojo/services/input_events/public/interfaces/input_event_constan ts.mojom.dart" as constants; 8 import "package:mojo/services/input_events/public/interfaces/input_event_constan ts.mojom.dart" as constants;
9 import "package:mojo/services/input_events/public/interfaces/input_events.mojom. dart" as events; 9 import "package:mojo/services/input_events/public/interfaces/input_events.mojom. dart" as events;
10 import "package:sky/services/testing/test_harness.mojom.dart" as harness; 10 import "package:sky/services/testing/test_harness.mojom.dart" as harness;
11 11
12 void main() { 12 void main() {
13 initUnit(); 13 initUnit();
14 14
15 test('should be able to send events', () { 15 test('should be able to send events', () {
16 var sky = document.querySelector('sky'); 16 document.addEventListener('keypress', expectAsync((event) {
17 sky.addEventListener('keypress', expectAsync((event) {
18 expect(event.type, equals('keypress')); 17 expect(event.type, equals('keypress'));
19 expect(event.key, equals(0)); 18 expect(event.key, equals(0));
20 expect(event.charCode, equals(0x41)); 19 expect(event.charCode, equals(0x41));
21 })); 20 }));
22 21
23 var testHarness = new harness.TestHarnessProxy.unbound(); 22 var testHarness = new harness.TestHarnessProxy.unbound();
24 shell.connectToService("mojo:sky_tester", testHarness); 23 shell.connectToService("mojo:sky_tester", testHarness);
25 var keyData = new events.KeyData(); 24 var keyData = new events.KeyData();
26 keyData.windowsKeyCode = 0x41; 25 keyData.windowsKeyCode = 0x41;
27 keyData.text = 0x41; 26 keyData.text = 0x41;
28 keyData.unmodifiedText = 0x41; 27 keyData.unmodifiedText = 0x41;
29 keyData.isChar = true; 28 keyData.isChar = true;
30 keyData.character = 0x41; 29 keyData.character = 0x41;
31 var event = new events.Event(); 30 var event = new events.Event();
32 event.action = constants.EventType_KEY_PRESSED; 31 event.action = constants.EventType_KEY_PRESSED;
33 event.keyData = keyData; 32 event.keyData = keyData;
34 testHarness.dispatchInputEvent(event); 33 testHarness.dispatchInputEvent(event);
35 }); 34 });
36 } 35 }
37 </script> 36 </script>
38 </sky> 37 </sky>
OLDNEW
« no previous file with comments | « sky/tests/modules/load-event.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698