mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
Bug 1536596 - Added unit tests for AnonymizedOriginString. r=dom-workers-and-storage-reviewers,janv
Depends on D88288 Differential Revision: https://phabricator.services.mozilla.com/D88289
This commit is contained in:
parent
0cb09645d3
commit
3dd521872b
@ -380,6 +380,24 @@ TEST(QuotaCommon_ErrToOkOrErr, NsresultToNsCOMPtr_nullptr_Err)
|
||||
EXPECT_EQ(res.unwrapErr(), NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
class StringPairParameterized
|
||||
: public ::testing::TestWithParam<std::pair<const char*, const char*>> {};
|
||||
|
||||
TEST_P(StringPairParameterized, AnonymizedOriginString) {
|
||||
const auto [in, expectedAnonymized] = GetParam();
|
||||
const auto anonymized = AnonymizedOriginString(nsDependentCString(in));
|
||||
EXPECT_STREQ(anonymized.get(), expectedAnonymized);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
QuotaCommon, StringPairParameterized,
|
||||
::testing::Values(
|
||||
// XXX Do we really want to anonymize about: origins?
|
||||
std::pair("about:home", "about:aaaa"),
|
||||
std::pair("https://foo.bar.com", "https://aaa.aaa.aaa"),
|
||||
std::pair("https://foo.bar.com:8000", "https://aaa.aaa.aaa:DDDD"),
|
||||
std::pair("file://UNIVERSAL_FILE_ORIGIN",
|
||||
"file://aaaaaaaaa_aaaa_aaaaaa")));
|
||||
TEST(QuotaCommon_ToResultGet, Lambda_NoInput)
|
||||
{
|
||||
auto task = [](nsresult* aRv) -> int32_t {
|
||||
|
Loading…
Reference in New Issue
Block a user