3 <script src="../http/tests/inspector/inspector-test.js"></script>
8 function TestView(viewName, requiredCSS, requiredCSS2)
10 WebInspector.View.call(this);
12 this.registerRequiredCSS(requiredCSS);
14 this.registerRequiredCSS(requiredCSS2);
15 this._viewName = viewName;
18 TestView.prototype = {
19 show: function(parentElement)
21 InspectorTest.addResult(this._viewName + ".show()");
22 WebInspector.View.prototype.show.call(this, parentElement);
27 InspectorTest.addResult(this._viewName + ".detach()");
28 WebInspector.View.prototype.detach.call(this);
32 TestView.prototype.__proto__ = WebInspector.View.prototype;
41 function dumpCssChanges()
43 for (var file in WebInspector.View._cssFileToStyleElement)
44 if (cssToLoad.hasOwnProperty(file)) {
45 if ((!WebInspector.View._cssFileToStyleElement[file] && !cssToLoad[file]) ||
46 (WebInspector.View._cssFileToStyleElement[file].disabled !== cssToLoad[file])) {
47 InspectorTest.addResult((WebInspector.View._cssFileToStyleElement[file].disabled ? " UNLOAD " : " LOAD ") + file);
48 cssToLoad[file] = WebInspector.View._cssFileToStyleElement[file].disabled;
53 WebInspector.View._cssUnloadTimeout = 0;
55 var parentView = new TestView("Parent", "parent.css");
56 var childView1 = new TestView("Child 1", "child.css", "child1.css");
57 var childView2 = new TestView("Child 2", "child.css", "child2.css");
59 InspectorTest.runTestSuite([
60 function testEvents(next)
62 parentView.show(WebInspector.inspectorView.element);
65 childView1.show(parentView.element);
68 childView2.show(parentView.element);
71 childView2.detach(parentView.element);
74 setTimeout(next, WebInspector.View._cssUnloadTimeout);
77 function childDetachTimeout(next)
84 setTimeout(next, WebInspector.View._cssUnloadTimeout);
87 function parentDetachTimeout(next)
91 parentView.show(WebInspector.inspectorView.element);
97 function quickDetachAttach(next) {
101 childView1.show(parentView.element);
104 setTimeout(next, WebInspector.View._cssUnloadTimeout);
107 function checkThatNothingUnloaded(next) {
117 <body onload="runTest()">
119 This tests that CSS files are properly loaded / unloaded upon view show / detach.