Web Inspector: clean up initialization of managers and observers in InspectorTest
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jan 2014 01:56:54 +0000 (01:56 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jan 2014 01:56:54 +0000 (01:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127707

Reviewed by Timothy Hatcher.

The test harness was setting up managers and observers before
telling the frontend host that the page loaded. The InspectorObserver
was also not being initialized.

For clarity, rename importInspectorScripts to initializeInspectorModels.
For easier debugging, make model test assertions use InspectorTest.log.

* http/tests/inspector-protocol/resources/InspectorTest.js:
(InspectorTest.initializeInspectorModels.console.error.window.onerror):
(InspectorTest.initializeInspectorModels.console.assert):
(InspectorTest.initializeInspectorModels):
* inspector-protocol/model/content-flow-content-nodes.html:
* inspector-protocol/model/content-flow-content-removal.html:
* inspector-protocol/model/content-flow-list.html:
* inspector-protocol/model/content-node-region-info.html:
* inspector-protocol/model/main-frame-resource.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js
LayoutTests/inspector-protocol/model/content-flow-content-nodes.html
LayoutTests/inspector-protocol/model/content-flow-content-removal.html
LayoutTests/inspector-protocol/model/content-flow-list.html
LayoutTests/inspector-protocol/model/content-node-region-info.html
LayoutTests/inspector-protocol/model/main-frame-resource.html

index ba2be61b2698b383bd974236de009c34cf8ebca8..52602b9880a44f398f9beae95f27d2281a0f64bc 100644 (file)
@@ -1,3 +1,27 @@
+2014-01-27  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: clean up initialization of managers and observers in InspectorTest
+        https://bugs.webkit.org/show_bug.cgi?id=127707
+
+        Reviewed by Timothy Hatcher.
+
+        The test harness was setting up managers and observers before
+        telling the frontend host that the page loaded. The InspectorObserver
+        was also not being initialized.
+
+        For clarity, rename importInspectorScripts to initializeInspectorModels.
+        For easier debugging, make model test assertions use InspectorTest.log.
+
+        * http/tests/inspector-protocol/resources/InspectorTest.js:
+        (InspectorTest.initializeInspectorModels.console.error.window.onerror):
+        (InspectorTest.initializeInspectorModels.console.assert):
+        (InspectorTest.initializeInspectorModels):
+        * inspector-protocol/model/content-flow-content-nodes.html:
+        * inspector-protocol/model/content-flow-content-removal.html:
+        * inspector-protocol/model/content-flow-list.html:
+        * inspector-protocol/model/content-node-region-info.html:
+        * inspector-protocol/model/main-frame-resource.html:
+
 2014-01-27  David Hyatt  <hyatt@apple.com>
 
         [New Multicolumn] Add support for block progression axis and reverse direction
index ff1d32c19794b69066df91fac1a40c708312d03f..b632db61e6a45de7bf8478c5f5da49f0a2770085 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -151,12 +152,12 @@ InspectorTest.importScript = function(scriptName)
     window.eval(script);
 }
 
-InspectorTest.importInspectorScripts = function()
+InspectorTest.initializeInspectorModels = function()
 {
     // Catch any errors and finish the test early.
     console.error = window.onerror = function()
     {
-        console.log(Array.prototype.join.call(arguments, ', '));
+        InspectorTest.log(Array.prototype.join.call(arguments, ', '));
         InspectorTest.completeTest();
     };
 
@@ -164,8 +165,8 @@ InspectorTest.importInspectorScripts = function()
     {
         if (assertion)
             return;
-        console.log("ASSERT:" + message);
         InspectorTest.completeTest();
+        InspectorTest.log("ASSERT:" + message);
     };
 
     // Note: This function overwrites the InspectorFrontendAPI, so there's currently no
@@ -183,6 +184,7 @@ InspectorTest.importInspectorScripts = function()
         "URLUtilities",
         "MessageDispatcher",
         "Setting",
+        "InspectorObserver",
         "PageObserver",
         "DOMObserver",
         "CSSObserver",
@@ -206,6 +208,8 @@ InspectorTest.importInspectorScripts = function()
         "RuntimeObserver",
         "RuntimeManager"
     ];
+
+    // This corresponds to loading the scripts in Main.hml.
     for (var i = 0; i < inspectorScripts.length; ++i)
         InspectorTest.importScript("../../../../../Source/WebInspectorUI/UserInterface/" + inspectorScripts[i] + ".js");
 
@@ -213,6 +217,12 @@ InspectorTest.importInspectorScripts = function()
     // FIXME: As soon as we can support all the observers and managers we should remove UI related tasks
     // from WebInspector.loaded, so that it can be used from the LayoutTests.
 
+    InspectorFrontendHost.loaded();
+
+    // Enable agents.
+    InspectorAgent.enable();
+
+    InspectorBackend.registerInspectorDispatcher(new WebInspector.InspectorObserver);
     InspectorBackend.registerPageDispatcher(new WebInspector.PageObserver);
     InspectorBackend.registerDOMDispatcher(new WebInspector.DOMObserver);
     InspectorBackend.registerCSSDispatcher(new WebInspector.CSSObserver);
@@ -223,8 +233,6 @@ InspectorTest.importInspectorScripts = function()
     WebInspector.domTreeManager = new WebInspector.DOMTreeManager;
     WebInspector.cssStyleManager = new WebInspector.CSSStyleManager;
     WebInspector.runtimeManager = new WebInspector.RuntimeManager;
-
-    InspectorFrontendHost.loaded();
 }
 
 
