Skip to content

Commit

Permalink
Added compatibility tests for Thunderbird 20 (Bug 867956)
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnerand committed May 2, 2013
1 parent 1f559c9 commit 0586035
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 7 deletions.
47 changes: 47 additions & 0 deletions tests/compat/test_tb20.py
@@ -0,0 +1,47 @@
from helper import CompatTestCase
from validator.compat import TB20_DEFINITION


class TestTB20Compat(CompatTestCase):
"""Test that compatibility tests for Thunderbird 20 are properly executed."""

VERSION = TB20_DEFINITION

def test_js_patterns(self):
"""Test that these patterns are flagged in Thunderbird 20."""
self.setUp()
self.run_regex_for_compat("var x = %s();" "GetWindowByWindowType")
self.assert_compat_error(type_="notice")

def test_nsIMsgAccount_identities(self):
for method in self.run_xpcom_for_compat(
"nsIMsgAccount", ["identities"]):
self.assert_silent()
self.assert_compat_error(type_="warning")

def test_nsIMsgAccountManager(self):
for method in self.run_xpcom_for_compat(
"nsIMsgAccountManager",
["allIdentities", "GetIdentitiesForServer", "accounts",
"GetServersForIdentity", "allServers"]):
self.assert_silent()
self.assert_compat_error(type_="warning")

def test_nsIMsgFolder_getExpansionArray(self):
for method in self.run_xpcom_for_compat(
"nsIMsgFolder", ["getExpansionArray"]):
self.assert_silent()
self.assert_compat_error(type_="warning")

def test_nsIMsgFilter(self):
for method in self.run_xpcom_for_compat(
"nsIMsgFilter", ["actionList", "getSortedActionList"]):
self.assert_silent()
self.assert_compat_error(type_="warning")

def test_nsIMsgFilterService_applyFiltersToFolders(self):
for method in self.run_xpcom_for_compat(
"nsIMsgFilterService", ["applyFiltersToFolders"]):
self.assert_silent()
self.assert_compat_error(type_="warning")

27 changes: 26 additions & 1 deletion validator/testcases/javascript/entity_values.py
Expand Up @@ -4,7 +4,7 @@
FX16_DEFINITION, FX19_DEFINITION,
TB14_DEFINITION, TB15_DEFINITION,
TB16_DEFINITION, TB18_DEFINITION,
TB19_DEFINITION)
TB19_DEFINITION, TB20_DEFINITION)
from validator.constants import BUGZILLA_BUG


Expand Down Expand Up @@ -375,3 +375,28 @@ def prplIAccount_noNewlines(traverser):
register_changed_entities(version_definition=TB19_DEFINITION,
entities=TB19_ENTITIES, version_string="Thunderbird 19")

# Thunderbird 20 IDL changes
TB20_ENTITIES = [
{"name": "nsIMsgAccount.identities",
"status": "changed", "bug": 820377, "compat_type": "error"},
{"name": "nsIMsgAccountManager.allIdentities",
"status": "changed", "bug": 820377, "compat_type": "error"},
{"name": "nsIMsgAccountManager.GetIdentitiesForServer",
"status": "changed", "bug": 820377, "compat_type": "error"},
{"name": "nsIMsgAccountManager.accounts",
"status": "changed", "bug": 820377, "compat_type": "error"},
{"name": "nsIMsgAccountManager.GetServersForIdentity",
"status": "changed", "bug": 820377, "compat_type": "error"},
{"name": "nsIMsgAccountManager.allServers",
"status": "changed", "bug": 820377, "compat_type": "error"},
{"name": "nsIMsgFolder.getExpansionArray",
"status": "removed", "bug": 821236, "compat_type": "error"},
{"name": "nsIMsgFilter.getSortedActionList",
"status": "changed", "bug": 821253, "compat_type": "error"},
{"name": "nsIMsgFilter.actionList",
"status": "removed", "bug": 821743, "compat_type": "error"},
{"name": "nsIMsgFilterService.applyFiltersToFolders",
"status": "changed", "bug": 822131, "compat_type": "error"}
]
register_changed_entities(version_definition=TB20_DEFINITION,
entities=TB20_ENTITIES, version_string="Thunderbird 20")
23 changes: 18 additions & 5 deletions validator/testcases/javascript/predefinedentities.py
Expand Up @@ -142,8 +142,12 @@
entity("nsIMessenger.saveAttachmentToFolder")}},
u"nsIMsgAccountManager":
{"value":
{u"folderUriForPath":
entity("nsIMsgAccountManager.folderUriForPath")}},
{u"folderUriForPath": entity("nsIMsgAccountManager.folderUriForPath"),
u"allIdentities": entity("nsIMsgAccountManager.allIdentities"),
u"GetIdentitiesForServer": entity("nsIMsgAccountManager.GetIdentitiesForServer"),
u"accounts": entity("nsIMsgAccountManager.accounts"),
u"GetServersForIdentity": entity("nsIMsgAccountManager.GetServersForIdentity"),
u"allServers": entity("nsIMsgAccountManager.allServers")}},
u"nsIMsgLocalMailFolder":
{"value":
{u"addMessage":
Expand Down Expand Up @@ -174,12 +178,14 @@
u"nsIMsgFilterService":
{"value":
{u"OpenFilterList": entity("nsIMsgFilterService.OpenFilterList"),
u"SaveFilterList": entity("nsIMsgFilterService.SaveFilterList")}},
u"SaveFilterList": entity("nsIMsgFilterService.SaveFilterList"),
u"applyFiltersToFolders": entity("nsIMsgFilterService.applyFiltersToFolders")}},
u"nsIMsgFolder":
{"value":
{u"offlineStoreOutputStream":
{"value": call_definitions.nsIMsgFolder_changed},
u"filePath": entity("nsIMsgFolder.filePath")}},
u"filePath": entity("nsIMsgFolder.filePath"),
u"getExpansionArray": entity("nsIMsgFolder.getExpansionArray")}},
u"nsIMsgIdentity":
{"value":
{u"signature": entity("nsIMsgIdentity.signature")}},
Expand Down Expand Up @@ -355,7 +361,14 @@
{u"newshost": entity("nsIMsgCompFields.newshost")}},
u"nsIMsgSearchAdapter":
{"value":
{u"CurrentUrlDone": entity("nsIMsgSearchAdapter.CurrentUrlDone")}}
{u"CurrentUrlDone": entity("nsIMsgSearchAdapter.CurrentUrlDone")}},
u"nsIMsgAccount":
{"value":
{u"identities": entity("nsIMsgAccount.identities")}},
u"nsIMsgFilter":
{"value":
{u"getSortedActionList": entity("nsIMsgFilter.getSortedActionList"),
u"actionList": entity("nsIMsgFilter.actionList")}}
}

