()
| 58 | * apisample11.html and apisample12.html. |
| 59 | */ |
| 60 | function WindowTestEnvironment() { |
| 61 | this.name_counter = 0; |
| 62 | this.window_cache = null; |
| 63 | this.output_handler = null; |
| 64 | this.all_loaded = false; |
| 65 | var this_obj = this; |
| 66 | this.message_events = []; |
| 67 | this.dispatched_messages = []; |
| 68 | |
| 69 | this.message_functions = { |
| 70 | start: [add_start_callback, remove_start_callback, |
| 71 | function (properties) { |
| 72 | this_obj._dispatch("start_callback", [properties], |
| 73 | {type: "start", properties: properties}); |
| 74 | }], |
| 75 | |
| 76 | test_state: [add_test_state_callback, remove_test_state_callback, |
| 77 | function(test) { |
| 78 | this_obj._dispatch("test_state_callback", [test], |
| 79 | {type: "test_state", |
| 80 | test: test.structured_clone()}); |
| 81 | }], |
| 82 | result: [add_result_callback, remove_result_callback, |
| 83 | function (test) { |
| 84 | this_obj.output_handler.show_status(); |
| 85 | this_obj._dispatch("result_callback", [test], |
| 86 | {type: "result", |
| 87 | test: test.structured_clone()}); |
| 88 | }], |
| 89 | completion: [add_completion_callback, remove_completion_callback, |
| 90 | function (tests, harness_status) { |
| 91 | var cloned_tests = map(tests, function(test) { |
| 92 | return test.structured_clone(); |
| 93 | }); |
| 94 | this_obj._dispatch("completion_callback", [tests, harness_status], |
| 95 | {type: "complete", |
| 96 | tests: cloned_tests, |
| 97 | status: harness_status.structured_clone()}); |
| 98 | }] |
| 99 | } |
| 100 | |
| 101 | on_event(window, 'load', function() { |
| 102 | this_obj.all_loaded = true; |
| 103 | }); |
| 104 | |
| 105 | on_event(window, 'message', function(event) { |
| 106 | if (event.data && event.data.type === "getmessages" && event.source) { |
| 107 | // A window can post "getmessages" to receive a duplicate of every |
| 108 | // message posted by this environment so far. This allows subscribers |
| 109 | // from fetch_tests_from_window to 'catch up' to the current state of |
| 110 | // this environment. |
| 111 | for (var i = 0; i < this_obj.dispatched_messages.length; ++i) |
| 112 | { |
| 113 | event.source.postMessage(this_obj.dispatched_messages[i], "*"); |
| 114 | } |
| 115 | } |
| 116 | }); |
| 117 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…