resize-lock.https.html (3879B)
1 <!DOCTYPE html> 2 <title>Test cases when fenced frame size shouldn't be restricted..</title> 3 <meta name="timeout" content="long"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/common/utils.js"></script> 7 <script src="/common/dispatcher/dispatcher.js"></script> 8 <script src="resources/utils.js"></script> 9 10 <body> 11 <script> 12 async function runTest(api1, 13 expected_initial_size, 14 expected_size_after_resize, 15 api2, 16 expected_size_after_renavigation, 17 expected_size_after_reresize) { 18 const initial_width = 321; 19 const initial_height = 51; 20 21 const resized_width = 729; 22 const resized_height = 91; 23 24 const reresized_width = 971; 25 const reresized_height = 251; 26 27 var frame = await attachFencedFrameContext({ 28 generator_api: api1, resolve_to_config: true, 29 attributes: [['width', initial_width], ['height', initial_height]]}); 30 31 const assert_dimensions = 32 (expected_width, expected_height) => { 33 getComputedStyle(document.documentElement).width; // Force layout. 34 assert_equals(window.innerWidth, expected_width, "width"); 35 assert_equals(window.innerHeight, expected_height, "height"); 36 } 37 38 // Check that the initial size of the fenced frame is what we expect. 39 await frame.execute(assert_dimensions, expected_initial_size); 40 41 // Resize the frame, and check that the size is now what we expect. 42 frame.element.width = resized_width; 43 frame.element.height = resized_height; 44 await frame.execute(assert_dimensions, expected_size_after_resize); 45 46 // Perform an embedder-initiated navigation, and check that the size is now 47 // what we expect (it should be based on the new context, rather than the old 48 // context). 49 frame = await replaceFrameContext(frame, {generator_api: api2, 50 resolve_to_config: true}); 51 await frame.execute(assert_dimensions, expected_size_after_renavigation); 52 53 // Resize the newly navigated frame, and check the size. 54 frame.element.width = reresized_width; 55 frame.element.height = reresized_height; 56 await frame.execute(assert_dimensions, expected_size_after_reresize); 57 } 58 59 promise_test(async () => { 60 return runTest('fledge', [320, 50], [320, 50], 61 'fledge', [728, 90], [728, 90]); }, 62 "FLEDGE->FLEDGE"); 63 promise_test(async () => { 64 return runTest('sharedstorage', [321, 51], [729, 91], 65 'sharedstorage', [729, 91], [971, 251]); }, 66 "sharedStorage->sharedStorage"); 67 promise_test(async () => { 68 return runTest('default', [321, 51], [729, 91], 69 'default', [729, 91], [971, 251]); }, 70 "default->default"); 71 promise_test(async () => { 72 return runTest('default', [321, 51], [729, 91], 73 'fledge', [728, 90], [728, 90]); }, 74 "default->FLEDGE"); 75 promise_test(async () => { 76 return runTest('default', [321, 51], [729, 91], 77 'sharedStorage', [729, 91], [971, 251]); }, 78 "default->sharedStorage"); 79 promise_test(async () => { 80 return runTest('fledge', [320, 50], [320, 50], 81 'default', [729, 91], [971, 251]); }, 82 "FLEDGE->default"); 83 promise_test(async () => { 84 return runTest('sharedstorage', [321, 51], [729, 91], 85 'default', [729, 91], [971, 251]); }, 86 "sharedStorage->default"); 87 promise_test(async () => { 88 return runTest('sharedstorage', [321, 51], [729, 91], 89 'fledge', [728, 90], [728, 90]); }, 90 "sharedStorage->FLEDGE"); 91 promise_test(async () => { 92 return runTest('fledge', [320, 50], [320, 50], 93 'sharedstorage', [729, 91], [971, 251]); }, 94 "FLEDGE->sharedStorage"); 95 </script> 96 </body>