Bug 123223 - Web Inspector: Add a way to test the Manager and model classes
Summary: Web Inspector: Add a way to test the Manager and model classes
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexandru Chiculita
Keywords: InRadar
Depends on:
Reported: 2013-10-23 14:52 PDT by Alexandru Chiculita
Modified: 2013-10-24 10:06 PDT (History)
5 users (show)

See Also:

Patch V1 (23.78 KB, patch)
2013-10-23 15:27 PDT, Alexandru Chiculita
joepeck: review-
joepeck: commit-queue-
Details | Formatted Diff | Diff
Patch V2 (24.60 KB, patch)
2013-10-23 16:22 PDT, Alexandru Chiculita
timothy: review+
Details | Formatted Diff | Diff
Patch V3 (24.87 KB, patch)
2013-10-24 09:37 PDT, Alexandru Chiculita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandru Chiculita 2013-10-23 14:52:23 PDT
Add a way to unit test the manager and model classes in the new WebInspector.
Comment 1 Radar WebKit Bug Importer 2013-10-23 14:52:47 PDT
Comment 2 Alexandru Chiculita 2013-10-23 15:27:45 PDT
Created attachment 215002 [details]
Patch V1
Comment 3 Joseph Pecoraro 2013-10-23 15:56:36 PDT
Comment on attachment 215002 [details]
Patch V1

View in context: https://bugs.webkit.org/attachment.cgi?id=215002&action=review

Clever, I like it. This looks good to me, but this will just need to fix Main.html missing new includes.

> LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js:110
> +    if (xhr.status !== 0)
> +        throw new Error("Invalid script URL: " + scriptName);

A status of 200 may need to be allowed if there is a LayoutTest/http/inspector-protocol test. Though I'm not sure that will ever happen.

> LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js:122
> +        "InspectorFrontendAPI",

When this is included it will overwrite the "InspectorFrontendAPI" implemented by LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js. We will need to be careful, if a test wants to grab events we'll need to re-incorporate a way to get back the protocol-test InspectorTest.eventHandler["Debugger.scriptParsed"] syntax, or something like it. But if we are indeed just testing the model, then we probably will never care about this.

> Source/WebInspectorUI/UserInterface/MessageDispatcher.js:1
> +/*

These new files will need to be included by Main.html, in the right order, so that the frontend itself still works! r- for this.

> Source/WebInspectorUI/UserInterface/URLUtilities.js:1
> +/*

I like that you've put all of this code in one file. I've had that itch for a while!
Comment 4 Alexandru Chiculita 2013-10-23 16:22:02 PDT
Created attachment 215009 [details]
Patch V2

Nice catch with the main.html file. I've run the test runner so many times, I forget to actually run the inspector itself.
Comment 5 Timothy Hatcher 2013-10-23 19:01:36 PDT
Comment on attachment 215009 [details]
Patch V2

View in context: https://bugs.webkit.org/attachment.cgi?id=215009&action=review

> LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js:157
> +    InspectorBackend.registerPageDispatcher(new WebInspector.PageObserver);
> +    InspectorBackend.registerDOMDispatcher(new WebInspector.DOMObserver);
> +
> +    WebInspector.frameResourceManager = new WebInspector.FrameResourceManager;
> +    WebInspector.domTreeManager = new WebInspector.DOMTreeManager;
> +
> +    InspectorFrontendHost.loaded();

This will need to mimic the code in Main.js. Either we should share it or at the very least add a comment to keep it in sync.

> Source/WebInspectorUI/UserInterface/URLUtilities.js:177
> +WebInspector.displayNameForURL = function(url, urlComponents)

It is tempting to remove the namespace here too to match the other functions now.

> Source/WebInspectorUI/UserInterface/URLUtilities.js:192
> +WebInspector.displayNameForHost = function(host)

Comment 6 Alexandru Chiculita 2013-10-24 09:37:48 PDT
Created attachment 215074 [details]
Patch V3

I've added a comment, but I didn't remove the namespace. I think we should namespace the other globals, otherwise it will just pollute the global window. I'm not changing that part of this patch as I might introduce other unrelated issues if I don't find all the usages.
Comment 7 WebKit Commit Bot 2013-10-24 10:06:41 PDT
Comment on attachment 215074 [details]
Patch V3

Clearing flags on attachment: 215074

Committed r157938: <http://trac.webkit.org/changeset/157938>
Comment 8 WebKit Commit Bot 2013-10-24 10:06:45 PDT
All reviewed patches have been landed.  Closing bug.