Changeset 69040 in webkit
- Timestamp:
- Oct 4, 2010 3:11:10 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r69036 r69040 1 2010-10-04 Dirk Pranke <dpranke@chromium.org> 2 3 Reviewed by Tony Chang. 4 5 Add a way for us to have test expectations that are specific to the 6 official builds of Google Chrome (as opposed to Chromium). This change 7 looks for an additional "test_expectations_chrome.txt" file in 8 Chromium's repository (webkit/tools/layout_tests), and uses the 9 concatenation of that file and the regular test_expectations.txt 10 file for test overrides. 11 12 https://bugs.webkit.org/show_bug.cgi?id=46854 13 14 * Scripts/webkitpy/layout_tests/port/google_chrome.py: 15 * Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py: 16 1 17 2010-10-04 Simon Fraser <simon.fraser@apple.com> 2 18 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome.py
r68008 r69040 25 25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 26 27 import codecs 28 import os 29 30 31 def _test_expectations_overrides(port, super): 32 # The chrome ports use the regular overrides plus anything in the 33 # official test_expectations as well. Hopefully we don't get collisions. 34 chromium_overrides = super.test_expectations_overrides(port) 35 36 # FIXME: It used to be that AssertionError would get raised by 37 # path_from_chromium_base() if we weren't in a Chromium checkout, but 38 # this changed in r60427. This should probably be changed back. 39 overrides_path = port.path_from_chromium_base('webkit', 'tools', 40 'layout_tests', 'test_expectations_chrome.txt') 41 if not os.path.exists(overrides_path): 42 return chromium_overrides 43 44 with codecs.open(overrides_path, "r", "utf-8") as file: 45 if chromium_overrides: 46 return chromium_overrides + file.read() 47 else: 48 return file.read() 27 49 28 50 def GetGoogleChromePort(**kwargs): … … 42 64 'google-chrome-linux32')) 43 65 return paths 66 67 def test_expectations_overrides(self): 68 return _test_expectations_overrides(self, 69 chromium_linux.ChromiumLinuxPort) 70 44 71 return GoogleChromeLinux32Port(**kwargs) 45 72 elif port_name == 'google-chrome-linux64': … … 53 80 'google-chrome-linux64')) 54 81 return paths 82 83 def test_expectations_overrides(self): 84 return _test_expectations_overrides(self, 85 chromium_linux.ChromiumLinuxPort) 86 55 87 return GoogleChromeLinux64Port(**kwargs) 56 88 elif port_name.startswith('google-chrome-mac'): … … 64 96 'google-chrome-mac')) 65 97 return paths 98 99 def test_expectations_overrides(self): 100 return _test_expectations_overrides(self, 101 chromium_mac.ChromiumMacPort) 102 66 103 return GoogleChromeMacPort(**kwargs) 67 104 elif port_name.startswith('google-chrome-win'): … … 75 112 'google-chrome-win')) 76 113 return paths 114 115 def test_expectations_overrides(self): 116 return _test_expectations_overrides(self, 117 chromium_win.ChromiumWinPort) 118 77 119 return GoogleChromeWinPort(**kwargs) 78 120 raise NotImplementedError('unsupported port: %s' % port_name) -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py
r68008 r69040 25 25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 26 27 import codecs 27 28 import os 28 29 import unittest 30 31 import base_unittest 32 import factory 29 33 import google_chrome 30 34 … … 36 40 for port in test_ports: 37 41 self._verify_baseline_path(port, port) 42 self._verify_expectations_overrides(port) 38 43 39 44 self._verify_baseline_path('google-chrome-mac', 'google-chrome-mac-leopard') … … 46 51 path = port.baseline_search_path()[0] 47 52 self.assertEqual(expected_path, os.path.split(path)[1]) 53 54 def _verify_expectations_overrides(self, port_name): 55 # FIXME: make this more robust when we have the Tree() abstraction. 56 # we should be able to test for the files existing or not, and 57 # be able to control the contents better. 58 59 chromium_port = factory.get("chromium-mac") 60 chromium_overrides = chromium_port.test_expectations_overrides() 61 port = google_chrome.GetGoogleChromePort(port_name=port_name, 62 options=None) 63 64 orig_exists = os.path.exists 65 orig_open = codecs.open 66 expected_string = "// hello, world\n" 67 68 def mock_exists_chrome_not_found(path): 69 if 'test_expectations_chrome.txt' in path: 70 return False 71 return orig_exists(path) 72 73 def mock_exists_chrome_found(path): 74 if 'test_expectations_chrome.txt' in path: 75 return True 76 return orig_exists(path) 77 78 def mock_open(path, mode, encoding): 79 if 'test_expectations_chrome.txt' in path: 80 return base_unittest.NewStringIO(expected_string) 81 return orig_open(path, mode, encoding) 82 83 try: 84 os.path.exists = mock_exists_chrome_not_found 85 chrome_overrides = port.test_expectations_overrides() 86 self.assertEqual(chromium_overrides, chrome_overrides) 87 88 os.path.exists = mock_exists_chrome_found 89 codecs.open = mock_open 90 chrome_overrides = port.test_expectations_overrides() 91 self.assertEqual(chrome_overrides, 92 chromium_overrides + expected_string) 93 finally: 94 os.path.exists = orig_exists 95 codecs.open = orig_open 96 97 98 if __name__ == '__main__': 99 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.