| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 var gotDOMContentLoadedEvent = false; | |
| 6 | |
| 7 // Test that at parse time, we have the document element. | |
| 8 // This basically tests that we don't get injected too early (before there is | |
| 9 // a document element). | |
| 10 var hasDocumentElement = (document.documentElement.tagName == "HTML"); | |
| 11 | |
| 12 // TODO(aa): We would like to add more tests here verifying that we aren't | |
| 13 // injected too late. For example, we could test that there are zero child | |
| 14 // nodes to the documentElement, but unfortunately run_at:document_start is | |
| 15 // currently buggy and doesn't guarantee that. | |
| 16 | |
| 17 window.addEventListener("DOMContentLoaded", function() { | |
| 18 gotDOMContentLoadedEvent = true; | |
| 19 }, false); | |
| 20 | |
| 21 // Don't run tests until onload so that we can test that DOMContentLoaded and | |
| 22 // onload happen after this script runs. | |
| 23 window.addEventListener("load", runAllTests, false); | |
| 24 | |
| 25 function testRunAtDocumentStart() { | |
| 26 assert(hasDocumentElement); | |
| 27 } | |
| 28 | |
| 29 function testGotLoadEvents() { | |
| 30 assert(gotDOMContentLoadedEvent); | |
| 31 } | |
| OLD | NEW |