Exemplo n.º 1
0
    def test_file_for_test(self):
        # Test that we can lookup a test's filename for various cases like
        # variants and multi-globals.
        manifest_json = '''
 {
    "items": {
        "manual": {},
        "reftest": {},
        "testharness": {
            "test.any.js": [
                "d23fbb8c66def47e31ad01aa7a311064ba8fddbd",
                ["test.any.html", {}],
                ["test.any.worker.html", {}]
            ]
        }
    }
}       '''
        host = MockHost()
        host.filesystem.write_text_file(
            WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json)
        manifest = WPTManifest(host,
                               WEB_TEST_DIR + '/external/wpt/MANIFEST.json')
        self.assertEqual(
            manifest.all_url_items(), {
                u'test.any.html': [u'test.any.html', {}],
                u'test.any.worker.html': [u'test.any.worker.html', {}]
            })
        # Ensure that we can get back to `test.any.js` from both of the tests.
        self.assertEqual(manifest.file_path_for_test_url('test.any.html'),
                         'test.any.js')
        self.assertEqual(
            manifest.file_path_for_test_url('test.any.worker.html'),
            'test.any.js')
    def test_crash_tests(self):
        # Test that the manifest recognizes crash tests and that is_crash_test
        # correctly identifies only crash tests in the manifest.
        manifest_json = '''
{
    "items": {
        "manual": {},
        "reftest": {},
        "testharness": {
            "test.html": [
                "d23fbb8c66def47e31ad01aa7a311064ba8fddbd",
                [null, {}]
            ]
        },
        "crashtest": {
            "test-crash.html": [
                "d23fbb8c66def47e31ad01aa7a311064ba8fddbd",
                [null, {}]
            ]
        }
    }
}
        '''
        manifest = WPTManifest(manifest_json)
        self.assertEqual(
            manifest.all_url_items(), {
                u'test.html': [u'test.html', {}],
                u'test-crash.html': [u'test-crash.html', {}]
            })

        self.assertTrue(manifest.is_crash_test(u'test-crash.html'))
        self.assertFalse(manifest.is_crash_test(u'test.html'))
        self.assertFalse(manifest.is_crash_test(u'different-test-crash.html'))
Exemplo n.º 3
0
    def test_file_for_test(self):
        # Test that we can lookup a test's filename for various cases like
        # variants and multi-globals.
        manifest_json = '''
 {
    "items": {
        "manual": {},
        "reftest": {},
        "testharness": {
            "test.any.js": [
                ["/test.any.html", {}],
                ["/test.any.worker.html", {}]
            ]
        }
    }
}       '''
        manifest = WPTManifest(manifest_json)
        self.assertEqual(
            manifest.all_url_items(), {
                u'/test.any.html': [u'/test.any.html', {}],
                u'/test.any.worker.html': [u'/test.any.worker.html', {}]
            })
        # Ensure that we can get back to `test.any.js` from both of the tests.
        self.assertEqual(manifest.file_path_for_test_url('/test.any.html'),
                         'test.any.js')
        self.assertEqual(
            manifest.file_path_for_test_url('/test.any.worker.html'),
            'test.any.js')
Exemplo n.º 4
0
    def test_does_not_throw_when_missing_some_test_types(self):
        manifest_json = '''
{
    "items": {
        "testharness": {
            "test.any.js": [
                ["/test.any.html", {}]
            ]
        }
    }
}
        '''
        manifest = WPTManifest(manifest_json)
        self.assertTrue(manifest.is_test_file('test.any.js'))
        self.assertEqual(manifest.all_url_items(),
                         {u'/test.any.html': [u'/test.any.html', {}]})
        self.assertEqual(manifest.extract_reference_list('/foo/bar.html'), [])
Exemplo n.º 5
0
    def test_all_url_items_skips_jsshell_tests(self):
        manifest_json = '''
{
    "items": {
        "manual": {},
        "reftest": {},
        "testharness": {
            "test.any.js": [
                ["/test.any.html", {}],
                ["/test.any.js", {"jsshell": true}]
            ]
        }
    }
}
        '''
        manifest = WPTManifest(manifest_json)
        self.assertEqual(manifest.all_url_items(),
                         {u'/test.any.html': [u'/test.any.html', {}]})
    def test_all_url_items_skips_jsshell_tests(self):
        manifest_json = '''
{
    "items": {
        "manual": {},
        "reftest": {},
        "testharness": {
            "test.any.js": [
                "d23fbb8c66def47e31ad01aa7a311064ba8fddbd",
                ["test.any.html", {}],
                [null, {"jsshell": true}]
            ]
        }
    }
}
        '''
        manifest = WPTManifest(manifest_json)
        self.assertEqual(manifest.all_url_items(),
                         {u'test.any.html': [u'test.any.html', {}]})
Exemplo n.º 7
0
    def test_does_not_throw_when_missing_some_test_types(self):
        manifest_json = '''
{
    "items": {
        "testharness": {
            "test.any.js": [
                "8d4b9a583f484741f4cd4e4940833a890c612656",
                ["test.any.html", {}]
            ]
        }
    }
}
        '''
        host = MockHost()
        host.filesystem.write_text_file(
            WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json)
        manifest = WPTManifest(host,
                               WEB_TEST_DIR + '/external/wpt/MANIFEST.json')
        self.assertTrue(manifest.is_test_file('test.any.js'))
        self.assertEqual(manifest.all_url_items(),
                         {u'test.any.html': [u'test.any.html', {}]})
        self.assertEqual(manifest.extract_reference_list('/foo/bar.html'), [])
Exemplo n.º 8
0
    def test_all_url_items_skips_jsshell_tests(self):
        manifest_json = '''
{
    "items": {
        "manual": {},
        "reftest": {},
        "testharness": {
            "test.any.js": [
                "d23fbb8c66def47e31ad01aa7a311064ba8fddbd",
                ["test.any.html", {}],
                [null, {"jsshell": true}]
            ]
        }
    }
}
        '''
        host = MockHost()
        host.filesystem.write_text_file(
            WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json)
        manifest = WPTManifest(host,
                               WEB_TEST_DIR + '/external/wpt/MANIFEST.json')
        self.assertEqual(manifest.all_url_items(),
                         {u'test.any.html': [u'test.any.html', {}]})
Exemplo n.º 9
0
    def test_crash_tests(self):
        # Test that the manifest recognizes crash tests and that is_crash_test
        # correctly identifies only crash tests in the manifest.
        manifest_json = '''
{
    "items": {
        "manual": {},
        "reftest": {},
        "testharness": {
            "test.html": [
                "d23fbb8c66def47e31ad01aa7a311064ba8fddbd",
                [null, {}]
            ]
        },
        "crashtest": {
            "test-crash.html": [
                "d23fbb8c66def47e31ad01aa7a311064ba8fddbd",
                [null, {}]
            ]
        }
    }
}
        '''
        host = MockHost()
        host.filesystem.write_text_file(
            WEB_TEST_DIR + '/external/wpt/MANIFEST.json', manifest_json)
        manifest = WPTManifest(host,
                               WEB_TEST_DIR + '/external/wpt/MANIFEST.json')
        self.assertEqual(
            manifest.all_url_items(), {
                u'test.html': [u'test.html', {}],
                u'test-crash.html': [u'test-crash.html', {}]
            })

        self.assertTrue(manifest.is_crash_test(u'test-crash.html'))
        self.assertFalse(manifest.is_crash_test(u'test.html'))
        self.assertFalse(manifest.is_crash_test(u'different-test-crash.html'))