Bug 811747: Adding a test for checking that page_source handles unicode chars; r=jgriffin
authorDavid Burns <dburns@mozilla.com>
Wed, 09 Jan 2013 14:32:54 +0000
changeset 180154 ff9d5d0bde0af0eae48257ae1b3b6f6b92f97a17
parent 180153 59d2341b206a9aef08d508e6763094a309bf4507
child 180155 f09a01f7050c1b4806b914ddbd750f83a3799991
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjgriffin
bugs811747
milestone31.0a1
Bug 811747: Adding a test for checking that page_source handles unicode chars; r=jgriffin
testing/marionette/client/marionette/tests/unit/test_pagesource.py
testing/marionette/client/marionette/tests/unit/unit-tests.ini
testing/marionette/client/marionette/www/testPageSourceWithUnicodeChars.html
--- a/testing/marionette/client/marionette/tests/unit/test_pagesource.py
+++ b/testing/marionette/client/marionette/tests/unit/test_pagesource.py
@@ -1,29 +1,36 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from marionette_test import MarionetteTestCase
+from marionette_test import MarionetteTestCase, skip_if_b2g
 
 class TestPageSource(MarionetteTestCase):
     def testShouldReturnTheSourceOfAPage(self):
         test_html = self.marionette.absolute_url("testPageSource.html")
         self.marionette.navigate(test_html)
         source = self.marionette.page_source
         self.assertTrue("<html" in source)
         self.assertTrue("PageSource" in source)
 
+    def testShouldReturnTheSourceOfAPageWhenThereAreUnicodeChars(self):
+        test_html = self.marionette.absolute_url("testPageSourceWithUnicodeChars.html")
+        self.marionette.navigate(test_html)
+        # if we don't throw on the next line we are good!
+        self.marionette.page_source
+
     def testShouldReturnAXMLDocumentSource(self):
         test_xml = self.marionette.absolute_url("testPageSource.xml")
         self.marionette.navigate(test_xml)
         source = self.marionette.page_source
         import re
         self.assertEqual(re.sub("\s", "", source), "<xml><foo><bar>baz</bar></foo></xml>")
 
+
 class TestPageSourceChrome(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
         self.marionette.set_context("chrome")
         self.win = self.marionette.current_window_handle
         self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
         self.marionette.switch_to_window('foo')
         self.assertNotEqual(self.win, self.marionette.current_window_handle)
--- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini
+++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini
@@ -82,16 +82,17 @@ browser = false
 [test_simpletest_chrome.js]
 [test_simpletest_timeout.js]
 [test_specialpowers.py]
 [test_switch_frame.py]
 [test_switch_frame_chrome.py]
 [test_switch_remote_frame.py]
 
 [test_pagesource.py]
+b2g = false
 
 [test_visibility.py]
 [test_window_switching.py]
 b2g = false
 [test_window_management.py]
 b2g = false
 
 [test_appcache.py]
new file mode 100644
--- /dev/null
+++ b/testing/marionette/client/marionette/www/testPageSourceWithUnicodeChars.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8"/>
+    <meta http-equiv="pragma" content="no-cache"/>
+    <!--
+      - the « section[id^="wifi-"] » selector.
+      -->
+  </body>
+</html>
+