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

Side by Side Diff: mojo/public/js/bindings/struct_unittests.js

Issue 628763002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed template indentation Created 6 years, 2 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/public/js/bindings/connection.js ('k') | mojo/public/js/bindings/validation_unittests.js » ('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 2014 The Chromium Authors. All rights reserved. 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 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 define([ 5 define([
6 "gin/test/expect", 6 "gin/test/expect",
7 "mojo/public/interfaces/bindings/tests/rect.mojom", 7 "mojo/public/interfaces/bindings/tests/rect.mojom",
8 "mojo/public/interfaces/bindings/tests/test_structs.mojom" 8 "mojo/public/interfaces/bindings/tests/test_structs.mojom"
9 ], function(expect, 9 ], function(expect,
10 rect, 10 rect,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // f13,14 "foo" 65 // f13,14 "foo"
66 for (var i = 13; i <= 14; i++) 66 for (var i = 13; i <= 14; i++)
67 expect(s["f" + i]).toEqual("foo"); 67 expect(s["f" + i]).toEqual("foo");
68 68
69 // f15,16 a default instance of Rect 69 // f15,16 a default instance of Rect
70 var r = new rect.Rect(); 70 var r = new rect.Rect();
71 expect(s.f15).toEqual(r); 71 expect(s.f15).toEqual(r);
72 expect(s.f16).toEqual(r); 72 expect(s.f16).toEqual(r);
73 } 73 }
74 74
75 function testScopedConstants() {
76 expect(testStructs.ScopedConstants.TEN).toEqual(10);
77 expect(testStructs.ScopedConstants.ALSO_TEN).toEqual(10);
78 expect(testStructs.ScopedConstants.TEN_TOO).toEqual(10);
79
80 expect(testStructs.ScopedConstants.EType.E0).toEqual(0);
81 expect(testStructs.ScopedConstants.EType.E1).toEqual(1);
82 expect(testStructs.ScopedConstants.EType.E2).toEqual(10);
83 expect(testStructs.ScopedConstants.EType.E3).toEqual(10);
84 expect(testStructs.ScopedConstants.EType.E4).toEqual(11);
85
86 var s = new testStructs.ScopedConstants();
87 expect(s.f0).toEqual(0);
88 expect(s.f1).toEqual(1);
89 expect(s.f2).toEqual(10);
90 expect(s.f3).toEqual(10);
91 expect(s.f4).toEqual(11);
92 expect(s.f5).toEqual(10);
93 expect(s.f6).toEqual(10);
94 }
95
75 testConstructors(); 96 testConstructors();
76 testNoDefaultFieldValues(); 97 testNoDefaultFieldValues();
77 testDefaultFieldValues(); 98 testDefaultFieldValues();
99 testScopedConstants();
78 this.result = "PASS"; 100 this.result = "PASS";
79 }); 101 });
OLDNEW
« no previous file with comments | « mojo/public/js/bindings/connection.js ('k') | mojo/public/js/bindings/validation_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698