From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/page-visibility/META.yml | 4 + .../page-visibility/iframe-session-history.html | 65 +++++++ .../tests/page-visibility/iframe-unload.html | 49 ++++++ .../tests/page-visibility/minimize.html | 53 ++++++ .../tests/page-visibility/onvisibilitychange.html | 16 ++ .../resources/blank_page_green.html | 10 ++ .../resources/iframe-post-load.html | 8 + .../resources/iframe-with-subframes.html | 6 + .../tests/page-visibility/resources/iframe.html | 12 ++ .../resources/pagevistestharness.js | 112 ++++++++++++ .../page-visibility/resources/unload-bubbles.html | 19 +++ .../tests/page-visibility/resources/unload.html | 17 ++ .../resources/window_state_context.js | 19 +++ .../page-visibility/test_attributes_exist.html | 22 +++ .../tests/page-visibility/test_child_document.html | 94 ++++++++++ .../tests/page-visibility/test_default_view.html | 43 +++++ .../page-visibility/test_minimize-manual.html | 189 +++++++++++++++++++++ .../tests/page-visibility/test_read_only.html | 37 ++++ .../test_tab_state_change-manual.html | 187 ++++++++++++++++++++ .../tests/page-visibility/unload-bubbles.html | 22 +++ .../web-platform/tests/page-visibility/unload.html | 18 ++ .../visibility-state-entry.tentative.html | 82 +++++++++ 22 files changed, 1084 insertions(+) create mode 100644 testing/web-platform/tests/page-visibility/META.yml create mode 100644 testing/web-platform/tests/page-visibility/iframe-session-history.html create mode 100644 testing/web-platform/tests/page-visibility/iframe-unload.html create mode 100644 testing/web-platform/tests/page-visibility/minimize.html create mode 100644 testing/web-platform/tests/page-visibility/onvisibilitychange.html create mode 100644 testing/web-platform/tests/page-visibility/resources/blank_page_green.html create mode 100644 testing/web-platform/tests/page-visibility/resources/iframe-post-load.html create mode 100644 testing/web-platform/tests/page-visibility/resources/iframe-with-subframes.html create mode 100644 testing/web-platform/tests/page-visibility/resources/iframe.html create mode 100644 testing/web-platform/tests/page-visibility/resources/pagevistestharness.js create mode 100644 testing/web-platform/tests/page-visibility/resources/unload-bubbles.html create mode 100644 testing/web-platform/tests/page-visibility/resources/unload.html create mode 100644 testing/web-platform/tests/page-visibility/resources/window_state_context.js create mode 100644 testing/web-platform/tests/page-visibility/test_attributes_exist.html create mode 100644 testing/web-platform/tests/page-visibility/test_child_document.html create mode 100644 testing/web-platform/tests/page-visibility/test_default_view.html create mode 100644 testing/web-platform/tests/page-visibility/test_minimize-manual.html create mode 100644 testing/web-platform/tests/page-visibility/test_read_only.html create mode 100644 testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html create mode 100644 testing/web-platform/tests/page-visibility/unload-bubbles.html create mode 100644 testing/web-platform/tests/page-visibility/unload.html create mode 100644 testing/web-platform/tests/page-visibility/visibility-state-entry.tentative.html (limited to 'testing/web-platform/tests/page-visibility') diff --git a/testing/web-platform/tests/page-visibility/META.yml b/testing/web-platform/tests/page-visibility/META.yml new file mode 100644 index 0000000000..9b9aea8e8b --- /dev/null +++ b/testing/web-platform/tests/page-visibility/META.yml @@ -0,0 +1,4 @@ +spec: https://w3c.github.io/page-visibility/ +suggested_reviewers: + - plehegar + - igrigorik diff --git a/testing/web-platform/tests/page-visibility/iframe-session-history.html b/testing/web-platform/tests/page-visibility/iframe-session-history.html new file mode 100644 index 0000000000..e023215316 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/iframe-session-history.html @@ -0,0 +1,65 @@ + +Test the correct sequence of pagevisibility-related events in conjunction with history navigation + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/page-visibility/iframe-unload.html b/testing/web-platform/tests/page-visibility/iframe-unload.html new file mode 100644 index 0000000000..6d049a846d --- /dev/null +++ b/testing/web-platform/tests/page-visibility/iframe-unload.html @@ -0,0 +1,49 @@ + +visibilitychange fires on unload with iframes + + +
+ + + + diff --git a/testing/web-platform/tests/page-visibility/minimize.html b/testing/web-platform/tests/page-visibility/minimize.html new file mode 100644 index 0000000000..ca834f74b6 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/minimize.html @@ -0,0 +1,53 @@ + +Test different scenarios of how browser interactions are reflected by page visibility + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/page-visibility/onvisibilitychange.html b/testing/web-platform/tests/page-visibility/onvisibilitychange.html new file mode 100644 index 0000000000..f854084280 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/onvisibilitychange.html @@ -0,0 +1,16 @@ + +onvisibilitychange attribute is a proper event handler + + +
+ + diff --git a/testing/web-platform/tests/page-visibility/resources/blank_page_green.html b/testing/web-platform/tests/page-visibility/resources/blank_page_green.html new file mode 100644 index 0000000000..b8a1947b77 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/blank_page_green.html @@ -0,0 +1,10 @@ + + + + + Green Test Page + + +

