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

Unified Diff: Tools/GardeningServer/model/test/ct-failure-group-tests.html

Issue 476903004: [sheriff-o-matic]: Basic trooper display for sheriff-o-matic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: Tools/GardeningServer/model/test/ct-failure-group-tests.html
diff --git a/Tools/GardeningServer/model/test/ct-failure-group-tests.html b/Tools/GardeningServer/model/test/ct-failure-group-tests.html
index f94c7eb41f117022db8aaa3186431364bb864f4e..7dbfbb3e27da348e3ccc5f241974b4b6b41174e2 100644
--- a/Tools/GardeningServer/model/test/ct-failure-group-tests.html
+++ b/Tools/GardeningServer/model/test/ct-failure-group-tests.html
@@ -26,19 +26,20 @@ describe('ct-failure-group', function() {
describe('category', function() {
it('should be "default" by default', function() {
- var group = new CTFailureGroup([], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([], undefined));
assert.equal(group.category, 'default');
});
it('should be "snoozed" when snoozed', function() {
- var group = new CTFailureGroup([newFailureWithAnnotation({snoozeTime: Date.now() + 1000 * 1000})], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData(
+ [newFailureWithAnnotation({snoozeTime: Date.now() + 1000 * 1000})], undefined));
assert.equal(group.category, 'snoozed');
});
});
describe('snooze', function() {
it('should set isSnoozed', function(done) {
- var group = new CTFailureGroup([newFailureWithAnnotation()], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([newFailureWithAnnotation()], undefined));
group.snoozeUntil(Date.now() + 1000 * 1000).then(function() {
assert.isTrue(group.isSnoozed);
done();
@@ -48,7 +49,7 @@ describe('ct-failure-group', function() {
describe('unsnooze', function() {
it('should clear isSnoozed', function(done) {
- var group = new CTFailureGroup([newFailureWithAnnotation()], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([newFailureWithAnnotation()], undefined));
group.snoozeUntil(Date.now() + 1000 * 1000).then(function() {
group.unsnooze().then(function() {
assert.isFalse(group.isSnoozed);
@@ -60,7 +61,7 @@ describe('ct-failure-group', function() {
describe('setBug', function() {
it('should store the bug', function(done) {
- var group = new CTFailureGroup([newFailureWithAnnotation()], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([newFailureWithAnnotation()], undefined));
group.setBug('123').then(function() {
assert.equal(group.bug, 'http://crbug.com/123');
assert.equal(group._annotation.bug, 'http://crbug.com/123');
@@ -70,7 +71,7 @@ describe('ct-failure-group', function() {
});
it('should support URLs', function(done) {
- var group = new CTFailureGroup([newFailureWithAnnotation()], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([newFailureWithAnnotation()], undefined));
group.setBug('http://foobar.com/?id=876&x=y').then(function() {
assert.equal(group.bug, 'http://foobar.com/?id=876&x=y');
assert.equal(group._annotation.bug, 'http://foobar.com/?id=876&x=y');
@@ -82,7 +83,7 @@ describe('ct-failure-group', function() {
describe('clearBug', function() {
it('should work', function(done) {
- var group = new CTFailureGroup([], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([], undefined));
group.setBug('123').then(function() {
group.clearBug().then(function() {
assert.isUndefined(group.bug);
@@ -96,7 +97,7 @@ describe('ct-failure-group', function() {
describe('annotations', function() {
it('should have sensible defaults', function() {
- var group = new CTFailureGroup([], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([], undefined));
assert.deepEqual(group._annotation, {});
assert.isFalse(group.isSnoozed);
assert.isUndefined(group.bug);
@@ -104,41 +105,41 @@ describe('ct-failure-group', function() {
});
it('should compute properties', function() {
- var group = new CTFailureGroup([newFailureWithAnnotation(
- {snoozeTime: Date.now() + 1000 * 1000, bug: 'http://crbug.com/123'})], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData([newFailureWithAnnotation(
+ {snoozeTime: Date.now() + 1000 * 1000, bug: 'http://crbug.com/123'})], undefined));
assert.isTrue(group.isSnoozed);
assert.equal(group.bug, 'http://crbug.com/123');
});
it('should ignore snoozeTime unless it is present on all alerts', function() {
- var notSnoozedMultipleAlerts = new CTFailureGroup([
+ var notSnoozedMultipleAlerts = new CTFailureGroup(new CTSheriffFailureGroupData([
new CTFailure('step', 'reason', [
{key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
{key: 'b',},
], undefined)
- ]);
- var notSnoozedMultipleFailures = new CTFailureGroup([
+ ]));
+ var notSnoozedMultipleFailures = new CTFailureGroup(new CTSheriffFailureGroupData([
new CTFailure('step', 'reason', [
{key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
]),
new CTFailure('step', 'reason', [
{key: 'b'},
]),
- ], undefined);
- var snoozedMultipleAlerts = new CTFailureGroup([
+ ], undefined));
+ var snoozedMultipleAlerts = new CTFailureGroup(new CTSheriffFailureGroupData([
new CTFailure('step', 'reason', [
{key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
{key: 'b', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
])
- ], undefined);
- var snoozedMultipleFailures = new CTFailureGroup([
+ ], undefined));
+ var snoozedMultipleFailures = new CTFailureGroup(new CTSheriffFailureGroupData([
new CTFailure('step', 'reason', [
{key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
]),
new CTFailure('step', 'reason', [
{key: 'b', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
]),
- ], undefined);
+ ], undefined));
assert.isFalse(notSnoozedMultipleAlerts.isSnoozed);
assert.isFalse(notSnoozedMultipleFailures.isSnoozed);
assert.isTrue(snoozedMultipleAlerts.isSnoozed);
@@ -149,23 +150,24 @@ describe('ct-failure-group', function() {
var timeFuture = Date.now() + 1000 * 1000;
var timePast = Date.now() - 1000 * 1000;
- var notSnoozed = new CTFailureGroup([
+ var notSnoozed = new CTFailureGroup(new CTSheriffFailureGroupData([
new CTFailure('step', 'reason', [
{key: 'a', annotation: {snoozeTime: timeFuture}},
{key: 'b', annotation: {snoozeTime: timePast}},
])
- ], undefined);
+ ], undefined));
assert.isFalse(notSnoozed.isSnoozed);
});
it('should be persisted', function(done) {
- var group = new CTFailureGroup([newFailureWithAnnotation(), newFailureWithAnnotation()], undefined);
+ var group = new CTFailureGroup(new CTSheriffFailureGroupData(
+ [newFailureWithAnnotation(), newFailureWithAnnotation()], undefined));
group.snoozeUntil(123).then(function() {
group.setBug('456').then(function() {
CTFailureGroup.fetchAnnotations().then(function(annotations) {
- assert.deepEqual(annotations[group.failures[0].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
- assert.deepEqual(annotations[group.failures[1].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
+ assert.deepEqual(annotations[group.data.failures[0].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
+ assert.deepEqual(annotations[group.data.failures[1].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
done();
});
});

Powered by Google App Engine
This is Rietveld 408576698