summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/common
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-11 09:43:24 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-11 09:43:24 +0200
commit1b914638db989aaa98631a1c1e02c7b2d44805d8 (patch)
tree87f4fd2c7b38db320079a5de8877890d2ca3c485 /Tools/Scripts/webkitpy/common
parent2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (diff)
downloadqtwebkit-1b914638db989aaa98631a1c1e02c7b2d44805d8.tar.gz
Imported WebKit commit 9a52e27980f47e8b0d8f8b7cc0fd7b5741bceb92 (http://svn.webkit.org/repository/webkit/trunk@116736)
New snapshot to include QDeclarative* -> QQml* build fixes
Diffstat (limited to 'Tools/Scripts/webkitpy/common')
-rw-r--r--Tools/Scripts/webkitpy/common/checkout/checkout_mock.py56
-rw-r--r--Tools/Scripts/webkitpy/common/config/committers.py2
-rw-r--r--Tools/Scripts/webkitpy/common/config/urls.py1
-rw-r--r--Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py6
-rw-r--r--Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py39
-rw-r--r--Tools/Scripts/webkitpy/common/net/omahaproxy.py80
-rw-r--r--Tools/Scripts/webkitpy/common/net/omahaproxy_unittest.py125
7 files changed, 284 insertions, 25 deletions
diff --git a/Tools/Scripts/webkitpy/common/checkout/checkout_mock.py b/Tools/Scripts/webkitpy/common/checkout/checkout_mock.py
index 696f1427e..3c050aeb9 100644
--- a/Tools/Scripts/webkitpy/common/checkout/checkout_mock.py
+++ b/Tools/Scripts/webkitpy/common/checkout/checkout_mock.py
@@ -40,31 +40,51 @@ class MockCommitMessage(object):
return "This is a fake commit message that is at least 50 characters."
+committer_list = CommitterList()
+
+mock_revisions = {
+ 1: CommitInfo(852, "eric@webkit.org", {
+ "bug_id": 50000,
+ "author_name": "Adam Barth",
+ "author_email": "abarth@webkit.org",
+ "author": committer_list.contributor_by_email("abarth@webkit.org"),
+ "reviewer_text": "Darin Adler",
+ "reviewer": committer_list.committer_by_name("Darin Adler"),
+ "changed_files": [
+ "path/to/file",
+ "another/file",
+ ],
+ }),
+ 3001: CommitInfo(3001, "tomz@codeaurora.org", {
+ "bug_id": 50004,
+ "author_name": "Tom Zakrajsek",
+ "author_email": "tomz@codeaurora.org",
+ "author": committer_list.contributor_by_email("tomz@codeaurora.org"),
+ "reviewer_text": "Darin Adler",
+ "reviewer": committer_list.committer_by_name("Darin Adler"),
+ "changed_files": [
+ "path/to/file",
+ "another/file",
+ ],
+ })
+}
+
class MockCheckout(object):
def __init__(self):
# FIXME: It's unclear if a MockCheckout is very useful. A normal Checkout
# with a MockSCM/MockFileSystem/MockExecutive is probably better.
self._filesystem = MockFileSystem()
- # FIXME: This should move onto the Host object, and we should use a MockCommitterList for tests.
- _committer_list = CommitterList()
-
def commit_info_for_revision(self, svn_revision):
- # The real Checkout would probably throw an exception, but this is the only way tests have to get None back at the moment.
- if not svn_revision:
- return None
- return CommitInfo(svn_revision, "eric@webkit.org", {
- "bug_id": 50000,
- "author_name": "Adam Barth",
- "author_email": "abarth@webkit.org",
- "author": self._committer_list.contributor_by_email("abarth@webkit.org"),
- "reviewer_text": "Darin Adler",
- "reviewer": self._committer_list.committer_by_name("Darin Adler"),
- "changed_files": [
- "path/to/file",
- "another/file",
- ],
- })
+ # There are legacy tests that all expected these revision numbers to map
+ # to the same commit description (now mock_revisions[1])
+ if svn_revision in [32, 123, 852, 853, 854, 1234, 21654, 21655, 21656]:
+ return mock_revisions[1]
+
+ if svn_revision in mock_revisions:
+ return mock_revisions[svn_revision]
+
+ # any "unrecognized" svn_revision will return None.
def is_path_to_changelog(self, path):
return self._filesystem.basename(path) == "ChangeLog"
diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py
index be0e61974..68e2f0d4e 100644
--- a/Tools/Scripts/webkitpy/common/config/committers.py
+++ b/Tools/Scripts/webkitpy/common/config/committers.py
@@ -172,6 +172,7 @@ contributors_who_are_not_committers = [
committers_unable_to_review = [
Committer("Aaron Boodman", "aa@chromium.org", "aboodman"),
+ Committer("Adam Bergkvist", "adam.bergkvist@ericsson.com", "adambe"),
Committer("Adam Klein", "adamk@chromium.org", "aklein"),
Committer("Adam Langley", "agl@chromium.org", "agl"),
Committer("Ademar de Souza Reis Jr", ["ademar.reis@gmail.com", "ademar@webkit.org"], "ademar"),
@@ -209,6 +210,7 @@ committers_unable_to_review = [
Committer("Carlos Garcia Campos", ["cgarcia@igalia.com", "carlosgc@gnome.org", "carlosgc@webkit.org"], "KaL"),
Committer("Carol Szabo", ["carol@webkit.org", "carol.szabo@nokia.com"], "cszabo1"),
Committer("Cary Clark", ["caryclark@google.com", "caryclark@chromium.org"], "caryclark"),
+ Committer("Charles Reis", "creis@chromium.org", "creis"),
Committer("Charles Wei", ["charles.wei@torchmobile.com.cn"], "cswei"),
Committer("Chris Evans", ["cevans@google.com", "cevans@chromium.org"]),
Committer("Chris Guillory", ["ctguil@chromium.org", "chris.guillory@google.com"], "ctguil"),
diff --git a/Tools/Scripts/webkitpy/common/config/urls.py b/Tools/Scripts/webkitpy/common/config/urls.py
index b547045f4..48830c564 100644
--- a/Tools/Scripts/webkitpy/common/config/urls.py
+++ b/Tools/Scripts/webkitpy/common/config/urls.py
@@ -56,6 +56,7 @@ direct_attachment_url = r"https?://bug-(?P<bug_id>\d+)-attachments.%s/attachment
buildbot_url = "http://build.webkit.org"
chromium_buildbot_url = "http://build.chromium.org/p/chromium.webkit"
+omahaproxy_url = "http://omahaproxy.appspot.com/"
def parse_bug_id(string):
if not string:
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
index 3d2a96922..6186a9559 100644
--- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
+++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
@@ -152,6 +152,11 @@ class BugzillaQueries(object):
def _fetch_bugs_from_advanced_query(self, query):
results_page = self._load_query(query)
+ # Some simple searches can return a single result.
+ results_url = results_page.geturl()
+ if results_url.find("/show_bug.cgi?id=") != -1:
+ bug_id = int(results_url.split("=")[-1])
+ return [self._fetch_bug(bug_id)]
if not self._parse_result_count(results_page):
return []
# Bugzilla results pages have an "XML" submit button at the bottom
@@ -493,6 +498,7 @@ class Bugzilla(object):
self.browser.select_form(name="login")
self.browser['Bugzilla_login'] = username
self.browser['Bugzilla_password'] = password
+ self.browser.find_control("Bugzilla_restrictlogin").items[0].selected = False
response = self.browser.submit()
match = re.search("<title>(.+?)</title>", response.read())
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
index 47f867e03..36b465920 100644
--- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
+++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
@@ -169,9 +169,9 @@ _bug2 = {
"bug_status": "ASSIGNED",
"comments": [{"comment_date": datetime.datetime(2011, 6, 11, 9, 4, 3),
"comment_email": "bar@foo.com",
- "text": "Message1.",
- },
- ],
+ "text": "Message1.\nCommitted r35: <http://trac.webkit.org/changeset/35>",
+ },
+ ],
}
@@ -183,7 +183,15 @@ _bug3 = {
"cc_emails": [],
"attachments": [_patch7],
"bug_status": "NEW",
- "comments": [],
+ "comments": [{"comment_date": datetime.datetime(2011, 6, 11, 9, 4, 3),
+ "comment_email": "bar@foo.com",
+ "text": "Committed r30: <http://trac.webkit.org/changeset/30>",
+ },
+ {"comment_date": datetime.datetime(2011, 6, 11, 9, 4, 3),
+ "comment_email": "bar@foo.com",
+ "text": "Committed r31: <http://trac.webkit.org/changeset/31>",
+ },
+ ],
}
@@ -195,7 +203,15 @@ _bug4 = {
"cc_emails": [],
"attachments": [_patch4, _patch5, _patch6],
"bug_status": "REOPENED",
- "comments": [],
+ "comments": [{"comment_date": datetime.datetime(2011, 6, 11, 9, 4, 3),
+ "comment_email": "bar@foo.com",
+ "text": "Committed r25: <http://trac.webkit.org/changeset/30>",
+ },
+ {"comment_date": datetime.datetime(2011, 6, 11, 9, 4, 3),
+ "comment_email": "bar@foo.com",
+ "text": "Rolled out in <http://trac.webkit.org/changeset/26",
+ },
+ ],
}
@@ -208,7 +224,12 @@ _bug5 = {
"attachments": [],
"bug_status": "RESOLVED",
"dup_id": 50002,
- "comments": [],
+ "comments": [{"comment_date": datetime.datetime(2011, 6, 11, 9, 4, 3),
+ "comment_email": "bar@foo.com",
+ "text": "Committed r15: <http://trac.webkit.org/changeset/15>",
+ },
+ ],
+
}
@@ -251,6 +272,10 @@ class MockBugzillaQueries(object):
def fetch_bugs_matching_search(self, search_string, author_email=None):
return [self._bugzilla.fetch_bug(50004), self._bugzilla.fetch_bug(50003)]
+ def fetch_bugs_matching_quicksearch(self, search_string):
+ return [self._bugzilla.fetch_bug(50001), self._bugzilla.fetch_bug(50002),
+ self._bugzilla.fetch_bug(50003), self._bugzilla.fetch_bug(50004)]
+
_mock_reviewers = [Reviewer("Foo Bar", "foo@bar.com"),
Reviewer("Reviewer2", "reviewer2@webkit.org")]
@@ -298,7 +323,7 @@ class MockBugzilla(object):
log("cc: %s" % cc)
if blocked:
log("blocked: %s" % blocked)
- return 50004
+ return 60001
def quips(self):
return ["Good artists copy. Great artists steal. - Pablo Picasso"]
diff --git a/Tools/Scripts/webkitpy/common/net/omahaproxy.py b/Tools/Scripts/webkitpy/common/net/omahaproxy.py
new file mode 100644
index 000000000..796923a6a
--- /dev/null
+++ b/Tools/Scripts/webkitpy/common/net/omahaproxy.py
@@ -0,0 +1,80 @@
+# Copyright (C) 2012 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# This is the client to query http://omahaproxy.appspot.com/ to retrieve
+# chrome versions associated with WebKit commits.
+
+from webkitpy.common.net.networktransaction import NetworkTransaction
+from webkitpy.common.config import urls
+
+import json
+import urllib2
+
+
+class OmahaProxy(object):
+ default_url = urls.omahaproxy_url
+
+ chrome_platforms = {"linux": "Linux",
+ "win": "Windows",
+ "mac": "Mac",
+ "cros": "Chrome OS",
+ "cf": "Chrome Frame"}
+ chrome_channels = ["canary", "dev", "beta", "stable"]
+
+ def __init__(self, url=default_url, browser=None):
+ self._chrome_channels = set(self.chrome_channels)
+ self.set_url(url)
+ from webkitpy.thirdparty.autoinstalled.mechanize import Browser
+ self._browser = browser or Browser()
+
+ def set_url(self, url):
+ self.url = url
+
+ def _json_url(self):
+ return "%s/all.json" % self.url
+
+ def _get_json(self):
+ return NetworkTransaction().run(lambda: urllib2.urlopen(self._json_url()).read())
+
+ def get_revisions(self):
+ revisions_json = json.loads(self._get_json())
+ revisions = []
+ for platform in revisions_json:
+ for version in platform["versions"]:
+ try:
+ row = {
+ "commit": int(version["base_webkit_revision"]),
+ "channel": version["channel"],
+ "platform": self.chrome_platforms[platform["os"]],
+ "date": version["date"],
+ }
+ assert(version["channel"] in self._chrome_channels)
+ revisions.append(row)
+ except ValueError:
+ next
+ return revisions
diff --git a/Tools/Scripts/webkitpy/common/net/omahaproxy_unittest.py b/Tools/Scripts/webkitpy/common/net/omahaproxy_unittest.py
new file mode 100644
index 000000000..42735c1ab
--- /dev/null
+++ b/Tools/Scripts/webkitpy/common/net/omahaproxy_unittest.py
@@ -0,0 +1,125 @@
+# Copyright (C) 2012 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Unit test for omahaproxy.py
+
+import unittest
+
+from webkitpy.common.net.omahaproxy import OmahaProxy
+
+
+class MockOmahaProxy(OmahaProxy):
+ def __init__(self, json):
+ self._get_json = lambda: json
+ OmahaProxy.__init__(self)
+
+
+class OmahaProxyTest(unittest.TestCase):
+ example_omahaproxy_json = """[
+ {"os": "win",
+ "versions": [
+ {"base_webkit_revision": "116185",
+ "v8_ver": "3.10.8.1",
+ "wk_ver": "536.11",
+ "base_trunk_revision": 135598,
+ "prev_version": "20.0.1128.0",
+ "version": "20.0.1129.0",
+ "date": "05\/07\/12",
+ "prev_date": "05\/06\/12",
+ "true_branch": "trunk",
+ "channel": "canary",
+ "branch_revision": "NA"},
+ {"base_webkit_revision": "115687",
+ "v8_ver": "3.10.6.0",
+ "wk_ver": "536.10",
+ "base_trunk_revision": 134666,
+ "prev_version": "20.0.1123.1",
+ "version": "20.0.1123.4",
+ "date": "05\/04\/12",
+ "prev_date": "05\/02\/12",
+ "true_branch": "1123",
+ "channel": "dev",
+ "branch_revision": 135092}]},
+ {"os": "linux",
+ "versions": [
+ {"base_webkit_revision": "115688",
+ "v8_ver": "3.10.6.0",
+ "wk_ver": "536.10",
+ "base_trunk_revision": 134666,
+ "prev_version": "20.0.1123.2",
+ "version": "20.0.1123.4",
+ "date": "05\/04\/12",
+ "prev_date": "05\/02\/12",
+ "true_branch": "1123",
+ "channel": "dev",
+ "branch_revision": 135092},
+ {"base_webkit_revision": "112327",
+ "v8_ver": "3.9.24.17",
+ "wk_ver": "536.5",
+ "base_trunk_revision": 129376,
+ "prev_version": "19.0.1084.36",
+ "version": "19.0.1084.41",
+ "date": "05\/03\/12",
+ "prev_date": "04\/25\/12",
+ "true_branch": "1084",
+ "channel": "beta",
+ "branch_revision": 134854},
+ {"base_webkit_revision": "*",
+ "v8_ver": "3.9.24.17",
+ "wk_ver": "536.5",
+ "base_trunk_revision": 129376,
+ "prev_version": "19.0.1084.36",
+ "version": "19.0.1084.41",
+ "date": "05\/03\/12",
+ "prev_date": "04\/25\/12",
+ "true_branch": "1084",
+ "channel": "release",
+ "branch_revision": 134854}]}]"""
+
+ expected_revisions = [
+ {"commit": 116185, "channel": "canary", "platform": "Windows", "date": "05/07/12"},
+ {"commit": 115687, "channel": "dev", "platform": "Windows", "date": "05/04/12"},
+ {"commit": 115688, "channel": "dev", "platform": "Linux", "date": "05/04/12"},
+ {"commit": 112327, "channel": "beta", "platform": "Linux", "date": "05/03/12"},
+ ]
+
+ def test_get_revisions(self):
+ omahaproxy = MockOmahaProxy(self.example_omahaproxy_json)
+ revisions = omahaproxy.get_revisions()
+ self.assertEqual(len(revisions), 4)
+ for revision in revisions:
+ self.assertTrue("commit" in revision)
+ self.assertTrue("channel" in revision)
+ self.assertTrue("platform" in revision)
+ self.assertTrue("date" in revision)
+ self.assertEqual(len(revision.keys()), 4)
+ self.assertEqual(revisions, self.expected_revisions)
+
+if __name__ == '__main__':
+ unittest.main()