Changeset 248774 in webkit


Ignore:
Timestamp:
Aug 16, 2019 9:59:58 AM (5 years ago)
Author:
Devin Rousso
Message:

Unreviewed, fix test failure and add additional tests after r248753

  • inspector/unit-tests/url-utilities.html:
  • inspector/unit-tests/url-utilities-expected.txt:

Add additional tests of WI.displayNameForURL with paths, query strings, and fragments.

  • inspector/css/add-rule.html:
  • inspector/css/add-rule-expected.txt:

The doNotCreateIfMissing parameter was removed from preferredInspectorStyleSheetForFrame.
All the test is trying to do is check that there's not an existing Inspector Style Sheet, so
instead just check that the list of Inspector Style Sheets is empty.

Location:
trunk/LayoutTests
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248772 r248774  
     12019-08-16  Devin Rousso  <drousso@apple.com>
     2
     3        Unreviewed, fix test failure and add additional tests after r248753
     4
     5        * inspector/unit-tests/url-utilities.html:
     6        * inspector/unit-tests/url-utilities-expected.txt:
     7        Add additional tests of `WI.displayNameForURL` with paths, query strings, and fragments.
     8
     9        * inspector/css/add-rule.html:
     10        * inspector/css/add-rule-expected.txt:
     11        The `doNotCreateIfMissing` parameter was removed from `preferredInspectorStyleSheetForFrame`.
     12        All the test is trying to do is check that there's not an existing Inspector Style Sheet, so
     13        instead just check that the list of Inspector Style Sheets is empty.
     14
    1152019-08-16  Antti Koivisto  <antti@apple.com>
    216
  • trunk/LayoutTests/inspector/css/add-rule-expected.txt

    r217911 r248774  
    44== Running test suite: CSS.addRule
    55-- Running test case: CSS.addRule.InNonExistingInspectorStyleSheet
     6PASS: Should not have any inspector style sheets for the main frame.
    67PASS: Rule selector should be "body"
    78PASS: Rule range should be [0:0,0:4]
  • trunk/LayoutTests/inspector/css/add-rule.html

    r236766 r248774  
    4242            }
    4343
    44             function usedExistingInspectorStylesheet(styleSheet) {
    45                 reject("Inspector style sheet already exists");
    46             }
    47 
    48             const doNotCreateIfMissing = true;
    49             WI.cssManager.preferredInspectorStyleSheetForFrame(mainFrame, usedExistingInspectorStylesheet, doNotCreateIfMissing);
     44            InspectorTest.expectEqual(WI.cssManager.inspectorStyleSheetsForFrame(mainFrame).length, 0, "Should not have any inspector style sheets for the main frame.");
    5045
    5146            WI.cssManager.preferredInspectorStyleSheetForFrame(mainFrame, inspectorStyleSheetAvailable);
  • trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt

    r248753 r248774  
    393393PASS: Display name of 'http://example.com/path/to/' should be 'to'.
    394394PASS: Display name of 'http://example.com/path/to/page.html' should be 'page.html'.
     395PASS: Display name of 'http://example.com/path/to/page.html#test' should be 'page.html'.
    395396PASS: Display name of 'http://example.com/path/to/page.html?' should be 'page.html'.
    396397PASS: Display name of 'http://example.com/path/to/page.html?a=1' should be 'page.html'.
    397 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2' should be 'page.html'.
    398 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2#test' should be 'page.html'.
    399 PASS: Display name of 'http://example.com:123/path/to/page.html?a=1&b=2#test' should be 'page.html'.
    400 PASS: Display name of 'http://example.com/path/to/page.html#test' should be 'page.html'.
    401 PASS: Display name of 'http://example.com#alpha/beta' should be 'example.com'.
    402 PASS: Display name of 'http://example.com?key=alpha/beta' should be 'beta'.
     398PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=foo%2Fbar' should be 'page.html'.
     399PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=foo%2Fbar#test' should be 'page.html'.
     400PASS: Display name of 'http://example.com:123/path/to/page.html?a=1&b=foo%2Fbar#test' should be 'page.html'.
     401PASS: Display name of 'http://example.com#foo%20bar' should be 'example.com'.
     402PASS: Display name of 'http://example.com/#foo%20bar' should be 'example.com'.
     403PASS: Display name of 'http://example.com/foo%20bar' should be 'foo bar'.
     404PASS: Display name of 'http://example.com/?key=foo%20bar' should be 'example.com'.
     405PASS: Display name of 'http://example.com/foo%20bar' should be 'foo bar'.
     406PASS: Display name of 'http://example.com/foo bar' should be 'foo bar'.
     407PASS: Display name of 'http://example.com#foo/bar' should be 'example.com'.
     408PASS: Display name of 'http://example.com/#foo/bar' should be 'example.com'.
     409PASS: Display name of 'http://example.com#foo%2Fbar' should be 'example.com'.
     410PASS: Display name of 'http://example.com/#foo%2Fbar' should be 'example.com'.
     411PASS: Display name of 'http://example.com/?key=foo%2Fbar' should be 'example.com'.
     412PASS: Display name of 'http://example.com/foo%2Fbar' should be 'foo/bar'.
    403413PASS: Display name of 'http://user:pass@example.com/' should be 'example.com'.
    404414PASS: Display name of 'http://my.example.com' should be 'my.example.com'.
    405 PASS: Display name of 'file://foo/bar' should be 'bar'.
     415PASS: Display name of 'http://my.example.com/' should be 'my.example.com'.
     416PASS: Display name of 'file:///foo' should be 'foo'.
     417PASS: Display name of 'file:///foo/' should be 'foo'.
     418PASS: Display name of 'file:///foo/bar' should be 'bar'.
    406419PASS: Display name of 'data:text/plain,test' should be 'data:text/plain,test'.
    407420PASS: Display name of 'about:blank' should be 'about:blank'.
    408421PASS: Display name of 'about:srcdoc' should be 'about:srcdoc'.
    409422PASS: Display name of 'app-specific://example.com' should be 'example.com'.
     423PASS: Display name of 'app-specific://example.com/' should be 'example.com'.
     424PASS: Display name of 'app-specific://example.com/path' should be 'path'.
    410425
    411426Allowing directory as name...
     
    422437PASS: Display name of 'http://example.com/path/to/' should be '/'.
    423438PASS: Display name of 'http://example.com/path/to/page.html' should be 'page.html'.
     439PASS: Display name of 'http://example.com/path/to/page.html#test' should be 'page.html'.
    424440PASS: Display name of 'http://example.com/path/to/page.html?' should be 'page.html'.
    425441PASS: Display name of 'http://example.com/path/to/page.html?a=1' should be 'page.html'.
    426 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2' should be 'page.html'.
    427 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2#test' should be 'page.html'.
    428 PASS: Display name of 'http://example.com:123/path/to/page.html?a=1&b=2#test' should be 'page.html'.
    429 PASS: Display name of 'http://example.com/path/to/page.html#test' should be 'page.html'.
    430 PASS: Display name of 'http://example.com#alpha/beta' should be 'example.com'.
    431 PASS: Display name of 'http://example.com?key=alpha/beta' should be 'beta'.
     442PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=foo%2Fbar' should be 'page.html'.
     443PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=foo%2Fbar#test' should be 'page.html'.
     444PASS: Display name of 'http://example.com:123/path/to/page.html?a=1&b=foo%2Fbar#test' should be 'page.html'.
     445PASS: Display name of 'http://example.com#foo%20bar' should be 'example.com'.
     446PASS: Display name of 'http://example.com/#foo%20bar' should be '/'.
     447PASS: Display name of 'http://example.com/foo%20bar' should be 'foo bar'.
     448PASS: Display name of 'http://example.com/?key=foo%20bar' should be '/'.
     449PASS: Display name of 'http://example.com/foo%20bar' should be 'foo bar'.
     450PASS: Display name of 'http://example.com/foo bar' should be 'foo bar'.
     451PASS: Display name of 'http://example.com#foo/bar' should be 'example.com'.
     452PASS: Display name of 'http://example.com/#foo/bar' should be '/'.
     453PASS: Display name of 'http://example.com#foo%2Fbar' should be 'example.com'.
     454PASS: Display name of 'http://example.com/#foo%2Fbar' should be '/'.
     455PASS: Display name of 'http://example.com/?key=foo%2Fbar' should be '/'.
     456PASS: Display name of 'http://example.com/foo%2Fbar' should be 'foo/bar'.
    432457PASS: Display name of 'http://user:pass@example.com/' should be '/'.
    433458PASS: Display name of 'http://my.example.com' should be 'my.example.com'.
    434 PASS: Display name of 'file://foo/bar' should be 'bar'.
     459PASS: Display name of 'http://my.example.com/' should be '/'.
     460PASS: Display name of 'file:///foo' should be 'foo'.
     461PASS: Display name of 'file:///foo/' should be '/'.
     462PASS: Display name of 'file:///foo/bar' should be 'bar'.
    435463PASS: Display name of 'data:text/plain,test' should be 'data:text/plain,test'.
    436464PASS: Display name of 'about:blank' should be 'about:blank'.
    437465PASS: Display name of 'about:srcdoc' should be 'about:srcdoc'.
    438466PASS: Display name of 'app-specific://example.com' should be 'example.com'.
     467PASS: Display name of 'app-specific://example.com/' should be '/'.
     468PASS: Display name of 'app-specific://example.com/path' should be 'path'.
     469
     470-- Known issues <https://webkit.org/b/165155>
     471
     472FAIL: Display name of 'http://example.com?key=foo%2Fbar' should be 'example.com'.
     473    Expected: "example.com"
     474    Actual: "example.com?key=foo%2fbar"
     475FAIL: Display name of 'http://example.com?key=foo/bar' should be 'example.com'.
     476    Expected: "example.com"
     477    Actual: "bar"
     478FAIL: Display name of 'http://example.com?key=foo%20bar' should be 'example.com'.
     479    Expected: "example.com"
     480    Actual: "example.com?key=foo%20bar"
     481FAIL: Display name of 'http://example.com?key=foo bar' should be 'example.com'.
     482    Expected: "example.com"
     483    Actual: "example.com?key=foo bar"
     484
     485Allowing directory as name...
     486FAIL: Display name of 'http://example.com?key=foo%2Fbar' should be 'example.com'.
     487    Expected: "example.com"
     488    Actual: "example.com?key=foo%2fbar"
     489FAIL: Display name of 'http://example.com?key=foo/bar' should be 'example.com'.
     490    Expected: "example.com"
     491    Actual: "bar"
     492FAIL: Display name of 'http://example.com?key=foo%20bar' should be 'example.com'.
     493    Expected: "example.com"
     494    Actual: "example.com?key=foo%20bar"
     495FAIL: Display name of 'http://example.com?key=foo bar' should be 'example.com'.
     496    Expected: "example.com"
     497    Actual: "example.com?key=foo bar"
    439498
    440499-- Running test case: WI.h2Authority
  • trunk/LayoutTests/inspector/unit-tests/url-utilities.html

    r248753 r248774  
    443443        name: "WI.displayNameForURL",
    444444        test() {
    445             const tests = [
     445            function test(tests) {
     446                for (let {url, expected} of tests)
     447                    InspectorTest.expectEqual(WI.displayNameForURL(url), expected, `Display name of '${url}' should be '${expected}'.`);
     448
     449                InspectorTest.newline();
     450
     451                InspectorTest.log("Allowing directory as name...");
     452                for (let {url, expected, directory} of tests)
     453                    InspectorTest.expectEqual(WI.displayNameForURL(url, null, {allowDirectoryAsName: true}), directory || expected, `Display name of '${url}' should be '${directory || expected}'.`);
     454            }
     455
     456            test([
    446457                {url: "a", expected: "a"},
     458
    447459                {url: "http://", expected: "http://"},
    448460                {url: "http://example", expected: "example"},
     
    456468                {url: "http://example.com/path/to/", expected: "to", directory: "/"},
    457469                {url: "http://example.com/path/to/page.html", expected: "page.html"},
     470                {url: "http://example.com/path/to/page.html#test", expected: "page.html"},
    458471                {url: "http://example.com/path/to/page.html?", expected: "page.html"},
    459472                {url: "http://example.com/path/to/page.html?a=1", expected: "page.html"},
    460                 {url: "http://example.com/path/to/page.html?a=1&b=2", expected: "page.html"},
    461                 {url: "http://example.com/path/to/page.html?a=1&b=2#test", expected: "page.html"},
    462                 {url: "http://example.com:123/path/to/page.html?a=1&b=2#test", expected: "page.html"},
    463                 {url: "http://example.com/path/to/page.html#test", expected: "page.html"},
    464                 {url: "http://example.com#alpha/beta", expected: "example.com"},
    465                 {url: "http://example.com?key=alpha/beta", expected: "beta"},
     473                {url: "http://example.com/path/to/page.html?a=1&b=foo%2Fbar", expected: "page.html"},
     474                {url: "http://example.com/path/to/page.html?a=1&b=foo%2Fbar#test", expected: "page.html"},
     475                {url: "http://example.com:123/path/to/page.html?a=1&b=foo%2Fbar#test", expected: "page.html"},
     476
     477                {url: "http://example.com#foo%20bar", expected: "example.com"},
     478                {url: "http://example.com/#foo%20bar", expected: "example.com", directory: "/"},
     479                {url: "http://example.com/foo%20bar", expected: "foo bar"},
     480                {url: "http://example.com/?key=foo%20bar", expected: "example.com", directory: "/"},
     481                {url: "http://example.com/foo%20bar", expected: "foo bar"},
     482                {url: "http://example.com/foo bar", expected: "foo bar"},
     483
     484                {url: "http://example.com#foo/bar", expected: "example.com"},
     485                {url: "http://example.com/#foo/bar", expected: "example.com", directory: "/"},
     486                {url: "http://example.com#foo%2Fbar", expected: "example.com"},
     487                {url: "http://example.com/#foo%2Fbar", expected: "example.com", directory: "/"},
     488                {url: "http://example.com/?key=foo%2Fbar", expected: "example.com", directory: "/"},
     489                {url: "http://example.com/foo%2Fbar", expected: "foo/bar"},
     490
    466491                {url: "http://user:pass@example.com/", expected: "example.com", directory: "/"},
     492
    467493                {url: "http://my.example.com", expected: "my.example.com"},
    468                 {url: "file://foo/bar", expected: "bar"},
     494                {url: "http://my.example.com/", expected: "my.example.com", directory: "/"},
     495
     496                {url: "file:///foo", expected: "foo"},
     497                {url: "file:///foo/", expected: "foo", directory: "/"},
     498                {url: "file:///foo/bar", expected: "bar"},
     499
    469500                {url: "data:text/plain,test", expected: "data:text/plain,test"},
     501
    470502                {url: "about:blank", expected: "about:blank"},
    471503                {url: "about:srcdoc", expected: "about:srcdoc"},
     504
    472505                {url: "app-specific://example.com", expected: "example.com"},
    473             ];
    474 
    475             for (let {url, expected} of tests)
    476                 InspectorTest.expectEqual(WI.displayNameForURL(url), expected, `Display name of '${url}' should be '${expected}'.`);
    477 
     506                {url: "app-specific://example.com/", expected: "example.com", directory: "/"},
     507                {url: "app-specific://example.com/path", expected: "path"},
     508            ]);
     509
     510            // FIXME: <https://webkit.org/b/165155> Web Inspector: Use URL constructor to better handle all kinds of URLs
    478511            InspectorTest.newline();
    479 
    480             InspectorTest.log("Allowing directory as name...");
    481             for (let {url, expected, directory} of tests)
    482                 InspectorTest.expectEqual(WI.displayNameForURL(url, null, {allowDirectoryAsName: true}), directory || expected, `Display name of '${url}' should be '${directory || expected}'.`);
     512            InspectorTest.log("-- Known issues <https://webkit.org/b/165155>");
     513            InspectorTest.newline();
     514
     515            test([
     516                {url: "http://example.com?key=foo%2Fbar", expected: "example.com"},
     517                {url: "http://example.com?key=foo/bar", expected: "example.com"},
     518
     519                {url: "http://example.com?key=foo%20bar", expected: "example.com"},
     520                {url: "http://example.com?key=foo bar", expected: "example.com"},
     521            ]);
    483522        },
    484523    });
Note: See TracChangeset for help on using the changeset viewer.