Clean up ChunkedUpdateDrawingAreaProxy
[WebKit-https.git] / WebKitTools / Scripts / webkitpy / common / config / build_unittest.py
1 # Copyright (C) 2010 Apple Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1.  Redistributions of source code must retain the above copyright
7 #     notice, this list of conditions and the following disclaimer.
8 # 2.  Redistributions in binary form must reproduce the above copyright
9 #     notice, this list of conditions and the following disclaimer in the
10 #     documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
16 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23 import unittest
24
25 from webkitpy.common.config import build
26
27
28 class ShouldBuildTest(unittest.TestCase):
29     _should_build_tests = [
30         (["BugsSite/foo", "WebCore/bar"], ["*"]),
31         (["BugsSite/foo"], []),
32         (["JavaScriptCore/JavaScriptCore.xcodeproj/foo"], ["mac-leopard", "mac-snowleopard"]),
33         (["JavaScriptGlue/foo", "WebCore/bar"], ["*"]),
34         (["JavaScriptGlue/foo"], ["mac-leopard", "mac-snowleopard"]),
35         (["LayoutTests/foo"], ["*"]),
36         (["LayoutTests/platform/chromium-linux/foo"], ["chromium-linux"]),
37         (["LayoutTests/platform/chromium-win/fast/compact/001-expected.txt"], ["chromium-win"]),
38         (["LayoutTests/platform/mac-leopard/foo"], ["mac-leopard"]),
39         (["LayoutTests/platform/mac-snowleopard/foo"], ["mac-snowleopard", "win"]),
40         (["LayoutTests/platform/mac-wk2/Skipped"], ["mac-snowleopard", "win"]),
41         (["LayoutTests/platform/mac/foo"], ["mac-leopard", "mac-snowleopard", "win"]),
42         (["LayoutTests/platform/win-xp/foo"], ["win"]),
43         (["LayoutTests/platform/win-wk2/foo"], ["win"]),
44         (["LayoutTests/platform/win/foo"], ["win"]),
45         (["WebCore/mac/foo"], ["chromium-mac", "mac-leopard", "mac-snowleopard"]),
46         (["WebCore/win/foo"], ["chromium-win", "win"]),
47         (["WebCore/platform/graphics/gpu/foo"], ["mac-leopard", "mac-snowleopard"]),
48         (["WebCore/platform/wx/wxcode/win/foo"], []),
49         (["WebCore/rendering/RenderThemeMac.mm", "WebCore/rendering/RenderThemeMac.h"], ["mac-leopard", "mac-snowleopard"]),
50         (["WebCore/rendering/RenderThemeChromiumLinux.h"], ["chromium-linux"]),
51         (["WebCore/rendering/RenderThemeWinCE.h"], []),
52     ]
53
54     def test_should_build(self):
55         for files, platforms in self._should_build_tests:
56             # FIXME: We should test more platforms here once
57             # build._should_file_trigger_build is implemented for them.
58             for platform in ["win"]:
59                 should_build = platform in platforms or "*" in platforms
60                 self.assertEqual(build.should_build(platform, files), should_build, "%s should%s have built but did%s (files: %s)" % (platform, "" if should_build else "n't", "n't" if should_build else "", str(files)))
61
62
63 if __name__ == "__main__":
64     unittest.main()