Bug 1307853 - Add web platform test (in mochitest suite). r=mats
authorL. David Baron <dbaron@dbaron.org>
Thu, 13 Oct 2016 11:41:52 -0700
changeset 424989 8002cb8086cd19892c926d7d511db954bde8653b
parent 424988 d61b47e3ac8a46f515978ac9cc2628485650b7f7
child 424990 829c16e72fb7099733a01b01d1cdcaa66f717248
push id32314
push userbmo:hiikezoe@mozilla-japan.org
push dateFri, 14 Oct 2016 00:31:54 +0000
reviewersmats
bugs1307853
milestone52.0a1
Bug 1307853 - Add web platform test (in mochitest suite). r=mats This test failed with the initial (non-working) version of the patch, and passes with the patch. MozReview-Commit-ID: IPmd7Yh604Z
layout/generic/test/file_bug1307853.html
layout/generic/test/mochitest.ini
layout/generic/test/test_bug1307853.html
new file mode 100644
--- /dev/null
+++ b/layout/generic/test/file_bug1307853.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<title>Iframe for test for Mozilla bug 1307853</title>
+<meta charset="UTF-8">
+<style>
+
+html, body { overflow: hidden; margin: 0; padding: 0; border: none; }
+
+.wrapper {
+  box-sizing: border-box;
+  width: 100px;
+  padding-right: 20%;
+}
+
+#inner {
+  height: 1em;
+  background: aqua;
+}
+
+</style>
+
+<div class="wrapper">
+  <div id="inner"></div>
+</div>
--- a/layout/generic/test/mochitest.ini
+++ b/layout/generic/test/mochitest.ini
@@ -97,16 +97,18 @@ skip-if = buildapp == 'b2g' # b2g(Target
 [test_bug831780.html]
 [test_bug841361.html]
 [test_bug904810.html]
 [test_bug938772.html]
 [test_bug970363.html]
 [test_bug1062406.html]
 [test_bug1174521.html]
 [test_bug1198135.html]
+[test_bug1307853.html]
+support-files = file_bug1307853.html
 [test_contained_plugin_transplant.html]
 skip-if = os=='win'
 [test_image_selection.html]
 [test_image_selection_2.html]
 [test_invalidate_during_plugin_paint.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' # b2g(plugins not supported) b2g-debug(plugins not supported) b2g-desktop(plugins not supported)
 [test_intrinsic_size_on_loading.html]
 [test_movement_by_characters.html]
new file mode 100644
--- /dev/null
+++ b/layout/generic/test/test_bug1307853.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<title>Test for Mozilla Bug 1307853</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+iframe {
+  margin: 0; padding: 0; border: none;
+}
+</style>
+<body onload="run_tests()">
+<iframe id="i" src="file_bug1307853.html" style="width: 200px; height: 100px"></iframe>
+<script>
+function run_tests() {
+  test(function() {
+         var iframe = document.getElementById("i");
+         var idoc = iframe.contentDocument;
+         var iwin = iframe.contentWindow;
+         var inner = idoc.getElementById("inner");
+
+         assert_equals(inner.clientWidth, 60,
+                       "width of element before iframe resize");
+         iframe.style.width = "300px";
+         assert_equals(inner.clientWidth, 40,
+                       "width of element after iframe resize");
+       },
+       "resize_iframe_percent_padding_fixed_width_boxsizing_borderbox");
+}
+</script>