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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/spy/ui/spy_test.js
diff --git a/mojo/spy/ui/spy_test.js b/mojo/spy/ui/spy_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..b70ecd9d63d396ee8bcf46adab54ff5a29bfaac7
--- /dev/null
+++ b/mojo/spy/ui/spy_test.js
@@ -0,0 +1,51 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+'use strict';
+
+tvcm.require('ui.spy');
+tvcm.require('tvcm.event_target');
+
+tvcm.unittest.testSuite('ui.spy_test', function() {
+ /**
+ * @constructor
+ */
+ function FakeChannel() {
+ tvcm.EventTarget.call(this);
+ }
+
+ FakeChannel.prototype = {
+ __proto__: tvcm.EventTarget.prototype,
+
+ send: function(msg) {
+ },
+
+ dispatchMessage: function(msg) {
+ var event = new Event('message', false, false);
+ event.data = msg;
+ this.dispatchEvent(event);
+ }
+ };
+
+ test('basic', function() {
+ var channel = new FakeChannel();
+
+ var spy = new ui.Spy();
+ spy.style.width = '600px';
+ spy.style.height = '400px';
+ spy.style.border = '1px solid black';
+ this.addHTMLOutput(spy);
+ spy.channel = channel;
+
+ channel.dispatchMessage({data: 'alo there'});
+
+ // Fake out echo reply
+ channel.send = function(msg) {
+ setTimeout(function() {
+ channel.dispatchMessage({data: {type: 'reply', msg: msg}});
+ }, 10);
+ }
+ });
+
+});
« 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