OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 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 <link rel="import" href="../ct-failure-group.html"> | 7 <link rel="import" href="../ct-failure-group.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 (function () { | 10 (function () { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 var group = new CTFailureGroup('key', []); | 44 var group = new CTFailureGroup('key', []); |
45 group.snoozeUntil(Date.now() + 1000 * 1000).then(function() { | 45 group.snoozeUntil(Date.now() + 1000 * 1000).then(function() { |
46 group.unsnooze().then(function() { | 46 group.unsnooze().then(function() { |
47 assert.isFalse(group.isSnoozed); | 47 assert.isFalse(group.isSnoozed); |
48 done(); | 48 done(); |
49 }); | 49 }); |
50 }); | 50 }); |
51 }); | 51 }); |
52 }); | 52 }); |
53 | 53 |
| 54 describe('setBug', function() { |
| 55 it('should store the bug', function(done) { |
| 56 var group = new CTFailureGroup('key', []); |
| 57 group.setBug('123').then(function() { |
| 58 assert.equal(group.bug, 'http://crbug.com/123'); |
| 59 assert.equal(group._annotation.bug, 'http://crbug.com/123'); |
| 60 assert.equal(group.bugLabel, 'Bug 123'); |
| 61 done(); |
| 62 }); |
| 63 }); |
| 64 |
| 65 it('should support URLs', function(done) { |
| 66 var group = new CTFailureGroup('key', []); |
| 67 group.setBug('http://foobar.com/?id=876&x=y').then(function() { |
| 68 assert.equal(group.bug, 'http://foobar.com/?id=876&x=y'); |
| 69 assert.equal(group._annotation.bug, 'http://foobar.com/?id=876&x=y'); |
| 70 assert.equal(group.bugLabel, 'Bug 876'); |
| 71 done(); |
| 72 }); |
| 73 }); |
| 74 }); |
| 75 |
54 describe('annotations', function() { | 76 describe('annotations', function() { |
55 it('should have sensible defaults', function() { | 77 it('should have sensible defaults', function() { |
56 var group = new CTFailureGroup('key', []); | 78 var group = new CTFailureGroup('key', []); |
57 assert.deepEqual(group.annotation, {}); | 79 assert.deepEqual(group._annotation, {}); |
58 assert.isFalse(group.isSnoozed); | 80 assert.isFalse(group.isSnoozed); |
| 81 assert.isUndefined(group.bug); |
| 82 assert.isUndefined(group.bugLabel); |
59 }); | 83 }); |
60 | 84 |
61 it('should compute properties', function() { | 85 it('should compute properties', function() { |
62 var group = new CTFailureGroup('key', [], {snoozeTime: Date.now() + 1000 *
1000}); | 86 var group = new CTFailureGroup('key', [], {snoozeTime: Date.now() + 1000 *
1000, bug: 'http://crbug.com/123'}); |
63 assert.isTrue(group.isSnoozed); | 87 assert.isTrue(group.isSnoozed); |
| 88 assert.equal(group.bug, 'http://crbug.com/123'); |
64 }); | 89 }); |
65 | 90 |
66 it('should be persisted', function(done) { | 91 it('should be persisted', function(done) { |
67 var group = new CTFailureGroup('key', []); | 92 var group = new CTFailureGroup('key', []); |
68 group.snoozeUntil(123).then(function() { | 93 group.snoozeUntil(123).then(function() { |
69 CTFailureGroup.fetchAnnotations().then(function(annotations) { | 94 group.setBug('456').then(function() { |
70 assert.deepEqual(annotations['key'], {snoozeTime: 123}); | 95 CTFailureGroup.fetchAnnotations().then(function(annotations) { |
71 done(); | 96 assert.deepEqual(annotations['key'], {snoozeTime: 123, bug: 'http://
crbug.com/456'}); |
| 97 done(); |
| 98 }); |
72 }); | 99 }); |
73 }); | 100 }); |
74 }); | 101 }); |
75 }); | 102 }); |
76 }); | 103 }); |
77 | 104 |
78 })() | 105 })() |
79 </script> | 106 </script> |
OLD | NEW |