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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: sky/tests/services/event-sender.sky
diff --git a/sky/tests/services/event-sender.sky b/sky/tests/services/event-sender.sky
index 6f2fc51376b020d5b145f54c1cf024e682a46c72..748f64e00195a8e885ab07a71b21aaaab969188c 100644
--- a/sky/tests/services/event-sender.sky
+++ b/sky/tests/services/event-sender.sky
@@ -1,17 +1,34 @@
<sky>
<import src="../resources/chai.sky" />
<import src="../resources/mocha.sky" />
-
+<import src="/mojo/services/public/interfaces/input_events/input_event_constants.mojom.sky" as="constants" />
<import src="/mojo/services/public/interfaces/input_events/input_events.mojom.sky" as="events" />
<import src="/sky/framework/shell.sky" as="shell" />
+<import src="/sky/services/testing/test_harness.mojom.sky" as="harness" />
<script>
-describe('Mojo network_service', function() {
- it('should be able to fetch text files', function(done) {
-
-
+describe('Sky event sender', function() {
+ it('should be able to send events', function(done) {
+ var sky = document.querySelector('sky')
+ sky.focus();
+ sky.addEventListener('keypress', function(event) {
+ assert.equal(event.type, 'keypress');
+ assert.equal(event.keyCode, 0x41);
+ done();
+ });
- done();
+ var testHarness = shell.connectToService(
+ "mojo:sky_tester", harness.TestHarness);
+ testHarness.dispatchInputEvent(new events.Event({
+ action: constants.EventType.KEY_PRESSED,
+ key_data: new events.KeyData({
+ native_key_code: 0x41,
+ text: 0x41,
+ unmodified_text: 0x41,
+ is_char: true,
+ character: 0x41,
+ }),
+ }));
});
});
</script>

Powered by Google App Engine
This is Rietveld 408576698