diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-09 14:22:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-05-09 15:11:45 +0000 |
commit | 2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch) | |
tree | e75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/tools/bisect_test.py | |
parent | a4f3d46271c57e8155ba912df46a05559d14726e (diff) | |
download | qtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz |
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion.
Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/tools/bisect_test.py')
-rw-r--r-- | chromium/tools/bisect_test.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/chromium/tools/bisect_test.py b/chromium/tools/bisect_test.py new file mode 100644 index 00000000000..b970f84e36d --- /dev/null +++ b/chromium/tools/bisect_test.py @@ -0,0 +1,53 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import unittest + +bisect_builds = __import__('bisect-builds') + + +class BisectTest(unittest.TestCase): + + patched = [] + max_rev = 10000 + + def monkey_patch(self, obj, name, new): + self.patched.append((obj, name, getattr(obj, name))) + setattr(obj, name, new) + + def clear_patching(self): + for obj, name, old in self.patched: + setattr(obj, name, old) + self.patched = [] + + def setUp(self): + self.monkey_patch(bisect_builds.DownloadJob, 'Start', lambda *args: None) + self.monkey_patch(bisect_builds.DownloadJob, 'Stop', lambda *args: None) + self.monkey_patch(bisect_builds.DownloadJob, 'WaitFor', lambda *args: None) + self.monkey_patch(bisect_builds, 'RunRevision', lambda *args: (0, "", "")) + self.monkey_patch(bisect_builds.PathContext, 'ParseDirectoryIndex', + lambda *args: range(self.max_rev)) + + def tearDown(self): + self.clear_patching() + + def bisect(self, good_rev, bad_rev, evaluate): + return bisect_builds.Bisect(good_rev=good_rev, + bad_rev=bad_rev, + evaluate=evaluate, + num_runs=1, + official_builds=False, + platform='linux', + profile=None, + try_args=()) + + def testBisectConsistentAnswer(self): + self.assertEqual(self.bisect(1000, 100, lambda *args: 'g'), (100, 101)) + self.assertEqual(self.bisect(100, 1000, lambda *args: 'b'), (100, 101)) + self.assertEqual(self.bisect(2000, 200, lambda *args: 'b'), (1999, 2000)) + self.assertEqual(self.bisect(200, 2000, lambda *args: 'g'), (1999, 2000)) + + +if __name__ == '__main__': + unittest.main() |