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

Side by Side Diff: sky/tests/resources/event-sender.dart

Issue 948463003: Added Sky Mojo embedder singleton, restored network test (Closed) Base URL: https://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/TestExpectations ('k') | sky/tests/services/event-sender.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import "/sky/framework/shell.dart" as shell; 5 import "/sky/framework/embedder.dart";
6 import "dart:async"; 6 import "dart:async";
7 import "dart:sky"; 7 import "dart:sky";
8 import "dart:sky.internals" as internals; 8 import "dart:sky.internals" as internals;
9 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_event_constan ts.mojom.dart" as constants;
10 import "package:mojo/services/input_events/public/interfaces/input_events.mojom. dart" as events; 10 import "package:mojo/services/input_events/public/interfaces/input_events.mojom. dart" as events;
11 import "package:mojo/services/input_events/public/interfaces/input_key_codes.moj om.dart" as codes; 11 import "package:mojo/services/input_events/public/interfaces/input_key_codes.moj om.dart" as codes;
12 import "package:sky/services/testing/test_harness.mojom.dart" as harness; 12 import "package:sky/services/testing/test_harness.mojom.dart" as harness;
13 13
14 bool _isDone = false; 14 bool _isDone = false;
15 int _keyPressesRemaining = 0; 15 int _keyPressesRemaining = 0;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 void handleKeyPress_(Event event) { 56 void handleKeyPress_(Event event) {
57 --_keyPressesRemaining; 57 --_keyPressesRemaining;
58 _checkComplete(); 58 _checkComplete();
59 } 59 }
60 60
61 harness.TestHarnessProxy _init() { 61 harness.TestHarnessProxy _init() {
62 document.addEventListener('keypress', handleKeyPress_); 62 document.addEventListener('keypress', handleKeyPress_);
63 63
64 var harnessProxy = new harness.TestHarnessProxy.unbound(); 64 var harnessProxy = new harness.TestHarnessProxy.unbound();
65 shell.connectToService("mojo:sky_tester", harnessProxy); 65 embedder.connectToService("mojo:sky_tester", harnessProxy);
66 return harnessProxy; 66 return harnessProxy;
67 } 67 }
68 68
69 final harness.TestHarnessProxy _harness = _init(); 69 final harness.TestHarnessProxy _harness = _init();
70 70
71 // |0| should be EventFlags_NONE once its a compile-time constant. 71 // |0| should be EventFlags_NONE once its a compile-time constant.
72 void keyDown(int keyCode, [int eventFlags = 0]) { 72 void keyDown(int keyCode, [int eventFlags = 0]) {
73 if (!_chars.contains(keyCode)) { 73 if (!_chars.contains(keyCode)) {
74 _harness.dispatchInputEvent( 74 _harness.dispatchInputEvent(
75 new events.Event() 75 new events.Event()
(...skipping 24 matching lines...) Expand all
100 ..unmodifiedText = keyCode)); 100 ..unmodifiedText = keyCode));
101 } 101 }
102 } 102 }
103 103
104 void done() { 104 void done() {
105 if (_isDone) 105 if (_isDone)
106 throw "Already done."; 106 throw "Already done.";
107 _isDone = true; 107 _isDone = true;
108 _checkComplete(); 108 _checkComplete();
109 } 109 }
OLDNEW
« no previous file with comments | « sky/tests/TestExpectations ('k') | sky/tests/services/event-sender.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698