示例#1
0
    def testParseCache_001(self):
        """Test Firefox 28 cache file _CACHE_001_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', '_CACHE_001_'], parser)

        self.assertEqual(storage_writer.number_of_events, 1665)

        events = list(storage_writer.GetEvents())

        event = events[3]
        self.assertEqual(event.url,
                         'HTTP:http://start.ubuntu.com/12.04/sprite.png')

        expected_timestamp = timelib.Timestamp.CopyFromString(
            '2014-04-21 14:13:35')
        self.assertEqual(event.timestamp, expected_timestamp)

        expected_message = ('Fetched 2 time(s) '
                            '[HTTP/1.0 200 OK] GET '
                            '"HTTP:http://start.ubuntu.com/12.04/sprite.png"')
        expected_short_message = (
            '[HTTP/1.0 200 OK] GET '
            '"HTTP:http://start.ubuntu.com/12.04/sprite.png"')

        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)

        self._VerifyMajorMinor(events)
示例#2
0
    def testParseCache_002(self):
        """Test Firefox 28 cache file _CACHE_002_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', '_CACHE_002_'], parser)

        expected_url = (
            'HTTP:http://www.google-analytics.com/__utm.gif?utmwv=5.5.0&utms='
            '1&utmn=1106893631&utmhn=www.dagbladet.no&utmcs=windows-1252&ut'
            'msr=1920x1080&utmvp=1430x669&utmsc=24-bit&utmul=en-us&utmje=0&'
            'utmfl=-&utmdt=Dagbladet.no%20-%20forsiden&utmhid=460894302&utm'
            'r=-&utmp=%2F&utmht=1398089458997&utmac=UA-3072159-1&utmcc=__ut'
            'ma%3D68537988.718312608.1398089459.1398089459.1398089459.1%3B%'
            '2B__utmz%3D68537988.1398089459.1.1.utmcsr%3D(direct)%7Cutmccn'
            '%3D(direct)%7Cutmcmd%3D(none)%3B&aip=1&utmu=qBQ~')

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 141)

        events = list(storage_writer.GetEvents())

        event = events[5]

        self.assertEqual(event.url, expected_url)

        event = events[1]

        self.CheckTimestamp(event.timestamp, '2014-04-21 14:10:58.000000')

        for event in events:
            self.assertEqual(event.version, "1.19")
示例#3
0
  def testParseLegacyCache_001(self):
    """Test Firefox 3 cache file _CACHE_001_ parsing."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox3', '_CACHE_001_'], parser)

    self.assertEqual(storage_writer.number_of_events, 73)

    events = list(storage_writer.GetEvents())

    event = events[0]

    expected_timestamp = timelib.Timestamp.CopyFromString(
        '2014-05-02 14:15:03')
    self.assertEqual(event.timestamp, expected_timestamp)

    expected_message = (
        'Fetched 1 time(s) '
        '[HTTP/1.1 200 OK] GET '
        '"HTTP:http://start.mozilla.org/en-US/"')
    expected_short_message = (
        '[HTTP/1.1 200 OK] GET '
        '"HTTP:http://start.mozilla.org/en-US/"')

    self._TestGetMessageStrings(
        event, expected_message, expected_short_message)
示例#4
0
    def testParseCache_003(self):
        """Test Firefox 28 cache file _CACHE_003_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', '_CACHE_003_'], parser)

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 9)

        events = list(storage_writer.GetEvents())

        expected_url = (
            'HTTP:https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/'
            'jquery.min.js')

        expected_event_values = {
            'data_type': 'firefox:cache:record',
            'timestamp': '2014-04-21 14:11:07.000000',
            'url': expected_url
        }

        self.CheckEventValues(storage_writer, events[7], expected_event_values)

        for event in events:
            event_data = self._GetEventDataOfEvent(storage_writer, event)
            self.assertEqual(event_data.version, '1.19')
