blob: 9b95854c46c876d7a1d84e851eb3819de87a9c92 [file] [log] [blame]
# coding=utf8
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A verifier that does nothing."""
from verification import base
def failed_message():
return 'FakeVerifier FAILED'
class FakeVerifier(base.Verifier):
name = 'fake'
def __init__(self, state):
super(FakeVerifier, self).__init__()
self.state = state
def verify(self, pending):
fake = base.SimpleStatus(self.state)
# Make sure to leave a message, so CQ tests can reliably test for it.
if self.state == base.FAILED:
fake.error_message = failed_message()
pending.verifications[self.name] = fake
def update_status(self, queue):
pass
class DeferredFakeVerifier(base.Verifier):
name = 'fake'
def __init__(self, state, delay):
super(DeferredFakeVerifier, self).__init__()
self.state = state
self.delay = delay
def verify(self, pending):
pending.verifications[self.name] = base.SimpleStatus()
def update_status(self, queue):
if self.delay:
self.delay -= 1
return
for _, fake in self.loop(queue, base.SimpleStatus, True):
fake.state = self.state
# Make sure to leave a message, so CQ tests can reliably test for it.
if self.state == base.FAILED:
fake.error_message = failed_message()