Bug 1322862 - Compare unicode strings in Python test; r=whimboo
It has been known to happen that Python occassionally trips up string
comparison on Windows and that this is causing intermittent issues.
This patch uses unicode strings consistently so that this should not
occur.
MozReview-Commit-ID: BAdHfiLZzuQ
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
@@ -31,17 +31,24 @@ class TestNavigate(WindowManagerMixin, M
def tearDown(self):
self.close_all_windows()
super(TestNavigate, self).tearDown()
@property
def location_href(self):
- return self.marionette.execute_script("return window.location.href")
+ # Windows 8 has recently seen a proliferation of intermittent
+ # test failures to do with failing to compare "about:blank" ==
+ # u"about:blank". For the sake of consistenty, we encode the
+ # returned URL as Unicode here to ensure that the values are
+ # absolutely of the same type.
+ #
+ # (https://bugzilla.mozilla.org/show_bug.cgi?id=1322862)
+ return self.marionette.execute_script("return window.location.href").encode("utf-8")
def test_set_location_through_execute_script(self):
self.marionette.execute_script(
"window.location.href = '%s'" % self.test_doc)
Wait(self.marionette).until(
lambda _: self.test_doc == self.location_href)
self.assertEqual("Marionette Test", self.marionette.title)