Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: third_party/WebKit/LayoutTests/resize-observer/observe.html

Issue 2242773003: Revert of ResizeObserver pt6: integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/resize-observer/observe.html
diff --git a/third_party/WebKit/LayoutTests/resize-observer/observe.html b/third_party/WebKit/LayoutTests/resize-observer/observe.html
deleted file mode 100644
index a968c5465a8bc2fe6a4cafcd1578ab964a883738..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/resize-observer/observe.html
+++ /dev/null
@@ -1,160 +0,0 @@
-<!doctype html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="./resources/resizeTestHelper.js"></script>
-<p>ResizeObserver tests</p>
-<div id="target1" style="width:100px;height:100px;">t1</div>
-<div id="target2" style="width:100px;height:100px;">t2</div>
-<img id="target3" style="width:100px;height:100px;">
-<iframe src="./resources/iframe.html" width="300px" height="100px" style="display:block"></iframe>
-<script>
-'use strict';
-
-var helper = new ResizeTestHelper();
-
-let t1 = document.querySelector('#target1');
-let t2 = document.querySelector('#target2');
-
-// allow uncaught exception because ResizeObserver posts exceptions
-// to window error handler when limit is exceeded.
-setup({allow_uncaught_exception: true});
-
-function test0() {
- helper.createTest(
- "simple observation",
- _ => {
- helper.observer.disconnect();
- helper.observer.observe(t1);
- t1.style.width = "5px";
- },
- entries => {
- assert_equals(entries.length, 1, "1 pending notification");
- assert_equals(entries[0].target, t1, "target is t1");
- assert_equals(entries[0].contentRect.width, 5, "target width");
- test1();
- }
- );
- helper.nextTest();
-}
-
-function test1() {
- helper.createTest(
- "multiple observation on same element trigger only one",
- _ => {
- helper.observer.observe(t1);
- helper.observer.observe(t1);
- t1.style.width = "10px";
- },
- entries => {
- assert_equals(entries.length, 1, "1 pending notification");
- helper.observer.disconnect();
- test2();
- }
- );
- helper.nextTestRaf();
-}
-
-function test2() {
- test(_ => {
- assert_throws(null, _=> {
- helper.observer.observe({});
- });
- test3();
- },
- "throw exception when observing non-element"
- );
-}
-
-function test3() {
- helper.createTest(
- "disconnect stops all notifications",
- setup => {
- helper.observer.observe(t1);
- helper.observer.observe(t2);
- helper.observer.disconnect();
- t1.style.width = "30px";
- },
- entries => {
- assert_unreached("no entries should happen");
- },
- timeout => {
- // timeout happened, all is well.
- test4();
- }
- );
- helper.nextTestRaf();
-}
-
-function test4() {
- helper.createTest(
- "unobserve target stops notifications, unobserve non-observed does nothing",
- setup => {
- helper.observer.observe(t1);
- helper.observer.observe(t2);
- helper.observer.unobserve(t1);
- helper.observer.unobserve(document.body);
- t1.style.width = "40px";
- t2.style.width = "40px";
- },
- entries => {
- assert_equals(entries.length, 1, "only t2");
- assert_equals(entries[0].target, t2, "t2 was observed");
- helper.observer.disconnect();
- test5();
- }
- );
- helper.nextTestRaf();
-}
-
-function test5() {
- let t4 = document.querySelector('#target3');
- helper.createTest(
- "observe img",
- setup => {
- helper.observer.observe(t4);
- },
- entries => {
- helper.nextTest();
- }
- );
- helper.createTest(
- "observe img, part 2",
- setup => {
- t4.style.width = "100.5px";
- },
- entries => {
- assert_equals(entries.length, 1);
- assert_equals(entries[0].contentRect.width, 100.5);
- helper.observer.disconnect();
- test6();
- }
- );
- helper.nextTestRaf();
-}
-
-function test6() {
- let test = async_test('iframe notifications');
- let testRequested = false;
- let iframe = document.querySelector('iframe');
- window.addEventListener('message', event => {
- switch(event.data) {
- case 'readyToTest':
- if (!testRequested) {
- iframe.contentWindow.postMessage('startTest', '*');
- testRequested = true;
- }
- break;
- case 'success':
- case 'fail':
- test.step( () => {
- assert_equals(event.data, 'success');
- test.done();
- });
- break;
- }
- }, false);
-}
-
-test0();
-
-</script>

Powered by Google App Engine
This is Rietveld 408576698