示例#5
0
    def testParseCache_002(self):
        """Test Firefox 28 cache file _CACHE_002_ parsing."""
        parser_object = firefox_cache.FirefoxCacheParser()

        test_file = self._GetTestFilePath(
            [u'firefox_cache', u'firefox28', u'_CACHE_002_'])

        event_queue_consumer = self._ParseFile(parser_object, test_file)
        event_objects = self._GetEventObjectsFromQueue(event_queue_consumer)

        expected_url = (
            u'HTTP:http://www.google-analytics.com/__utm.gif?utmwv=5.5.0&utms='
            u'1&utmn=1106893631&utmhn=www.dagbladet.no&utmcs=windows-1252&ut'
            u'msr=1920x1080&utmvp=1430x669&utmsc=24-bit&utmul=en-us&utmje=0&'
            u'utmfl=-&utmdt=Dagbladet.no%20-%20forsiden&utmhid=460894302&utm'
            u'r=-&utmp=%2F&utmht=1398089458997&utmac=UA-3072159-1&utmcc=__ut'
            u'ma%3D68537988.718312608.1398089459.1398089459.1398089459.1%3B%'
            u'2B__utmz%3D68537988.1398089459.1.1.utmcsr%3D(direct)%7Cutmccn'
            u'%3D(direct)%7Cutmcmd%3D(none)%3B&aip=1&utmu=qBQ~')

        self.assertEquals(141, len(event_objects))
        self.assertEquals(event_objects[5].url, expected_url)

        expected_timestamp = timelib.Timestamp.CopyFromString(
            u'2014-04-21 14:10:58')
        self.assertEquals(event_objects[1].timestamp, expected_timestamp)

        self.VerifyMajorMinor(event_objects)
示例#6
0
  def testParseLegacyCache_001(self):
    """Test Firefox 3 cache file _CACHE_001_ parsing."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox3', '_CACHE_001_'], parser)

    self.assertEqual(storage_writer.number_of_warnings, 0)
    self.assertEqual(storage_writer.number_of_events, 73)

    events = list(storage_writer.GetEvents())

    event = events[0]

    self.CheckTimestamp(event.timestamp, '2014-05-02 14:15:03.000000')

    event_data = self._GetEventDataOfEvent(storage_writer, event)

    expected_message = (
        'Fetched 1 time(s) '
        '[HTTP/1.1 200 OK] GET '
        '"HTTP:http://start.mozilla.org/en-US/"')
    expected_short_message = (
        '[HTTP/1.1 200 OK] GET '
        '"HTTP:http://start.mozilla.org/en-US/"')

    self._TestGetMessageStrings(
        event_data, expected_message, expected_short_message)
示例#7
0
  def testParseAlternativeFilename(self):
    """Test Firefox 28 cache 003 file with alternative filename."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox28', 'E8D65m01'], parser)

    self.assertEqual(storage_writer.number_of_events, 9)
示例#8
0
    def testParseLegacyCache_003(self):
        """Test Firefox 3 cache file _CACHE_003_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox3', '_CACHE_003_'], parser)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 6)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'data_type': 'firefox:cache:record',
            'date_time': '2014-05-02 14:15:07'
        }

        self.CheckEventValues(storage_writer, events[3], expected_event_values)
示例#9
0
    def testParseCache_001(self):
        """Test Firefox 28 cache file _CACHE_001_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', '_CACHE_001_'], parser)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 1668)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'data_type': 'firefox:cache:record',
            'date_time': '2014-04-21 14:13:35',
            'fetch_count': 2,
            'request_method': 'GET',
            'response_code': 'HTTP/1.0 200 OK',
            'url': 'HTTP:http://start.ubuntu.com/12.04/sprite.png',
            'version': '1.19'
        }

        self.CheckEventValues(storage_writer, events[3], expected_event_values)
示例#10
0
    def testParseCache_InvalidFile(self):
        """Verify that parser do not accept small, invalid files."""
        parser = firefox_cache.FirefoxCacheParser()
        path_segments = ['firefox_cache', 'invalid_file']

        with self.assertRaises(errors.UnableToParseFile):
            self._ParseFile(path_segments, parser)
示例#11
0
    def testParseLegacyCache_001(self):
        """Test Firefox 3 cache file _CACHE_001_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox3', '_CACHE_001_'], parser)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 73)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'data_type': 'firefox:cache:record',
            'date_time': '2014-05-02 14:15:03',
            'request_method': 'GET',
            'response_code': 'HTTP/1.1 200 OK',
            'url': 'HTTP:http://start.mozilla.org/en-US/'
        }

        self.CheckEventValues(storage_writer, events[0], expected_event_values)
示例#12
0
    def testParseCache_003(self):
        """Test Firefox 28 cache file _CACHE_003_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', '_CACHE_003_'], parser)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 9)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'data_type':
            'firefox:cache:record',
            'date_time':
            '2014-04-21 14:11:07',
            'url': ('HTTP:https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/'
                    'jquery.min.js')
        }

        self.CheckEventValues(storage_writer, events[7], expected_event_values)

        for event in events:
            event_data = self._GetEventDataOfEvent(storage_writer, event)
            self.assertEqual(event_data.version, '1.19')