index 4f251c55069f0d52479cda07746f12776601cf04..4f2187e48347841c8efccd713cd7e2f9c37f88db 100644 (file)
@@ -25,7 +25,7 @@ function changeFlowContent()
 
 function test()
 {
-    InspectorTest.importInspectorScripts();
+    InspectorTest.initializeInspectorModels();
 
     var contentFlow;
 
index 6dda056419ab35579464b349f89c34e08bfd768a..874a096d27e56f906eebfcce3c45dd7931b2b4a8 100644 (file)
@@ -16,7 +16,7 @@ function changeFlowContent()
 
 function test()
 {
-    InspectorTest.importInspectorScripts();
+    InspectorTest.initializeInspectorModels();
 
     var contentFlow;
 
index a273eb1fd5733598a7b7ccacd7b45904a9b7408b..0bc56fe80ad6bc2109a6365f3d024b09a3128252 100644 (file)
@@ -16,7 +16,7 @@ function removeFlow()
 
 function test()
 {
-    InspectorTest.importInspectorScripts();
+    InspectorTest.initializeInspectorModels();
 
     WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, function(event) {
         var domTree = WebInspector.frameResourceManager.mainFrame.domTree;
index a91dbe41a1199cad191a00c78ff9c993d4d24339..2fba473bd9b6a41ed998a09e81899630cd0a2dd0 100644 (file)
@@ -30,7 +30,7 @@ function test()
     var queryList = ["#flow", ".contentNode1", ".contentNode2", "body", "#region1", "#region2"];
     var documentNodeId;
 
-    InspectorTest.importInspectorScripts();
+    InspectorTest.initializeInspectorModels();
     WebInspector.domTreeManager.requestDocument(function(documentNode) {
         documentNodeId = documentNode.id;
         WebInspector.domTreeManager.getNamedFlowCollection(documentNodeId);
index fc113790b2f36b07ece7b62fe3ed2d8d749d16d8..f83b02dbb51c3bf9ce2d2fecc6f9b9b90050a9b9 100644 (file)
@@ -5,7 +5,7 @@
 <script>
 function test()
 {
-    InspectorTest.importInspectorScripts();
+    InspectorTest.initializeInspectorModels();
 
     WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, function(event) {
         var url = WebInspector.frameResourceManager.mainFrame.url;