Permalink
Browse files

Gecko 18 compat tests

Bugs: 825033, 824997, 824990, 824988, 824982, 824975, 795168, 824839
  • Loading branch information...
1 parent b37736e commit c068bfd5b0ef2e49243c3d16d860de1e4741e787 @mattbasta committed Jan 2, 2013
Showing with 169 additions and 26 deletions.
  1. +14 −13 tests/compat/helper.py
  2. +70 −0 tests/compat/test_gecko18.py
  3. +13 −11 tests/helper.py
  4. +0 −1 validator/errorbundler.py
  5. +72 −1 validator/testcases/regex.py
@@ -17,36 +17,36 @@ def run_script_for_compat(self, script, expose_pollution=False):
Test a script with and without version restrictions to determine
whether it properly raises JavaScript compatibility messages.
"""
- self._run_member_for_compat(lambda: self.run_script(script,
- expose_pollution))
+ self._run_member_for_compat(
+ lambda: self.run_script(script, expose_pollution))
def run_xpcom_for_compat(self, interface, methods=None):
- """
- Yields after each method has been run as a script. Used to test that
+ """Yields after each method has been run as a script. Used to test that
XPCOM members are properly flagged for compatibility tests.
- `interface` should be the name of the XPCOM interface.
- `methods` should be the member to test. It may be a simple reference
to a member (i.e.: `foo`) or an action upon a member (i.e.:
`foo('bar')` or `foo["bar"] = "zap"`).
+
"""
+ if not methods:
+ return
+
script = """
var x = Components.classes[""].createInstance(Components.interfaces.%s);
x.%%s;
""" % interface
- if not methods:
- return
-
for method in methods:
self.run_script_for_compat(script % method)
yield
def run_regex_for_compat(self, input):
- """
- Test an input with and without version restrictions to determine
+ """Test an input with and without version restrictions to determine
whether it properly raises regex compatibility messages.
+
"""
self._run_member_for_compat(lambda: self.run_regex(input))
@@ -72,14 +72,15 @@ def assert_compat_silent(self):
"Got %s" % self.compat_err.compat_summary
def assert_compat_error(self, type_="warning"):
- """
- Assert that a compat error was raised as a message of type `type_`.
+ """Assert that a compat error was raised as a message of type `type_`.
+
"""
self._assert_compat_type("error", type_)
def assert_compat_warning(self, type_="notice"):
- """
- Assert that a compat warning was raised as a message of type `type_`.
+ """Assert that a compat warning was raised as a message of type
+ `type_`.
+
"""
self._assert_compat_type("warning", type_)
@@ -0,0 +1,70 @@
+from helper import CompatTestCase
+from validator.compat import FX18_DEFINITION
+
+
+class TestFX18Compat(CompatTestCase):
+ """Test that compatibility tests for Gecko 18 are properly executed."""
+
+ VERSION = FX18_DEFINITION
+
+ def test_proxy(self):
+ """Test that the proxy interfaces are properly flagged."""
+ for interface in ["nsIProtocolProxyService", "nsIProxyAutoConfig",
+ "newProxiedChannel"]:
+ self.compat_err = None
+ self.setup_err()
+ self.run_script_for_compat("foo.%s" % interface)
+ self.assert_silent()
+ self.assert_compat_error(type_="notice")
+
+ def test_download(self):
+ """Test that the downloads functions are properly flagged."""
+ for interface in ["addDownload", "saveURL"]:
+ self.compat_err = None
+ self.setup_err()
+ self.run_script_for_compat("foo.%s" % interface)
+ self.assert_silent()
+ self.assert_compat_error(type_="notice")
+
+ def test_saveURI(self):
+ """Test that `saveURI` is flagged in Gecko 18."""
+ self.run_script_for_compat("x.saveURI();")
+ self.assert_silent()
+ self.assert_compat_error(type_="notice")
+
+ def test_imgitools(self):
+ """Test that the imgI<foo> interfaces are properly flagged."""
+ for interface in ["imgICache", "imgILoader", "imgIToolsx"]:
+ self.compat_err = None
+ self.setup_err()
+ self.run_script_for_compat("foo.%s" % interface)
+
+ self.assert_silent()
+ if interface != "imgIToolsx":
+ self.assert_compat_error(type_="warning")
+ else:
+ self.assert_compat_silent()
+
+ def test_removeDataFromDomain(self):
+ """Test that `removeDataFromDomain` is flagged in Gecko 18."""
+ self.run_script_for_compat("x.removeDataFromDomain();")
+ self.assert_silent()
+ self.assert_compat_error(type_="notice")
+
+ def test_openCacheEntry(self):
+ """Test that `openCacheEntry` is flagged in Gecko 18."""
+ self.run_script_for_compat("x.openCacheEntry();")
+ self.assert_silent()
+ self.assert_compat_error(type_="notice")
+
+ def test_BlobBuilder(self):
+ """Test that `BlobBuilder` is flagged in Gecko 18."""
+ self.run_script_for_compat("var x = new BlobBuilder();")
+ self.assert_silent()
+ self.assert_compat_error()
+
+ def test_setAndLoadFaviconForPage(self):
+ """Test that `setAndLoadFaviconForPage` is flagged in Gecko 18."""
+ self.run_script_for_compat("x.setAndLoadFaviconForPage();")
+ self.assert_silent()
+ self.assert_compat_error(type_="notice")
View
@@ -78,12 +78,13 @@ def setup_err(self, for_appversions=None):
self.err.detected_Type = self.detected_type
def assert_failed(self, with_errors=False, with_warnings=None):
- """
- First, asserts that the error bundle registers a failure (recognizing
- whether warnings are acknowledged). Second, if with_errors is True,
- the presence of errors is asserted. If it is not true (default), it
- is tested that errors are not present. If with_warnings is not None,
- the presence of warnings is tested just like with_errors)
+ """First, asserts that the error bundle registers a failure
+ (recognizing whether warnings are acknowledged). Second, if
+ `with_errors`is True, the presence of errors is asserted. If it is not
+ true (default), it is tested that errors are not present. If
+ `with_warnings` is not None, the presence of warnings is tested just
+ like `with_errors`.
+
"""
assert self.err.failed(
fail_on_warnings=with_warnings or with_warnings is None), \
@@ -103,15 +104,16 @@ def assert_failed(self, with_errors=False, with_warnings=None):
self.err.print_summary())
def assert_notices(self):
- """
- Assert that notices have been generated during the validation process.
+ """Assert that notices have been generated during the validation
+ process.
+
"""
assert self.err.notices, "Notices were expected."
def assert_passes(self, warnings_pass=False):
- """
- Assert that no errors have been raised. If warnings_pass is True, also
- assert that there are no warnings.
+ """Assert that no errors have been raised. If `warnings_pass` is True,
+ also assert that there are no warnings.
+
"""
assert not self.failed(fail_on_warnings=not warnings_pass), \
("Test was intended to pass%s, but it did not." %
@@ -486,4 +486,3 @@ def discard_unused_messages(self, ending_tier):
for message in stack:
if message["tier"] > ending_tier:
stack.remove(message)
-
@@ -5,7 +5,7 @@
FX7_DEFINITION, FX8_DEFINITION, FX9_DEFINITION,
FX11_DEFINITION, FX12_DEFINITION, FX13_DEFINITION,
FX14_DEFINITION, FX15_DEFINITION, FX16_DEFINITION,
- FX17_DEFINITION,
+ FX17_DEFINITION, FX18_DEFINITION,
TB7_DEFINITION, TB10_DEFINITION, TB11_DEFINITION,
TB12_DEFINITION, TB13_DEFINITION, TB14_DEFINITION,
TB15_DEFINITION, TB16_DEFINITION, TB17_DEFINITION)
@@ -732,6 +732,77 @@ def js_tests(self):
@register_generator
+class Gecko18RegexTests(CompatRegexTestHelper):
+ """Regex tests for Gecko 18 updates."""
+
+ VERSION = FX18_DEFINITION
+
+ def js_tests(self):
+
+ yield self.get_test_bug(
+ 794602, "saveURI",
+ "`saveURI` has been changed.",
+ "The `saveURI` function have changed to support per-window "
+ "private browsing. You should now pass a context as an "
+ "additional argument.",
+ compat_type="error", log_function=self.err.notice)
+
+ yield self.get_test_bug(
+ 769764,
+ "nsIProtocolProxyService|nsIProxyAutoConfig|newProxiedChannel",
+ "Proxy interfaces have been changed.",
+ "The `nsIProtocolProxyService` and `nsIProxyAutoConfig` "
+ "interfaces, as well as the `newProxiedChannel` function have "
+ "changed in order to make the proxy API asynchronous.",
+ compat_type="error", log_function=self.err.notice)
+
+ yield self.get_test_bug(
+ 722861, "imgI(Cache|Loader)",
+ "`imgICache` and `imgILoader` have been deprecated.",
+ "The `imgICache` and `imgILoader` interfaces have been "
+ "deprecated in Gecko 18. You should use `imgITools` instead.",
+ compat_type="error")
+
+ yield self.get_test_bug(
+ 774963, "removeDataFromDomain",
+ "`removeDataFromDomain` has been moved.",
+ "The `removeDataFromDomain` function has been moved to "
+ "`ClearRecentHistory.jsm`.",
+ compat_type="error", log_function=self.err.notice)
+
+ yield self.get_test_bug(
+ 695399, "openCacheEntry",
+ "`openCacheEntry` no longer works from main thread.",
+ "The `openCacheEntry` function no longer works when invoked "
+ "from the main thread. You should use `asyncOpenCacheEntry` "
+ "instead.",
+ compat_type="error", log_function=self.err.notice)
+
+ yield self.get_test_bug(
+ 744907, "BlobBuilder",
+ "`BlobBuiler` has been removed.",
+ "The `BlobBuilder` object has been removed. You should use "
+ "the `Blob` constructor instead.",
+ compat_type="error")
+
+ yield self.get_test_bug(
+ 741059, "setAndLoadFaviconForPage",
+ "`setAndLoadFaviconForPage` has been changed.",
+ "The `setAndLoadFaviconForPage` function have changed to "
+ "support per-window private browsing. You should now pass a "
+ "load type as an additional argument.",
+ compat_type="error", log_function=self.err.notice)
+
+ yield self.get_test_bug(
+ 795065, "addDownload|saveURL",
+ "`addDownlod` and `saveURL` have been changed.",
+ "The `addDownload` and `saveURL` functions have changed to "
+ "support per-window private browsing. You should now pass an "
+ "additional argument to them.",
+ compat_type="error", log_function=self.err.notice)
+
+
+@register_generator
class Thunderbird7RegexTests(CompatRegexTestHelper):
"""Regex tests for the Thunderbird 7 update."""

0 comments on commit c068bfd

Please sign in to comment.