Home | History | Annotate | Download | only in resources
      1 // Copyright 2015 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 debug = function debug(msg)
      6 {
      7   console.log(msg);
      8 };
      9 
     10 description = function description(msg, quiet)
     11 {
     12   console.log(msg);
     13 };
     14 
     15 finishJSTest = function finishJSTest() {
     16   console.log("TEST FINISHED");
     17 };
     18 
     19 function isWorker()
     20 {
     21   // It's conceivable that someone would stub out 'document' in a worker so
     22   // also check for childNodes, an arbitrary DOM-related object that is
     23   // meaningless in a WorkerContext.
     24   return (typeof document === 'undefined' ||
     25           typeof document.childNodes === 'undefined') && !!self.importScripts;
     26 }
     27 
     28 function handleTestFinished() {
     29   if (!window.jsTestIsAsync)
     30     finishJSTest();
     31 }
     32 
     33 // Returns a sorted array of property names of object.  This function returns
     34 // not only own properties but also properties on prototype chains.
     35 function getAllPropertyNames(object) {
     36     var properties = [];
     37     for (var property in object) {
     38         properties.push(property);
     39     }
     40     return properties.sort();
     41 }
     42 
     43 if (!isWorker()) {
     44   window.addEventListener('DOMContentLoaded', handleTestFinished, false);
     45 }
     46