tools/mac/power/collapse_profile_test.py
def testStackShortening(self):
    """Tests that stacks get shortened to drop frames of low interest."""

    samples = [{
        'frames': ['foo', 'bar', 'baz'],
        'weight': 24
    }, {
        'frames': ['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun'],
        'weight':
        24
    }]

    # Stack will be shortened to remove anything before the uninteresting frame.
    shortened_samples = samples.copy()
    shortened_samples[1]["frames"] = shortened_samples[1]["frames"][2:]

    stack_collapser = StackCollapser('./samples.collapsed')
    stack_collapser.set_samples_for_testing(samples)
    stack_collapser.post_process_samples()
    self.assertEquals(shortened_samples, stack_collapser.samples)
Tests that stacks get shortened to drop frames of low interest.
Tests that stacks get shortened to drop frames of low interest.
Tests that stacks get shortened to drop frames of low interest .
def testStackShortening(self):
    samples = [{
        'frames': ['foo', 'bar', 'baz'],
        'weight': 24
    }, {
        'frames': ['foo', 'bar', 'baz', 'base::MessagePumpNSRunLoop::DoRun'],
        'weight':
        24
    }]
    shortened_samples = samples.copy()
    shortened_samples[1]["frames"] = shortened_samples[1]["frames"][2:]
    stack_collapser = StackCollapser('./samples.collapsed')
    stack_collapser.set_samples_for_testing(samples)
    stack_collapser.post_process_samples()
    self.assertEquals(shortened_samples, stack_collapser.samples)
def testStackShortening ( self ) : samples = [ { 'frames' : [ 'foo' , 'bar' , 'baz' ] , 'weight' : 24 } , { 'frames' : [ 'foo' , 'bar' , 'baz' , 'base::MessagePumpNSRunLoop::DoRun' ] , 'weight' : 24 } ] shortened_samples = samples . copy ( ) shortened_samples [ 1 ] [ "frames" ] = shortened_samples [ 1 ] [ "frames" ] [ 2 : ] stack_collapser = StackCollapser ( './samples.collapsed' ) stack_collapser . set_samples_for_testing ( samples ) stack_collapser . post_process_samples ( ) self . assertEquals ( shortened_samples , stack_collapser . samples )
Tests that stacks get shortened to drop frames of low interest.
Tests that stacks get shortened to drop frames of low interest .
"""Tests that stacks get shortened to drop frames of low interest.""" # Stack will be shortened to remove anything before the uninteresting frame.
self