Index: scripts/slave/unittests/runtest_test.py |
diff --git a/scripts/slave/unittests/runtest_test.py b/scripts/slave/unittests/runtest_test.py |
index 2684d4d2c4494eeba38af9939758dfc11f4f5c25..3d1da460a0553b051bd15bbd23f13f62f457e7c4 100755 |
--- a/scripts/slave/unittests/runtest_test.py |
+++ b/scripts/slave/unittests/runtest_test.py |
@@ -11,6 +11,39 @@ |
import mock |
from slave import runtest |
+ |
+ |
+# Note: The git-svn id / cr pos is intentionally modified. |
+# Also commit messages modified to be < 80 char. |
+CHROMIUM_LOG = """ |
+Update GPU rasterization device whitelist |
+ |
+This replaces the whitelisting of all Qualcomm GPUs on |
+Android 4.4 with whitelisting all Android 4.4 devices |
+with GL ES version >= 3.0. |
+ |
+BUG=405646 |
+ |
+Review URL: https://codereview.chromium.org/468103003 |
+ |
+Cr-Commit-Position: refs/heads/master@{#291141} |
+git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291140 0039d316-1c4b-4281 |
+""" |
+ |
+BLINK_LOG = """ |
+[Sheriff-o-matic] Remove race condition on the commit list. |
+ |
+By always modifying the same list of commits, we ensure that data binding |
+ |
+As well, renamed "revisionLog" to "commitLog" everywhere, to better reflect |
+ |
+BUG=405327 |
+NOTRY=true |
+ |
+Review URL: https://codereview.chromium.org/485253004 |
+ |
+git-svn-id: svn://svn.chromium.org/blink/trunk@180728 bbb929c8-8fbe-4397-9dbb-9 |
+""" |
class FakeLogProcessor(object): |
@@ -62,6 +95,25 @@ |
self.assertEqual({}, runtest._GetDataFromLogProcessor(log_processor)) |
+class GetGitRevisionTest(unittest.TestCase): |
+ """Tests related to getting revisions from a directory.""" |
+ def test_GitSvnCase(self): |
+ # pylint: disable=W0212 |
+ self.assertEqual(runtest._GetGitCommitPositionFromLog(CHROMIUM_LOG), |
+ '291141') |
+ # pylint: disable=W0212 |
+ self.assertEqual(runtest._GetGitCommitPositionFromLog(BLINK_LOG), |
+ '180728') |
+ |
+ def test_GetCommitPosFromBuildPropTest(self): |
+ """Tests related to getting a commit position from build properties.""" |
+ # pylint: disable=W0212 |
+ self.assertEqual(runtest._GetCommitPos( |
+ {'got_revision_cp': 'refs/heads/master@{#12345}'}), 12345) |
+ # pylint: disable=W0212 |
+ self.assertIsNone(runtest._GetCommitPos({'got_revision': 12345})) |
+ |
+ |
class SendResultsToDashboardTest(unittest.TestCase): |
"""Tests related to sending requests and saving data from failed requests.""" |
@@ -222,6 +274,21 @@ |
self.assertFalse(SendResults.called) |
fake_results_tracker.Cleanup.assert_called_with() |
+ def test_GetTelemetryRevisions(self): |
+ options = mock.MagicMock() |
+ options.point_id = 1470050195 |
+ options.revision = '294850' |
+ options.webkit_revision = '34f9d01' |
+ options.build_properties = { |
+ 'got_webrtc_revision': None, |
+ 'got_v8_revision': 'undefined', |
+ 'git_revision': '9a7b354', |
+ } |
+ versions = runtest._GetTelemetryRevisions(options) |
+ self.assertEqual( |
+ {'rev': '294850', 'webkit_rev': '34f9d01', 'git_revision': '9a7b354', |
+ 'point_id': 1470050195}, |
+ versions) |
if __name__ == '__main__': |
unittest.main() |