OLD | NEW |
1 /* | 1 /* |
2 Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 Copyright (c) 2009 The Chromium 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 // Automation utilities. | 7 // Automation utilities. |
8 | 8 |
9 function Automation() { | 9 function Automation() { |
10 this.test_count = 0; | 10 this.test_count = 0; |
11 this.failures = []; | 11 this.failures = []; |
12 this.done = false; | 12 this.done = false; |
13 } | 13 } |
14 | 14 |
15 Automation.prototype.IncrementTestCount = function() { | 15 Automation.prototype.IncrementTestCount = function() { |
16 this.test_count++; | 16 this.test_count++; |
17 } | 17 } |
18 | 18 |
19 Automation.prototype.GetTestCount = function() { | 19 Automation.prototype.GetTestCount = function() { |
20 return this.test_count; | 20 return this.test_count; |
21 } | 21 } |
22 | 22 |
23 Automation.prototype.AddFailure = function(test) { | 23 Automation.prototype.AddFailure = function(test) { |
| 24 // Remove any '<!-- NOP -->' that was inserted by DOM checker. |
| 25 test = test.replace(/<!-- NOP -->/, ''); |
| 26 |
24 this.failures.push(test); | 27 this.failures.push(test); |
25 } | 28 } |
26 | 29 |
27 Automation.prototype.GetFailures = function() { | 30 Automation.prototype.GetFailures = function() { |
28 return this.failures; | 31 return this.failures; |
29 } | 32 } |
30 | 33 |
31 Automation.prototype.SetDone = function() { | 34 Automation.prototype.SetDone = function() { |
32 this.done = true; | 35 this.done = true; |
33 } | 36 } |
34 | 37 |
35 Automation.prototype.IsDone = function() { | 38 Automation.prototype.IsDone = function() { |
36 return this.done; | 39 return this.done; |
37 } | 40 } |
38 | 41 |
39 automation = new Automation(); | 42 automation = new Automation(); |
40 | 43 |
41 // Override functions that can spawn dialog boxes. | 44 // Override functions that can spawn dialog boxes. |
42 | 45 |
43 window.alert = function() {} | 46 window.alert = function() {} |
44 window.confirm = function() {} | 47 window.confirm = function() {} |
45 window.prompt = function() {} | 48 window.prompt = function() {} |
OLD | NEW |