Home | History | Annotate | Download | only in src
      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
      5 Use of this source code is governed by a BSD-style license that can be
      6 found in the LICENSE file.
      7 -->
      8 <head>
      9 <title>UI tests</title>
     10 <script src="base.js"></script>
     11 <script>
     12   base.require('unittest');
     13   base.require('ui');
     14 </script>
     15 </head>
     16 <body>
     17 <script>
     18     'use strict';
     19 
     20     var TestElement = tracing.ui.define('div');
     21     TestElement.prototype = {
     22       __proto__: HTMLDivElement.prototype,
     23 
     24       decorate: function() {
     25         if (!this.decorateCallCount)
     26           this.decorateCallCount = 0;
     27         this.decorateCallCount++;
     28       }
     29     };
     30 
     31     function testDecorateOnceViaNew() {
     32       var testElement = new TestElement();
     33       assertEquals(1, testElement.decorateCallCount);
     34     }
     35 
     36     function testDecorateOnceDirectly() {
     37       var testElement = document.createElement('div');
     38       tracing.ui.decorate(testElement, TestElement);
     39       assertEquals(1, testElement.decorateCallCount);
     40     }
     41 </script>
     42 </body>
     43 </html>
     44