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

Side by Side Diff: mojo/spy/ui/spy_test.js

Issue 281623007: Add mojo web UI framework based on Nat's TVCM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed a few Created 6 years, 7 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 | « mojo/spy/ui/spy_shell_to_html.py ('k') | mojo/spy/ui/tvcm_stub.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 tvcm.require('ui.spy');
8 tvcm.require('tvcm.event_target');
9
10 tvcm.unittest.testSuite('ui.spy_test', function() {
11 /**
12 * @constructor
13 */
14 function FakeChannel() {
15 tvcm.EventTarget.call(this);
16 }
17
18 FakeChannel.prototype = {
19 __proto__: tvcm.EventTarget.prototype,
20
21 send: function(msg) {
22 },
23
24 dispatchMessage: function(msg) {
25 var event = new Event('message', false, false);
26 event.data = msg;
27 this.dispatchEvent(event);
28 }
29 };
30
31 test('basic', function() {
32 var channel = new FakeChannel();
33
34 var spy = new ui.Spy();
35 spy.style.width = '600px';
36 spy.style.height = '400px';
37 spy.style.border = '1px solid black';
38 this.addHTMLOutput(spy);
39 spy.channel = channel;
40
41 channel.dispatchMessage({data: 'alo there'});
42
43 // Fake out echo reply
44 channel.send = function(msg) {
45 setTimeout(function() {
46 channel.dispatchMessage({data: {type: 'reply', msg: msg}});
47 }, 10);
48 }
49 });
50
51 });
OLDNEW
« no previous file with comments | « mojo/spy/ui/spy_shell_to_html.py ('k') | mojo/spy/ui/tvcm_stub.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698