示例#13
0
    def testParseCache_001(self):
        """Test Firefox 28 cache file _CACHE_001_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', '_CACHE_001_'], parser)

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 1668)

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'timestamp': '2014-04-21 14:13:35.000000',
            'url': 'HTTP:http://start.ubuntu.com/12.04/sprite.png'
        }

        self.CheckEventValues(storage_writer, events[3], expected_event_values)

        expected_message = ('Fetched 2 time(s) '
                            '[HTTP/1.0 200 OK] GET '
                            '"HTTP:http://start.ubuntu.com/12.04/sprite.png"')
        expected_short_message = (
            '[HTTP/1.0 200 OK] GET '
            '"HTTP:http://start.ubuntu.com/12.04/sprite.png"')

        event_data = self._GetEventDataOfEvent(storage_writer, events[3])
        self._TestGetMessageStrings(event_data, expected_message,
                                    expected_short_message)

        for event in events:
            event_data = self._GetEventDataOfEvent(storage_writer, event)
            self.assertEqual(event_data.version, '1.19')
示例#14
0
    def testParseCache_001(self):
        """Test Firefox 28 cache file _CACHE_001_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', '_CACHE_001_'], parser)

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 1668)

        events = list(storage_writer.GetEvents())

        event = events[3]

        self.CheckTimestamp(event.timestamp, '2014-04-21 14:13:35.000000')

        self.assertEqual(event.url,
                         'HTTP:http://start.ubuntu.com/12.04/sprite.png')

        expected_message = ('Fetched 2 time(s) '
                            '[HTTP/1.0 200 OK] GET '
                            '"HTTP:http://start.ubuntu.com/12.04/sprite.png"')
        expected_short_message = (
            '[HTTP/1.0 200 OK] GET '
            '"HTTP:http://start.ubuntu.com/12.04/sprite.png"')

        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)

        for event in events:
            self.assertEqual(event.version, "1.19")
