'Test L{util.FilePager}, passing a callback to fire when all pages
are sent, and verify that the pager doesn\'t keep chunks in memory.'

def test_filePagingWithCallback(self):

    (c, s, pump) = connectedServerAndClient(test=self)
    pagerizer = FilePagerizer(self.filename, finishedCallback, 'frodo', value=9)
    s.setNameForLocal('bar', pagerizer)
    x = c.remoteForName('bar')
    l = []
    util.getAllPages(x, 'getPages').addCallback(l.append)
    while (not l):
        pump.pump()
    self.assertEqual(''.join(l[0]), bigString, 'Pages    received    not    equal    to    pages    sent!')
    self.assertEqual(callbackArgs, ('frodo',), 'Completed    callback    not    invoked')
    self.assertEqual(callbackKeyword, {'value': 9}, 'Completed    callback    not    invoked')
    self.assertEqual(pagerizer.pager.chunks, [])
