From 360d2cb741d1661e9a1bd4aa1c1f05018e5f52ee Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Wed, 17 Apr 2024 03:26:30 +0000 Subject: [PATCH] Bug 1891332 - Replace debug MOZ_ASSERT with MOZ_RELEASE_ASSERT in netwerk tests. r=necko-reviewers,kershaw,valentin MOZ_ASSERT is only checked in debug builds, so release builds' tests are not checking these assertions. Depends on D207374 Differential Revision: https://phabricator.services.mozilla.com/D207375 --- netwerk/test/gtest/TestCommon.h | 8 ++++---- netwerk/test/gtest/TestCookie.cpp | 4 ++-- netwerk/test/gtest/TestInputStreamTransport.cpp | 2 +- netwerk/test/gtest/TestNamedPipeService.cpp | 2 +- netwerk/wifi/gtest/TestWifiMonitor.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/netwerk/test/gtest/TestCommon.h b/netwerk/test/gtest/TestCommon.h index 0d2fd74e5bbd..76620fbb447c 100644 --- a/netwerk/test/gtest/TestCommon.h +++ b/netwerk/test/gtest/TestCommon.h @@ -17,8 +17,8 @@ class WaitForCondition final : public nsIRunnable { NS_DECL_THREADSAFE_ISUPPORTS void Wait(int pending) { - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mPending == 0); + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + MOZ_RELEASE_ASSERT(mPending == 0); mPending = pending; mozilla::SpinEventLoopUntil("TestCommon.h:WaitForCondition::Wait"_ns, @@ -32,8 +32,8 @@ class WaitForCondition final : public nsIRunnable { virtual ~WaitForCondition() = default; NS_IMETHOD Run() override { - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mPending); + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + MOZ_RELEASE_ASSERT(mPending); --mPending; return NS_OK; diff --git a/netwerk/test/gtest/TestCookie.cpp b/netwerk/test/gtest/TestCookie.cpp index 4812ee47f1c4..e99e9f6332e7 100644 --- a/netwerk/test/gtest/TestCookie.cpp +++ b/netwerk/test/gtest/TestCookie.cpp @@ -95,7 +95,7 @@ void SetACookieInternal(nsICookieService* aCookieService, const char* aSpec, /* shouldResistFingerprinting */ false) : CookieJarSettings::GetBlockingAll( /* shouldResistFingerprinting */ false); - MOZ_ASSERT(cookieJarSettings); + MOZ_RELEASE_ASSERT(cookieJarSettings); nsCOMPtr loadInfo = dummyChannel->LoadInfo(); loadInfo->SetCookieJarSettings(cookieJarSettings); @@ -140,7 +140,7 @@ void GetACookieNoHttp(nsICookieService* aCookieService, const char* aSpec, RefPtr principal = BasePrincipal::CreateContentPrincipal(uri, OriginAttributes()); - MOZ_ASSERT(principal); + MOZ_RELEASE_ASSERT(principal); nsCOMPtr document; nsresult rv = NS_NewDOMDocument(getter_AddRefs(document), diff --git a/netwerk/test/gtest/TestInputStreamTransport.cpp b/netwerk/test/gtest/TestInputStreamTransport.cpp index 43df0e193a74..de19f4814779 100644 --- a/netwerk/test/gtest/TestInputStreamTransport.cpp +++ b/netwerk/test/gtest/TestInputStreamTransport.cpp @@ -29,7 +29,7 @@ void CreateStream(already_AddRefed aSource, ASSERT_EQ(NS_OK, rv); nsCOMPtr asyncStream = do_QueryInterface(wrapper); - MOZ_ASSERT(asyncStream); + MOZ_RELEASE_ASSERT(asyncStream); asyncStream.forget(aStream); } diff --git a/netwerk/test/gtest/TestNamedPipeService.cpp b/netwerk/test/gtest/TestNamedPipeService.cpp index b91a17a93e1a..ef764dde13e5 100644 --- a/netwerk/test/gtest/TestNamedPipeService.cpp +++ b/netwerk/test/gtest/TestNamedPipeService.cpp @@ -31,7 +31,7 @@ class Event { void Set() { MonitorAutoLock lock(mMonitor); - MOZ_ASSERT(!mSignaled); + MOZ_RELEASE_ASSERT(!mSignaled); mSignaled = true; mMonitor.Notify(); } diff --git a/netwerk/wifi/gtest/TestWifiMonitor.cpp b/netwerk/wifi/gtest/TestWifiMonitor.cpp index f12c5c78efd5..37d46c658ab0 100644 --- a/netwerk/wifi/gtest/TestWifiMonitor.cpp +++ b/netwerk/wifi/gtest/TestWifiMonitor.cpp @@ -85,7 +85,7 @@ class TestWifiMonitor : public ::testing::Test { public: TestWifiMonitor() { mObs = mozilla::services::GetObserverService(); - MOZ_ASSERT(mObs); + MOZ_RELEASE_ASSERT(mObs); nsresult rv; nsCOMPtr nls = @@ -312,7 +312,7 @@ class TestWifiMonitor : public ::testing::Test { LOGI(("RunSingleTest: <%s, %s> | requestPolling: %s | shouldPoll: %s", aTopic, NS_ConvertUTF16toUTF8(aData).get(), aRequestPolling ? "true" : "false", aShouldPoll ? "true" : "false")); - MOZ_ASSERT(aShouldPoll || !aRequestPolling); + MOZ_RELEASE_ASSERT(aShouldPoll || !aRequestPolling); CreateObjects();