Placeholder

+ + diff --git a/testing/web-platform/tests/page-visibility/resources/iframe-post-load.html b/testing/web-platform/tests/page-visibility/resources/iframe-post-load.html new file mode 100644 index 0000000000..5c8f2e3a08 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/iframe-post-load.html @@ -0,0 +1,8 @@ + + + + + + diff --git a/testing/web-platform/tests/page-visibility/resources/iframe-with-subframes.html b/testing/web-platform/tests/page-visibility/resources/iframe-with-subframes.html new file mode 100644 index 0000000000..febb954369 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/iframe-with-subframes.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/testing/web-platform/tests/page-visibility/resources/iframe.html b/testing/web-platform/tests/page-visibility/resources/iframe.html new file mode 100644 index 0000000000..e08acb827a --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/iframe.html @@ -0,0 +1,12 @@ + + +Document + +

Document

+ + + diff --git a/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js b/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js new file mode 100644 index 0000000000..d164d4603b --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js @@ -0,0 +1,112 @@ +// +// Helper functions for Page Visibility tests +// + +var VISIBILITY_STATES = +{ + HIDDEN: "hidden", + VISIBLE: "visible" +}; + +var feature_check = false; + +// +// All test() functions in the WebPerf PageVis test suite should use pv_test() instead. +// +// pv_test() validates the document.hidden and document.visibilityState attributes +// exist prior to running tests and immediately shows a failure if they do not. +// + +function pv_test(func, msg, doc) +{ + if (!doc) + { + doc = document; + } + + // only run the feature check once, unless func == null, in which case, + // this call is intended as a feature check + if (!feature_check) + { + feature_check = true; + + var hiddenVal = doc.hidden; + var visStateVal = doc.visibilityState; + + // show a single error that the Page Visibility feature is undefined + test(function() + { + assert_true(hiddenVal !== undefined && hiddenVal != null, + "document.hidden is defined and not null.");}, + "document.hidden is defined and not null."); + + test(function() + { + assert_true(visStateVal !== undefined && hiddenVal != null, + "document.visibilityState is defined and not null.");}, + "document.visibilityState is defined and not null."); + + } + + if (func) + { + test(func, msg); + } +} + + +function test_feature_exists(doc, msg) +{ + if (!msg) + { + msg = ""; + } + var hiddenMsg = "document.hidden is defined" + msg + "."; + var stateMsg = "document.visibilityState is defined" + msg + "."; + pv_test(function(){assert_not_equals(document.hidden, undefined, hiddenMsg);}, hiddenMsg, doc); + pv_test(function(){assert_not_equals(document.visibilityState, undefined, stateMsg);}, stateMsg, doc); +} + +// +// Common helper functions +// + +function test_true(value, msg) +{ + pv_test(function() { assert_true(value, msg); }, msg); +} + +function test_equals(value, equals, msg) +{ + pv_test(function() { assert_equals(value, equals, msg); }, msg); +} + +// +// asynchronous test helper functions +// + +function add_async_result(test_obj, pass_state) +{ + // add assertion to manual test for the pass state + test_obj.step(function() { assert_true(pass_state) }); + + // end manual test + test_obj.done(); +} + +function add_async_result_assert(test_obj, func) +{ + // add assertion to manual test for the pass state + test_obj.step(func); + + // end manual test + test_obj.done(); +} + +var open_link; +function TabSwitch() +{ + //var open_link = window.open("http://www.bing.com"); + open_link = window.open('', '_blank'); + step_timeout(function() { open_link.close(); }, 2000); +} diff --git a/testing/web-platform/tests/page-visibility/resources/unload-bubbles.html b/testing/web-platform/tests/page-visibility/resources/unload-bubbles.html new file mode 100644 index 0000000000..cc9e14f787 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/unload-bubbles.html @@ -0,0 +1,19 @@ + + +Document + +

Document

+ + + diff --git a/testing/web-platform/tests/page-visibility/resources/unload.html b/testing/web-platform/tests/page-visibility/resources/unload.html new file mode 100644 index 0000000000..b548518784 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/unload.html @@ -0,0 +1,17 @@ + + +Document + +

Document

