From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- testing/web-platform/tests/page-visibility/OWNERS | 3 + .../tests/page-visibility/idlharness.html | 48 ++++++ .../resources/blank_page_green.html | 10 ++ .../resources/pagevistestharness.js | 121 +++++++++++++ .../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 | 188 +++++++++++++++++++++ .../tests/page-visibility/test_read_only.html | 37 ++++ .../test_tab_state_change-manual.html | 186 ++++++++++++++++++++ .../tests/page-visibility/unload-1.html | 17 ++ .../web-platform/tests/page-visibility/unload.html | 18 ++ 12 files changed, 787 insertions(+) create mode 100644 testing/web-platform/tests/page-visibility/OWNERS create mode 100644 testing/web-platform/tests/page-visibility/idlharness.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/pagevistestharness.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-1.html create mode 100644 testing/web-platform/tests/page-visibility/unload.html (limited to 'testing/web-platform/tests/page-visibility') diff --git a/testing/web-platform/tests/page-visibility/OWNERS b/testing/web-platform/tests/page-visibility/OWNERS new file mode 100644 index 000000000..56997198b --- /dev/null +++ b/testing/web-platform/tests/page-visibility/OWNERS @@ -0,0 +1,3 @@ +@plehegar +@igrigorik +@toddreifsteck diff --git a/testing/web-platform/tests/page-visibility/idlharness.html b/testing/web-platform/tests/page-visibility/idlharness.html new file mode 100644 index 000000000..c8086a1bc --- /dev/null +++ b/testing/web-platform/tests/page-visibility/idlharness.html @@ -0,0 +1,48 @@ + + + + +Page Visibility IDL tests + + + + + + + + +

Page Visibility IDL tests

+ + + +
+enum VisibilityState { "hidden", "visible", "prerender", "unloaded" };
+
+partial interface Document {
+  readonly attribute boolean hidden;
+  readonly attribute VisibilityState visibilityState;
+};
+
+ + + +
+ + + 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 000000000..b8a1947b7 --- /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/pagevistestharness.js b/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js new file mode 100644 index 000000000..d53d73b42 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/resources/pagevistestharness.js @@ -0,0 +1,121 @@ +/* +Distributed under both the W3C Test Suite License [1] and the W3C +3-clause BSD License [2]. To contribute to a W3C Test Suite, see the +policies and contribution forms [3]. + +[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license +[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license +[3] http://www.w3.org/2004/10/27-testcases +*/ + +// +// Helper Functions for PageVisibility W3C 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_true(document.hidden !== undefined, hiddenMsg);}, hiddenMsg, doc); + pv_test(function(){assert_true(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'); + setTimeout(function() { open_link.close(); }, 2000); +} 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 000000000..748161fdf --- /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 000000000..77ec8f8fd --- /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 000000000..6e2f97084 --- /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 000000000..28e848676 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_minimize-manual.html @@ -0,0 +1,188 @@ + + + + + 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 000000000..6d3702292 --- /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 000000000..c701e5078 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/test_tab_state_change-manual.html @@ -0,0 +1,186 @@ + + + + + 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-1.html b/testing/web-platform/tests/page-visibility/unload-1.html new file mode 100644 index 000000000..b54851878 --- /dev/null +++ b/testing/web-platform/tests/page-visibility/unload-1.html @@ -0,0 +1,17 @@ + + +Document + +

Document

+ + + 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 000000000..48cf203cd --- /dev/null +++ b/testing/web-platform/tests/page-visibility/unload.html @@ -0,0 +1,18 @@ + +visibilitychange fires on unload + + +
+ -- cgit v1.2.3