Changeset 145536 in webkit


Ignore:
Timestamp:
Mar 12, 2013 5:42:14 AM (11 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: Add a test for Workspace add/removeMapping methods.
https://bugs.webkit.org/show_bug.cgi?id=112035

Reviewed by Alexander Pavlov.

Source/WebCore:

Test: inspector/debugger/file-system-project-mapping.html

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.prototype._mapFileSystemToNetwork.mapFileSystemToNetwork):
(WebInspector.ScriptsPanel.prototype._mapFileSystemToNetwork):
(WebInspector.ScriptsPanel.prototype._mapNetworkToFileSystem.mapNetworkToFileSystem):
(WebInspector.ScriptsPanel.prototype._mapNetworkToFileSystem):

  • inspector/front-end/Workspace.js:

(WebInspector.Project.prototype._fileAdded):
(WebInspector.Workspace.prototype.addMapping):

LayoutTests:

  • http/tests/inspector/isolated-filesystem-test.js: Added.

(initialize_IsolatedFileSystemTest.InspectorTest.createIsolatedFileSystemManager):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystem):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.path):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.requestFileContent):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.setFileContent):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.requestFilesRecursive):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager.prototype.addMockFileSystem):
(initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager.prototype.removeMockFileSystem):
(initialize_IsolatedFileSystemTest):

  • inspector/debugger/file-system-project-mapping-expected.txt: Added.
  • inspector/debugger/file-system-project-mapping.html: Added.
  • inspector/debugger/resource-script-mapping.html:
  • inspector/file-system-project.html:
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r145533 r145536  
     12013-03-12  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Add a test for Workspace add/removeMapping methods.
     4        https://bugs.webkit.org/show_bug.cgi?id=112035
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        * http/tests/inspector/isolated-filesystem-test.js: Added.
     9        (initialize_IsolatedFileSystemTest.InspectorTest.createIsolatedFileSystemManager):
     10        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem):
     11        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.path):
     12        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.requestFileContent):
     13        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.setFileContent):
     14        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.requestFilesRecursive):
     15        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager):
     16        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager.prototype.addMockFileSystem):
     17        (initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager.prototype.removeMockFileSystem):
     18        (initialize_IsolatedFileSystemTest):
     19        * inspector/debugger/file-system-project-mapping-expected.txt: Added.
     20        * inspector/debugger/file-system-project-mapping.html: Added.
     21        * inspector/debugger/resource-script-mapping.html:
     22        * inspector/file-system-project.html:
     23
    1242013-03-12  Vsevolod Vlasov  <vsevik@chromium.org>
    225
  • trunk/LayoutTests/inspector/debugger/resource-script-mapping.html

    r139454 r145536  
    77function test()
    88{
    9     var workspace;
    109    var defaultScriptMapping;
    1110    function createResourceScriptMapping()
  • trunk/LayoutTests/inspector/file-system-project.html

    r144729 r145536  
    44<script src="../http/tests/inspector/debugger-test.js"></script>
    55<script src="../http/tests/inspector/workspace-test.js"></script>
     6<script src="../http/tests/inspector/isolated-filesystem-test.js"></script>
    67<script>
    78function test()
    89{
    9     var MockIsolatedFileSystem = function(id, path, files)
    10     {
    11         this._id = id;
    12         this._path = path;
    13         this._files = files;
    14     };
    15     MockIsolatedFileSystem.prototype = {
    16         id: function()
    17         {
    18             return this._id;
    19         },
    20 
    21         path: function()
    22         {
    23             return this._path;
    24         },
    25 
    26         requestFileContent: function(path, callback)
    27         {
    28             callback(this._files[path]);
    29         },
    30 
    31         setFileContent: function(path, newContent, callback)
    32         {
    33             this._files[path] = newContent;
    34             callback();
    35         },
    36 
    37         requestFilesRecursive: function(path, callback)
    38         {
    39             var files = Object.keys(this._files);
    40             for (var i = 0; i < files.length; ++i)
    41                 callback(files[i]);
    42         },
    43     }
    44 
    45     var MockIsolatedFileSystemManager = function() {};
    46     MockIsolatedFileSystemManager.prototype = {
    47         addMockFileSystem: function(path, files)
    48         {
    49             var id = InspectorTest.testFileSystemMapping.addFileSystemMapping(path);
    50             var fileSystem = new MockIsolatedFileSystem(id, path, files);
    51             this._fileSystems = this._fileSystems || {};
    52             this._fileSystems[path] = fileSystem;
    53             this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, fileSystem);
    54         },
    55 
    56         removeMockFileSystem: function(path)
    57         {
    58             var fileSystem = this._fileSystems[path];
    59             delete this._fileSystems[path];
    60             InspectorTest.testFileSystemMapping.removeFileSystemMapping(path);
    61             this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, fileSystem);
    62         },
    63 
    64         __proto__: WebInspector.Object.prototype
    65     }
    66 
    67     function createIsolatedFileSystemManager()
    68     {
    69         InspectorTest.createWorkspace();
    70         var manager = new MockIsolatedFileSystemManager();
    71         manager.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(manager, InspectorTest.testWorkspace);
    72         return manager;
    73     }
    74 
    7510    function dumpUISourceCodes(uiSourceCodes, next)
    7611    {
     
    9126        function testFileSystems(next)
    9227        {
     28            InspectorTest.createWorkspace();
     29            var manager = InspectorTest.createIsolatedFileSystemManager(InspectorTest.testWorkspace, InspectorTest.testFileSystemMapping);
    9330            var uiSourceCodes = [];
    94             var manager = createIsolatedFileSystemManager();
    9531            var entry1 = new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/localhost/");
    9632            var entry2 = new WebInspector.FileMapping.Entry("http://www.example.com/", "/foo/bar/");
  • trunk/Source/WebCore/ChangeLog

    r145533 r145536  
     12013-03-12  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Add a test for Workspace add/removeMapping methods.
     4        https://bugs.webkit.org/show_bug.cgi?id=112035
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        Test: inspector/debugger/file-system-project-mapping.html
     9
     10        * inspector/front-end/ScriptsPanel.js:
     11        (WebInspector.ScriptsPanel.prototype._mapFileSystemToNetwork.mapFileSystemToNetwork):
     12        (WebInspector.ScriptsPanel.prototype._mapFileSystemToNetwork):
     13        (WebInspector.ScriptsPanel.prototype._mapNetworkToFileSystem.mapNetworkToFileSystem):
     14        (WebInspector.ScriptsPanel.prototype._mapNetworkToFileSystem):
     15        * inspector/front-end/Workspace.js:
     16        (WebInspector.Project.prototype._fileAdded):
     17        (WebInspector.Workspace.prototype.addMapping):
     18
    1192013-03-12  Vsevolod Vlasov  <vsevik@chromium.org>
    220
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r145533 r145536  
    11241124        function mapFileSystemToNetwork(networkUISourceCode)
    11251125        {
    1126             this._workspace.addMapping(networkUISourceCode, uiSourceCode);
     1126            this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebInspector.fileSystemWorkspaceProvider);
    11271127        }
    11281128    },
     
    11491149        function mapNetworkToFileSystem(uiSourceCode)
    11501150        {
    1151             this._workspace.addMapping(networkUISourceCode, uiSourceCode);
     1151            this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebInspector.fileSystemWorkspaceProvider);
    11521152        }
    11531153    },
  • trunk/Source/WebCore/inspector/front-end/Workspace.js

    r145221 r145536  
    187187            return;
    188188        }
     189
    189190        uiSourceCode = new WebInspector.UISourceCode(this, fileDescriptor.path, fileDescriptor.originURL, fileDescriptor.url, fileDescriptor.contentType, fileDescriptor.isEditable);
    190191        uiSourceCode.isContentScript = fileDescriptor.isContentScript;
     
    482483     * @param {WebInspector.UISourceCode} networkUISourceCode
    483484     * @param {WebInspector.UISourceCode} uiSourceCode
    484      */
    485     addMapping: function(networkUISourceCode, uiSourceCode)
     485     * @param {WebInspector.FileSystemWorkspaceProvider} fileSystemWorkspaceProvider
     486     */
     487    addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceProvider)
    486488    {
    487489        var url = networkUISourceCode.url;
     
    494496            suffix = nextSuffix;
    495497        }
    496         var fileSystemPath = WebInspector.fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode);
     498        var fileSystemPath = fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode);
    497499        var filePath = "/" + path.join("/");
    498500        var pathPrefix = fileSystemPath + filePath.substr(0, filePath.length - suffix.length) + "/";
Note: See TracChangeset for help on using the changeset viewer.