INTERFACE_ENTITIES = {u"nsIXMLHttpRequest":
Expand Down
59 changes: 58 additions & 1 deletion validator/testcases/regex.py
Expand Up @@ -10,7 +10,8 @@
FX20_DEFINITION, TB7_DEFINITION, TB10_DEFINITION,
TB11_DEFINITION, TB12_DEFINITION, TB13_DEFINITION,
TB14_DEFINITION, TB15_DEFINITION, TB16_DEFINITION,
TB17_DEFINITION, TB18_DEFINITION, TB19_DEFINITION)
TB17_DEFINITION, TB18_DEFINITION, TB19_DEFINITION,
TB20_DEFINITION)
from validator.contextgenerator import ContextGenerator
from markup.csstester import UNPREFIXED_MESSAGE

Expand Down Expand Up @@ -1382,3 +1383,59 @@ def tests(self):
"in Thunderbird 19." % pattern,
compat_type="error", log_function=self.err.notice)

@register_generator
class Thunderbird20RegexTests(CompatRegexTestHelper):
"""Regex tests for the Thunderbird 20 update."""

VERSION = TB20_DEFINITION

def tests(self):
"""String and JS changes for Thunderbird add-ons"""

# String changes for add-ons that use our localizations.
patterns = {r"appmenuButton.tooltip": 812630,
r"decreaseFontSize.key": 813295,
r"decreaseFontSize.key2": 813295,
r"increaseFontSize.key": 813295,
r"increaseFontSize.key2": 813295,
r"serverNameEmpty": 327812,
r"confirmDeferAccount": 734034}
for pattern, bug in patterns.items():
yield self.get_test_bug(
bug, pattern,
"Removed, renamed, or changed labels in use.",
"Some string matched the pattern `%s`, which has been "
"flagged as having changed in Thunderbird 20." % pattern,
compat_type="error")

js_patterns = {r"gIdentity": 807101,
r"enabling": 807101,
r"cleanUpHostname": 327812,
r"gIOService": 794909,
r"gPromptService": 794909,
r"gIsOffline": 794909,
r"gIOService": 794909,
r"gPrefBranch": 795152,
r"GetWindowByWindowType": 795152,
r"specialTabs\.getApplicationUpgradeVersions": 795152,
r"specialTabs\.shouldShowTelemetryNotification": 795152,
r"specialTabs\.showTelemetryNotification": 795152,
r"specialTabs\.shouldShowAboutRightsNotification": 795152,
r"specialTabs\.showAboutRightsNotification": 795152,
r"FocusManager": 795152,
r"nsIWindowMediator": 795152,
r"nsIWindowWatcher": 795152,
r"gPrefs": 795152,
r"gAttachmentNotifier\.handleMutations": 823009}

# Add restricting prefix for ( or word boundary to prevent substring matching.
js_patterns.update(dict(("(\b|\()" + k, v) for k, v in js_patterns.items()))

for pattern, bug in js_patterns.items():
yield self.get_test_bug(
bug, pattern,
"Removed, renamed, or changed methods in use.",
"A JavaScript function matched the pattern `%s`, which has "
"been flagged as having changed, removed, or deprecated "
"in Thunderbird 20." % pattern,
compat_type="error", log_function=self.err.notice)

0 comments on commit 0586035

Please sign in to comment.