'Test that downloading the Firefox history works.'

def testFirefoxHistoryFetch(self):

    for s in flow_test_lib.TestFlowHelper(webhistory.FirefoxHistory.__name__, self.client_mock, check_flow_errors=False, client_id=self.client_id, username='test', token=self.token, pathtype=rdf_paths.PathSpec.PathType.TSK):
        session_id = s
    fs_path = '/home/test/.mozilla/firefox/adts404t.default/places.sqlite'
    output_path = self.client_id.Add('fs/tsk').Add('/'.join([self.base_path.replace('\\', '/'), 'test_img.dd'])).Add(fs_path.replace('\\', '/'))
    fd = aff4.FACTORY.Open(output_path, token=self.token)
    self.assertTrue((fd.size > 20000))
    self.assertEqual(fd.read(15), 'SQLite    format    3')
    fd = flow.GRRFlow.ResultCollectionForFID(session_id, token=self.token)
    self.assertGreater(len(fd), 3)
    data = '\n'.join([utils.SmartStr(x) for x in fd.GenerateItems()])
    self.assertTrue((data.find('Welcome    to    Firefox') != (-1)))
    self.assertTrue((data.find('sport.orf.at') != (-1)))