示例#15
0
  def testParseCache_002(self):
    """Test Firefox 28 cache file _CACHE_002_ parsing."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox28', '_CACHE_002_'], parser)

    self.assertEqual(storage_writer.number_of_events, 141)
    self.assertEqual(storage_writer.number_of_extraction_warnings, 0)
    self.assertEqual(storage_writer.number_of_recovery_warnings, 0)

    events = list(storage_writer.GetEvents())

    expected_event_values = {
        'data_type': 'firefox:cache:record',
        'url': (
            'HTTP:http://www.google-analytics.com/__utm.gif?utmwv=5.5.0&utms='
            '1&utmn=1106893631&utmhn=www.dagbladet.no&utmcs=windows-1252&ut'
            'msr=1920x1080&utmvp=1430x669&utmsc=24-bit&utmul=en-us&utmje=0&'
            'utmfl=-&utmdt=Dagbladet.no%20-%20forsiden&utmhid=460894302&utm'
            'r=-&utmp=%2F&utmht=1398089458997&utmac=UA-3072159-1&utmcc=__ut'
            'ma%3D68537988.718312608.1398089459.1398089459.1398089459.1%3B%'
            '2B__utmz%3D68537988.1398089459.1.1.utmcsr%3D(direct)%7Cutmccn'
            '%3D(direct)%7Cutmcmd%3D(none)%3B&aip=1&utmu=qBQ~')}

    self.CheckEventValues(storage_writer, events[5], expected_event_values)

    expected_event_values = {
        'data_type': 'firefox:cache:record',
        'date_time': '2014-04-21 14:10:58'}

    self.CheckEventValues(storage_writer, events[1], expected_event_values)

    for event in events:
      event_data = self._GetEventDataOfEvent(storage_writer, event)
      self.assertEqual(event_data.version, '1.19')
示例#16
0
    def testParseCache_001(self):
        """Test Firefox 28 cache file _CACHE_001_ parsing."""
        parser_object = firefox_cache.FirefoxCacheParser()

        test_file = self._GetTestFilePath(
            [u'firefox_cache', u'firefox28', u'_CACHE_001_'])

        event_queue_consumer = self._ParseFile(parser_object, test_file)
        event_objects = self._GetEventObjectsFromQueue(event_queue_consumer)

        self.assertEquals(1665, len(event_objects))
        self.assertEquals(event_objects[3].url,
                          u'HTTP:http://start.ubuntu.com/12.04/sprite.png')

        self.assertEquals(
            event_objects[3].timestamp,
            timelib.Timestamp.CopyFromString(u'2014-04-21 14:13:35'))

        self.VerifyMajorMinor(event_objects)

        expected_msg = (u'Fetched 2 time(s) '
                        u'[HTTP/1.0 200 OK] GET '
                        u'"HTTP:http://start.ubuntu.com/12.04/sprite.png"')
        expected_msg_short = (
            u'[HTTP/1.0 200 OK] GET '
            u'"HTTP:http://start.ubuntu.com/12.04/sprite.png"')

        self._TestGetMessageStrings(event_objects[3], expected_msg,
                                    expected_msg_short)
示例#17
0
    def testParseCache_InvalidFile(self):
        """Verify that parser do not accept small, invalid files."""
        parser_object = firefox_cache.FirefoxCacheParser()

        test_file = self._GetTestFilePath([u'firefox_cache', u'invalid_file'])

        with self.assertRaises(errors.UnableToParseFile):
            self._ParseFile(parser_object, test_file)
示例#18
0
    def testParseAlternativeFilename(self):
        """Test Firefox 28 cache 003 file with alternative filename."""
        parser_object = firefox_cache.FirefoxCacheParser()

        test_file = self._GetTestFilePath(
            [u'firefox_cache', u'firefox28', u'E8D65m01'])

        event_queue_consumer = self._ParseFile(parser_object, test_file)
        event_objects = self._GetEventObjectsFromQueue(event_queue_consumer)

        self.assertEquals(9, len(event_objects))
示例#19
0
  def testParseLegacyCache_003(self):
    """Test Firefox 3 cache file _CACHE_003_ parsing."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox3', '_CACHE_003_'], parser)

    self.assertEqual(storage_writer.number_of_events, 6)

    events = list(storage_writer.GetEvents())

    event = events[3]

    self.CheckTimestamp(event.timestamp, '2014-05-02 14:15:07.000000')
示例#20
0
    def testParseLegacyCache_003(self):
        """Test Firefox 3 cache file _CACHE_003_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox3', '_CACHE_003_'], parser)

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 6)

        events = list(storage_writer.GetEvents())

        expected_event_values = {'timestamp': '2014-05-02 14:15:07.000000'}

        self.CheckEventValues(storage_writer, events[3], expected_event_values)
示例#21
0
    def testParseLegacyCache_003(self):
        """Test Firefox 3 cache file _CACHE_003_ parsing."""
        parser_object = firefox_cache.FirefoxCacheParser()

        test_file = self._GetTestFilePath(
            [u'firefox_cache', u'firefox3', u'_CACHE_003_'])

        event_queue_consumer = self._ParseFile(parser_object, test_file)
        event_objects = self._GetEventObjectsFromQueue(event_queue_consumer)

        self.assertEquals(6, len(event_objects))

        self.assertEquals(
            event_objects[3].timestamp,
            timelib.Timestamp.CopyFromString(u'2014-05-02 14:15:07'))
示例#22
0
    def testParseLegacyCache_003(self):
        """Test Firefox 3 cache file _CACHE_003_ parsing."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox3', '_CACHE_003_'], parser)

        self.assertEqual(storage_writer.number_of_events, 6)

        events = list(storage_writer.GetEvents())

        event = events[3]

        expected_timestamp = timelib.Timestamp.CopyFromString(
            '2014-05-02 14:15:07')
        self.assertEqual(event.timestamp, expected_timestamp)
