def test_OOMAllocationSize_predicate_signature_fragment_3(self):
     pc = DotDict()
     pc.signature = 'CrashAtUnhandlableOOM'
     rc = DotDict()
     fake_processor = create_basic_fake_processor()
     rule = OOMSignature()
     predicate_result = rule.predicate(rc, pc, fake_processor)
     ok_(predicate_result)
 def test_OOMAllocationSize_predicate_signature_fragment_1(self):
     pc = DotDict()
     pc.signature = 'this | is | a | NS_ABORT_OOM | signature'
     rc = DotDict()
     fake_processor = create_basic_fake_processor()
     rule = OOMSignature()
     predicate_result = rule.predicate(rc, pc, fake_processor)
     ok_(predicate_result)
 def test_OOMAllocationSize_predicate_signature_fragment_2(self):
     pc = DotDict()
     pc.signature = 'mozalloc_handle_oom | this | is | bad'
     rc = DotDict()
     fake_processor = create_basic_fake_processor()
     rule = OOMSignature()
     predicate_result = rule.predicate(rc, pc, fake_processor)
     ok_(predicate_result)
 def test_OOMAllocationSize_predicate_no_match(self):
     pc = DotDict()
     pc.signature = 'hello'
     rc = DotDict()
     fake_processor = create_basic_fake_processor()
     rule = OOMSignature()
     predicate_result = rule.predicate(rc, pc, fake_processor)
     ok_(not predicate_result)
 def test_OOMAllocationSize_predicate(self):
     pc = DotDict()
     pc.signature = 'hello'
     rd = {}
     rc = DotDict()
     rc.OOMAllocationSize = 17
     fake_processor = create_basic_fake_processor()
     rule = OOMSignature(fake_processor.config)
     predicate_result = rule.predicate(rc, rd, pc, fake_processor)
     ok_(predicate_result)
    def test_OOMAllocationSize_action_success(self):
        pc = DotDict()
        pc.signature = 'hello'

        fake_processor = create_basic_fake_processor()

        rc = DotDict()

        rule = OOMSignature()
        action_result = rule.action(rc, pc, fake_processor)

        ok_(action_result)
        ok_(pc.original_signature, 'hello')
        ok_(pc.signature, 'OOM | unknown | hello')
    def test_action_large(self):
        pc = DotDict()
        pc.signature = 'hello'

        fake_processor = create_basic_fake_processor()

        rc = DotDict()
        rc.OOMAllocationSize = 17000000

        rule = OOMSignature()
        action_result = rule.action(rc, pc, fake_processor)

        ok_(action_result)
        ok_(pc.original_signature, 'hello')
        ok_(pc.signature, 'OOM | large | hello')
    def test_OOMAllocationSize_action_small(self):
        pc = DotDict()
        pc.signature = 'hello'

        fake_processor = create_basic_fake_processor()

        rc = DotDict()
        rc.OOMAllocationSize = 17
        rd = {}

        rule = OOMSignature(fake_processor.config)
        action_result = rule.action(rc, rd, pc, fake_processor)

        ok_(action_result)
        ok_(pc.original_signature, 'hello')
        ok_(pc.signature, 'OOM | small')