OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
| 7 /* globals ASSERT_EQ, ASSERT_LE, ASSERT_GE, EXPECT_EQ, TEST_F, TEST */ |
| 8 /* globals chrometest, TestModuleTest, waitForExtraModuleCount */ |
| 9 /* globals waitIgnoringTerminal */ |
| 10 |
7 'use strict'; | 11 'use strict'; |
8 | 12 |
9 function GdbExtensionTestModuleTest() { | 13 function GdbExtensionTestModuleTest() { |
10 TestModuleTest.call(this); | 14 TestModuleTest.call(this); |
11 this.gdbExt = null; | 15 this.gdbExt = null; |
12 } | 16 } |
13 GdbExtensionTestModuleTest.prototype = new TestModuleTest(); | 17 GdbExtensionTestModuleTest.prototype = new TestModuleTest(); |
14 | 18 |
15 GdbExtensionTestModuleTest.prototype.setUp = function() { | 19 GdbExtensionTestModuleTest.prototype.setUp = function() { |
16 var self = this; | 20 var self = this; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 }; | 122 }; |
119 | 123 |
120 /** | 124 /** |
121 * Wait for expected writes from gdb. | 125 * Wait for expected writes from gdb. |
122 * @param {Array.String} writes A list of writes to expect from GDB. | 126 * @param {Array.String} writes A list of writes to expect from GDB. |
123 * @return {Promise} A promise to wait. | 127 * @return {Promise} A promise to wait. |
124 */ | 128 */ |
125 GdbExtensionTestModuleTest.prototype.waitForGdbReply = function(lines) { | 129 GdbExtensionTestModuleTest.prototype.waitForGdbReply = function(lines) { |
126 var self = this; | 130 var self = this; |
127 function checkLine() { | 131 function checkLine() { |
128 if (lines.length == 0) { | 132 if (lines.length === 0) { |
129 return; | 133 return; |
130 } | 134 } |
131 return Promise.resolve().then(function() { | 135 return Promise.resolve().then(function() { |
132 return self.gdbExt.wait(); | 136 return self.gdbExt.wait(); |
133 }).then(function(msg) { | 137 }).then(function(msg) { |
134 ASSERT_EQ('message', msg.name, 'expecting a message'); | 138 ASSERT_EQ('message', msg.name, 'expecting a message'); |
135 var prefix = msg.data.slice(0, 3); | 139 var prefix = msg.data.slice(0, 3); |
136 var data = msg.data.slice(3); | 140 var data = msg.data.slice(3); |
137 EXPECT_EQ('gdb', prefix, 'expected gdb term message'); | 141 EXPECT_EQ('gdb', prefix, 'expected gdb term message'); |
138 EXPECT_EQ(lines[0], data, 'expect matching line'); | 142 EXPECT_EQ(lines[0], data, 'expect matching line'); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return chrometest.proxyExtension('Native Client GDB'); | 343 return chrometest.proxyExtension('Native Client GDB'); |
340 }).then(function(gdbExt) { | 344 }).then(function(gdbExt) { |
341 self.gdbExt = gdbExt; | 345 self.gdbExt = gdbExt; |
342 self.gdbExt.postMessage({name: 'installCheck'}); | 346 self.gdbExt.postMessage({name: 'installCheck'}); |
343 return self.gdbExt.wait(); | 347 return self.gdbExt.wait(); |
344 }).then(function(msg) { | 348 }).then(function(msg) { |
345 EXPECT_EQ('installCheckReply', msg.name, 'we are installed'); | 349 EXPECT_EQ('installCheckReply', msg.name, 'we are installed'); |
346 self.gdbExt.disconnect(); | 350 self.gdbExt.disconnect(); |
347 }); | 351 }); |
348 }); | 352 }); |
OLD | NEW |