Index: third_party/WebKit/LayoutTests/http/tests/sendbeacon/beacon-allowance-limit.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/sendbeacon/beacon-allowance-limit.html b/third_party/WebKit/LayoutTests/http/tests/sendbeacon/beacon-allowance-limit.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..095c322cab053cbf738b0953a83522dedd5c0852 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/sendbeacon/beacon-allowance-limit.html |
@@ -0,0 +1,17 @@ |
+<!DOCTYPE HTML> |
+<script src="/js-test-resources/testharness.js"></script> |
+<script src="/js-test-resources/testharnessreport.js"></script> |
+<script> |
+test(() => { |
+ // Note: the limit used must be same as Settings#maxBeaconTransmission. |
+ // First beacon request should go through, but with a zero allowance for |
+ // any subsequent requests. Which must fail. |
+ let payload = new Uint8Array(64 * 1024); |
+ let result = navigator.sendBeacon("resources/blank.txt", payload); |
+ assert_true(result); |
+ result = navigator.sendBeacon("resources/blank.txt", payload); |
+ assert_false(result); |
+}, "navigator.sendBeacon() with a payload size greater than " + |
+ "remaining transfer allowance should fail."); |
+</script> |
+</html> |