OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "console", | 6 "console", |
7 "mojo/apps/js/test/hexdump", | 7 "mojo/apps/js/test/hexdump", |
8 "gin/test/expect", | 8 "gin/test/expect", |
9 "mojom/sample_service" | 9 "mojom/sample_service" |
10 ], function(console, hexdump, expect, sample) { | 10 ], function(console, hexdump, expect, sample) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 // Check that values are set to the defaults if we don't override them. | 88 // Check that values are set to the defaults if we don't override them. |
89 function checkDefaultValues() { | 89 function checkDefaultValues() { |
90 var bar = new sample.Bar(); | 90 var bar = new sample.Bar(); |
91 expect(bar.alpha).toBe(255); | 91 expect(bar.alpha).toBe(255); |
92 | 92 |
93 var foo = new sample.Foo(); | 93 var foo = new sample.Foo(); |
94 expect(foo.name).toBe("Fooby"); | 94 expect(foo.name).toBe("Fooby"); |
95 expect(foo.a).toBeTruthy(); | 95 expect(foo.a).toBeTruthy(); |
| 96 |
| 97 expect(foo.data.length).toBe(3); |
| 98 expect(foo.data[0]).toBe(1); |
| 99 expect(foo.data[1]).toBe(2); |
| 100 expect(foo.data[2]).toBe(3); |
96 } | 101 } |
97 | 102 |
98 function ServiceImpl() { | 103 function ServiceImpl() { |
99 } | 104 } |
100 | 105 |
101 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype); | 106 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype); |
102 | 107 |
103 ServiceImpl.prototype.frobinate = function(foo, baz, port) { | 108 ServiceImpl.prototype.frobinate = function(foo, baz, port) { |
104 checkFoo(foo); | 109 checkFoo(foo); |
105 expect(baz).toBe(sample.ServiceStub.BazOptions.BAZ_EXTRA); | 110 expect(baz).toBe(sample.ServiceStub.BazOptions.BAZ_EXTRA); |
(...skipping 16 matching lines...) Expand all Loading... |
122 var serviceProxy = new sample.ServiceProxy(receiver); | 127 var serviceProxy = new sample.ServiceProxy(receiver); |
123 | 128 |
124 checkDefaultValues(); | 129 checkDefaultValues(); |
125 | 130 |
126 var foo = makeFoo(); | 131 var foo = makeFoo(); |
127 checkFoo(foo); | 132 checkFoo(foo); |
128 | 133 |
129 var port = 10; | 134 var port = 10; |
130 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.BAZ_EXTRA, port); | 135 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.BAZ_EXTRA, port); |
131 }); | 136 }); |
OLD | NEW |