示例#23
0
  def testParseLegacyCache_002(self):
    """Test Firefox 3 cache file _CACHE_002_ parsing."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox3', '_CACHE_002_'], parser)

    self.assertEqual(storage_writer.number_of_events, 6)
    self.assertEqual(storage_writer.number_of_extraction_warnings, 0)
    self.assertEqual(storage_writer.number_of_recovery_warnings, 0)

    events = list(storage_writer.GetEvents())

    expected_event_values = {
        'data_type': 'firefox:cache:record',
        'date_time': '2014-05-02 14:25:55'}

    self.CheckEventValues(storage_writer, events[2], expected_event_values)
示例#24
0
    def testParseAlternativeFilename(self):
        """Test Firefox 28 cache 003 file with alternative filename."""
        parser = firefox_cache.FirefoxCacheParser()
        storage_writer = self._ParseFile(
            ['firefox_cache', 'firefox28', 'E8D65m01'], parser)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 9)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)
示例#25
0
  def testParseCache_003(self):
    """Test Firefox 28 cache file _CACHE_003_ parsing."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox28', '_CACHE_003_'], parser)

    self.assertEqual(storage_writer.number_of_events, 9)

    events = list(storage_writer.GetEvents())

    event = events[7]
    expected_url = (
        'HTTP:https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/'
        'jquery.min.js')
    self.assertEqual(event.url, expected_url)

    self.CheckTimestamp(event.timestamp, '2014-04-21 14:11:07.000000')

    self._VerifyMajorMinor(events)
示例#26
0
    def testParseCache_003(self):
        """Test Firefox 28 cache file _CACHE_003_ parsing."""
        parser_object = firefox_cache.FirefoxCacheParser()

        test_file = self._GetTestFilePath(
            [u'firefox_cache', u'firefox28', u'_CACHE_003_'])

        event_queue_consumer = self._ParseFile(parser_object, test_file)
        event_objects = self._GetEventObjectsFromQueue(event_queue_consumer)

        self.assertEquals(9, len(event_objects))

        expected_url = (
            u'HTTP:https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/'
            u'jquery.min.js')
        self.assertEquals(event_objects[7].url, expected_url)

        expected_timestamp = timelib.Timestamp.CopyFromString(
            u'2014-04-21 14:11:07')
        self.assertEquals(event_objects[7].timestamp, expected_timestamp)

        self.VerifyMajorMinor(event_objects)
示例#27
0
  def testParseCache_003(self):
    """Test Firefox 28 cache file _CACHE_003_ parsing."""
    parser = firefox_cache.FirefoxCacheParser()
    storage_writer = self._ParseFile(
        ['firefox_cache', 'firefox28', '_CACHE_003_'], parser)

    self.assertEqual(storage_writer.number_of_warnings, 0)
    self.assertEqual(storage_writer.number_of_events, 9)

    events = list(storage_writer.GetEvents())

    event = events[7]
    event_data = self._GetEventDataOfEvent(storage_writer, event)
    expected_url = (
        'HTTP:https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/'
        'jquery.min.js')
    self.assertEqual(event_data.url, expected_url)

    self.CheckTimestamp(event.timestamp, '2014-04-21 14:11:07.000000')

    for event in events:
      event_data = self._GetEventDataOfEvent(storage_writer, event)
      self.assertEqual(event_data.version, "1.19")
示例#28
0
    def testParseLegacyCache_001(self):
        """Test Firefox 3 cache file _CACHE_001_ parsing."""
        parser_object = firefox_cache.FirefoxCacheParser()

        test_file = self._GetTestFilePath(
            [u'firefox_cache', u'firefox3', u'_CACHE_001_'])

        event_queue_consumer = self._ParseFile(parser_object, test_file)
        event_objects = self._GetEventObjectsFromQueue(event_queue_consumer)

        self.assertEquals(73, len(event_objects))

        self.assertEquals(
            event_objects[0].timestamp,
            timelib.Timestamp.CopyFromString(u'2014-05-02 14:15:03'))

        expected_msg = (u'Fetched 1 time(s) '
                        u'[HTTP/1.1 200 OK] GET '
                        u'"HTTP:http://start.mozilla.org/en-US/"')
        expected_msg_short = (u'[HTTP/1.1 200 OK] GET '
                              u'"HTTP:http://start.mozilla.org/en-US/"')

        self._TestGetMessageStrings(event_objects[0], expected_msg,
                                    expected_msg_short)
示例#29
0
 def setUp(self):
     """Makes preparations before running an individual test."""
     self._parser = firefox_cache.FirefoxCacheParser()
示例#30
0
    def setUp(self):
        """Create parser."""

        self._parser = firefox_cache.FirefoxCacheParser()