| Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/clients-get-cross-origin-frame.html | 
| diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/clients-get-cross-origin-frame.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/clients-get-cross-origin-frame.html | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..0977600366e63709f87a2d69c5fcf8a6304cb85f | 
| --- /dev/null | 
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/clients-get-cross-origin-frame.html | 
| @@ -0,0 +1,58 @@ | 
| +<!DOCTYPE html> | 
| +<script src="../../resources/testharness.js"></script> | 
| +<script src="../../resources/testharnessreport.js"></script> | 
| +<script src="../../resources/get-host-info.js"></script> | 
| +<script src="test-helpers.js"></script> | 
| +<script> | 
| +var host_info = get_host_info(); | 
| +var scope = 'blank.html?clients-get'; | 
| +var script = 'clients-get-worker.js'; | 
| + | 
| +var registration; | 
| +var worker; | 
| +var wait_for_worker_promise = navigator.serviceWorker.getRegistration(scope) | 
| +  .then(function(reg) { | 
| +      if (reg) | 
| +        return reg.unregister(); | 
| +    }) | 
| +  .then(function() { | 
| +      return navigator.serviceWorker.register(script, {scope: scope}); | 
| +    }) | 
| +  .then(function(reg) { | 
| +      registration = reg; | 
| +      worker = reg.installing; | 
| +      return new Promise(function(resolve) { | 
| +          worker.addEventListener('statechange', function() { | 
| +              if (worker.state == 'activated') | 
| +                resolve(); | 
| +            }); | 
| +        }); | 
| +    }); | 
| + | 
| +function send_result(result) { | 
| +  window.parent.postMessage( | 
| +      {result: result}, | 
| +      host_info['HTTP_ORIGIN']); | 
| +} | 
| + | 
| +window.addEventListener('message', function(e) { | 
| +  assert_equals(e.origin, host_info['HTTP_ORIGIN']); | 
| +  var cross_origin_client_ids = []; | 
| +  cross_origin_client_ids.push(e.data.clientId); | 
| +  wait_for_worker_promise | 
| +    .then(function() { | 
| +        return with_iframe(scope); | 
| +      }) | 
| +    .then(function(iframe) { | 
| +        add_completion_callback(function() { iframe.remove(); }); | 
| +        var channel = new MessageChannel(); | 
| +        channel.port1.onmessage = function(e) { | 
| +          registration.unregister(); | 
| +          send_result(e.data); | 
| +        }; | 
| +        iframe.contentWindow.navigator.serviceWorker.controller.postMessage( | 
| +            {port:channel.port2, clientIds: cross_origin_client_ids}, | 
| +            [channel.port2]); | 
| +      }); | 
| +}); | 
| +</script> | 
|  |