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

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html

Issue 2658473002: Refactor BluetoothAllowedDevicesMap (Closed)
Patch Set: cleaned up layout test code Created 3 years, 10 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/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html
new file mode 100644
index 0000000000000000000000000000000000000000..b3da705a8dfb23db0111e92804dea90a0074d42d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/bluetooth/bluetooth-helpers.js"></script>
+<script>
+ "use strict";
+ var firstIframe = true;
+ var iframe1 = document.createElement('iframe');
+ iframe1.src = '../../../resources/bluetooth/heart-rate-two-iframes.html';
+ iframe1.id = 'iframe1';
+ var iframe2 = document.createElement('iframe');
+ iframe2.src = '../../../resources/bluetooth/heart-rate-two-iframes.html';
+ iframe2.id = 'iframe2';
+ async_test(test => {
+ window.onmessage = messageEvent => test.step(() => {
+ if (messageEvent.data === 'Ready') {
+ if (firstIframe) {
+ callWithKeyDown(() => {
+ iframe1.contentWindow.postMessage('Iframe1RequestAndConnect', '*');
+ });
+ } else {
+ callWithKeyDown(() => {
+ iframe2.contentWindow.postMessage('Iframe2RequestAndConnect', '*');
+ });
+ }
+ firstIframe = false;
+ } else if (messageEvent.data === 'Iframe1Connected') {
+ document.body.appendChild(iframe2);
+ } else if (messageEvent.data === 'Iframe2Connected') {
+ callWithKeyDown(() => {
+ iframe1.contentWindow.postMessage('TestIframe1HasGenericAccessService', '*');
+ });
+ }
+ else if (messageEvent.data === 'DoneTest') {
+ test.done();
+ } else {
+ assert_unreached('iframe sent invalid data: ' + messageEvent.data);
+ }
+ });
+
+ setBluetoothFakeAdapter('HeartRateAdapter')
+ .then(() => {
+ document.body.appendChild(iframe1);
+ });
+ }, 'Two iframes in the same origin should be able to access each other\'s services');
+</script>

Powered by Google App Engine
This is Rietveld 408576698