Index: scripts/slave/unittests/slave_utils_test.py |
diff --git a/scripts/slave/unittests/slave_utils_test.py b/scripts/slave/unittests/slave_utils_test.py |
index bfe05be4eaef0a91e3a4887bf0b5c8dea5a92509..97944328426ad2e77bd36dd335af645ac8c8bb08 100755 |
--- a/scripts/slave/unittests/slave_utils_test.py |
+++ b/scripts/slave/unittests/slave_utils_test.py |
@@ -18,6 +18,40 @@ _SCRIPT_DIR = os.path.dirname(__file__) |
_BUILD_DIR = os.path.abspath(os.path.join( |
_SCRIPT_DIR, os.pardir, os.pardir)) |
+ |
+# 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 TestGetZipFileNames(unittest.TestCase): |
def setUp(self): |
super(TestGetZipFileNames, self).setUp() |
@@ -93,5 +127,41 @@ class TestGSUtil(unittest.TestCase): |
'Cache-Control:mock_cache', 'cp', '-R', 'foo', 'bar']) |
+class GetGitRevisionTest(unittest.TestCase): |
+ """Tests related to getting revisions from a directory.""" |
+ def test_GitSvnCase(self): |
+ # pylint: disable=W0212 |
+ self.assertEqual(slave_utils._GetGitCommitPositionFromLog(CHROMIUM_LOG), |
+ '291141') |
+ # pylint: disable=W0212 |
+ self.assertEqual(slave_utils._GetGitCommitPositionFromLog(BLINK_LOG), |
+ '180728') |
+ |
+ def test_GetCommitPosFromBuildPropTest(self): |
+ """Tests related to getting a commit position from build properties.""" |
+ # pylint: disable=W0212 |
+ self.assertEqual(slave_utils._GetCommitPos( |
+ {'got_revision_cp': 'refs/heads/master@{#12345}'}), 12345) |
+ # pylint: disable=W0212 |
+ self.assertIsNone(slave_utils._GetCommitPos({'got_revision': 12345})) |
+ |
+class TelemetryRevisionTest(unittest.TestCase): |
+ def test_GetTelemetryRevisions(self): |
+ point_id = 1470050195 |
+ revision = '294850' |
+ webkit_revision = '34f9d01' |
+ build_properties = { |
+ 'got_webrtc_revision': None, |
+ 'got_v8_revision': 'undefined', |
+ 'git_revision': '9a7b354', |
+ } |
+ versions = slave_utils.GetTelemetryRevisions( |
+ build_properties, revision, webkit_revision, point_id) |
+ self.assertEqual( |
+ {'rev': '294850', 'webkit_rev': '34f9d01', 'git_revision': '9a7b354', |
+ 'point_id': 1470050195}, |
+ versions) |
+ |
+ |
if __name__ == '__main__': |
unittest.main() |