[webkit-changes] [WebKit/WebKit] 79b593: Add more browser.test functions for common asserti...

Timothy Hatcher noreply at github.com
Thu Sep 14 17:51:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 79b593943c9bf5ee81a42580cea576b670f342c1
      https://github.com/WebKit/WebKit/commit/79b593943c9bf5ee81a42580cea576b670f342c1
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2023-09-14 (Thu, 14 Sep 2023)

  Changed paths:
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITestCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITest.h
    M Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPITest.idl
    M Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.mm

  Log Message:
  -----------
  Add more browser.test functions for common assertions.
https://webkit.org/b/261580
rdar://problem/115523406

Reviewed by Brian Weinstein.

Implement `assertResolves`, `assertSafe`, and `assertSafeResolve` testing utility methods.
Adoption in tests to follow in subsequent changes.

* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITestCocoa.mm:
(WebKit::debugString): Make clearer by using _isRegularExpression getter instead.
(WebKit::combineMessages): Added. Helper to concat two messages since the message was not being used for throw and reject assertions before now.
(WebKit::assertEquals): Added. Helper to use in throw and reject asserts that better logs the values.
(WebKit::WebExtensionAPITest::assertEq):
(WebKit::WebExtensionAPITest::assertRejects):
(WebKit::WebExtensionAPITest::assertResolves):
(WebKit::WebExtensionAPITest::assertThrows):
(WebKit::WebExtensionAPITest::assertSafe):
(WebKit::WebExtensionAPITest::assertSafeResolve):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITest.h:
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPITest.idl:
* Tools/TestWebKitAPI/cocoa/WebExtensionUtilities.mm:
(-[TestWebExtensionManager _webExtensionController:recordTestEqualityResult:expectedValue:actualValue:withMessage:andSourceURL:lineNumber:forExtensionContext:]):
Improve output so it is clear what is the expected and actual values.

Canonical link: https://commits.webkit.org/268009@main




More information about the webkit-changes mailing list