+ + + diff --git a/testing/web-platform/tests/page-visibility/resources/window_state_context.js b/testing/web-platform/tests/page-visibility/resources/window_state_context.js new file mode 100644 index 0000000000..40f10a5644 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/window_state_context.js @@ -0,0 +1,19 @@ +function window_state_context(t) { + let rect = null; + let state = "restored"; + t.add_cleanup(async () => { + if (state === "minimized") + await restore(); + }); + async function restore() { + state = "restored"; + await test_driver.set_window_rect(rect); + } + + async function minimize() { + state = "minimized"; + rect = await test_driver.minimize_window(); + } + + return {minimize, restore}; +} diff --git a/testing/web-platform/tests/page-visibility/test_attributes_exist.html b/testing/web-platform/tests/page-visibility/test_attributes_exist.html new file mode 100644 index 0000000000..748161fdf8 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_attributes_exist.html @@ -0,0 +1,22 @@ + + + + + Page Visibility API Definition + + + + + + +

Description

+

This test validates that all of the attributes associated with the Page Visibility feature exist + (but does not validate that their values are correct).

+ +
+ + + + diff --git a/testing/web-platform/tests/page-visibility/test_child_document.html b/testing/web-platform/tests/page-visibility/test_child_document.html new file mode 100644 index 0000000000..77ec8f8fd2 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_child_document.html @@ -0,0 +1,94 @@ + + + + + Page Visibility API Child Document Test + + + + + + + + + + +

Description

+

This test validates that, within child documents, all of the Page Visibility API attributes exist, + are read-only, and match the value of the attributes within the parent document.

+ +
+ +
+ +
+ IFrame with no style attribute +
+ +
+ +
+ IFrame with "display:none" style
+ +
+ +
+ IFrame with "visibility:hidden" style +
+ +
+ + diff --git a/testing/web-platform/tests/page-visibility/test_default_view.html b/testing/web-platform/tests/page-visibility/test_default_view.html new file mode 100644 index 0000000000..6e2f97084f --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_default_view.html @@ -0,0 +1,43 @@ + + + + + Page Visibility Null Default View Test + + + + + + + + + +

Description

+

This test validates that document.hidden == false and + document.visibilityState == "visible" for windowless subdocuments.

+
+ + diff --git a/testing/web-platform/tests/page-visibility/test_minimize-manual.html b/testing/web-platform/tests/page-visibility/test_minimize-manual.html new file mode 100644 index 0000000000..27fd0d7cef --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_minimize-manual.html @@ -0,0 +1,189 @@ + + + + + Page Visibility API Operation While Minimizing Browser Window + + + + + + + +

Description

+

This test validates that the page properly becomes hidden and visible due to minimizing, maximizing, and + restoring the browser window.

+ +

Manual Test Steps:

+

+

    +
  1. Ensure this page is the foreground and click the "Start Test"
  2. +
  3. Minimize the browser
  4. +
  5. Restore or maximize the browser
  6. +
+ Note: This test will automatically timeout and fail if not completed within 60 seconds. +

+ + + +
+ +
+ IFrame with default style: +
+ +
+ IFrame with "display:none" style: +
+ + + + + diff --git a/testing/web-platform/tests/page-visibility/test_read_only.html b/testing/web-platform/tests/page-visibility/test_read_only.html new file mode 100644 index 0000000000..6d3702292d --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_read_only.html @@ -0,0 +1,37 @@ + + + + + Page Visibility API is Read Only + + + + + + + + +

Description

+

This test validates that the Page Visibility attributes are read only.

+ +
+ + diff --git a/testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html b/testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html new file mode 100644 index 0000000000..75d1da6e93 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html @@ -0,0 +1,187 @@ + + + + + Page Visibility API Operation While Changing Tabs + + + + + + + +

Description

+

This test validates that the page properly becomes hidden and visible due to switching tabs.

+ +

Manual Test Steps:

+

+

    +
  1. Ensure this page is the foreground and click the "Start Test"
  2. +
  3. Switch to another tab
  4. +
  5. Return to the current tab containing this test page
  6. +
+ Note: This test will automatically timeout and fail if not completed within 60 seconds. +

+ + + +
+ +
+ IFrame with default style: +
+ +
+ IFrame with "display:none" style: +
+ + + + + diff --git a/testing/web-platform/tests/page-visibility/unload-bubbles.html b/testing/web-platform/tests/page-visibility/unload-bubbles.html new file mode 100644 index 0000000000..19b169c5e6 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/unload-bubbles.html @@ -0,0 +1,22 @@ + +visibilitychange event bubbles when fired on unload + + +
+ diff --git a/testing/web-platform/tests/page-visibility/unload.html b/testing/web-platform/tests/page-visibility/unload.html new file mode 100644 index 0000000000..9b7dcb8c66 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/unload.html @@ -0,0 +1,18 @@ + +visibilitychange fires on unload + + +
+ diff --git a/testing/web-platform/tests/page-visibility/visibility-state-entry.tentative.html b/testing/web-platform/tests/page-visibility/visibility-state-entry.tentative.html new file mode 100644 index 0000000000..c62b6c583f --- /dev/null +++ b/testing/web-platform/tests/page-visibility/visibility-state-entry.tentative.html @@ -0,0 +1,82 @@ + +Test VisibleStateEntry + + + + + + + + + -- cgit v1.2.3