From 24dbe577a5e1f238defc1cfd800e6258a72632df Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Fri, 5 Apr 2019 00:27:56 +0300 Subject: [PATCH] Backed out changeset 389b6bbd76db (bug 1519636) for bustages on MarkupMap.h . CLOSED TREE --- accessible/base/MarkupMap.h | 619 +++++++++--------- caps/tests/gtest/TestOriginAttributes.cpp | 9 +- dom/base/AnonymousContent.cpp | 3 +- dom/base/DocGroup.cpp | 27 +- dom/base/Document.cpp | 27 +- dom/base/TreeOrderedArrayInlines.h | 3 +- dom/base/UIDirectionManager.cpp | 3 +- dom/base/nsAttrValue.cpp | 4 +- dom/base/nsAttrValueInlines.h | 4 +- dom/base/nsCCUncollectableMarker.cpp | 4 +- dom/base/test/gtest/TestContentUtils.cpp | 6 +- dom/base/test/gtest/TestMimeType.cpp | 461 +++++-------- .../test/gtest/TestPlainTextSerializer.cpp | 50 +- dom/base/test/gtest/TestXPathGenerator.cpp | 27 +- dom/cache/Context.cpp | 4 +- dom/canvas/CanvasRenderingContext2D.cpp | 2 +- dom/canvas/WebGLContextVertices.cpp | 4 +- dom/canvas/WebGLTexelConversions.h | 26 +- dom/canvas/WebGLTexture.h | 3 +- dom/canvas/WebGLTypes.h | 10 +- .../gtest/TestImageBitmapColorUtils.cpp | 225 +++---- dom/clients/api/Client.cpp | 27 +- dom/clients/api/ClientDOMUtil.h | 19 +- dom/clients/api/Clients.cpp | 49 +- dom/clients/manager/ClientHandle.cpp | 47 +- dom/clients/manager/ClientHandleOpParent.cpp | 19 +- dom/clients/manager/ClientManagerOpParent.cpp | 19 +- dom/clients/manager/ClientNavigateOpChild.cpp | 19 +- .../manager/ClientOpenWindowOpChild.cpp | 19 +- dom/clients/manager/ClientOpenWindowUtils.cpp | 7 +- dom/clients/manager/ClientPrincipalUtils.cpp | 4 +- dom/clients/manager/ClientSource.cpp | 19 +- dom/clients/manager/ClientSourceOpChild.cpp | 19 +- dom/clients/manager/ClientThing.h | 4 +- dom/clients/manager/ClientValidation.cpp | 8 +- dom/encoding/FallbackEncoding.cpp | 11 +- dom/events/EventStateManager.cpp | 4 +- dom/html/HTMLMediaElement.cpp | 54 +- dom/indexedDB/ActorsChild.cpp | 15 +- dom/ipc/SharedStringMap.cpp | 11 +- dom/ipc/TabContext.cpp | 4 +- dom/ipc/TabParent.cpp | 58 +- .../test/gtest/TestLocalStorage.cpp | 15 +- dom/media/Benchmark.cpp | 66 +- dom/media/ChannelMediaDecoder.cpp | 27 +- dom/media/DOMMediaStream.cpp | 11 +- dom/media/MediaDecoderStateMachine.cpp | 298 ++++----- dom/media/MediaDevices.cpp | 127 ++-- dom/media/MediaFormatReader.cpp | 378 ++++++----- dom/media/MediaManager.cpp | 238 ++++--- dom/media/MediaRecorder.cpp | 34 +- dom/media/ReaderProxy.cpp | 25 +- dom/media/VideoFrameConverter.h | 15 +- .../doctor/gtest/TestMultiWriterQueue.cpp | 12 +- dom/media/doctor/gtest/TestRollingNumber.cpp | 9 +- dom/media/eme/MediaKeySystemAccess.cpp | 4 +- dom/media/encoder/VP8TrackEncoder.cpp | 4 +- dom/media/gmp/ChromiumCDMChild.cpp | 19 +- dom/media/gmp/ChromiumCDMProxy.cpp | 29 +- dom/media/gmp/GMPService.cpp | 72 +- dom/media/gmp/GMPServiceParent.cpp | 70 +- dom/media/gtest/TestAudioBuffers.cpp | 7 +- dom/media/gtest/TestAudioCompactor.cpp | 15 +- dom/media/gtest/TestAudioDeviceEnumerator.cpp | 15 +- dom/media/gtest/TestAudioMixer.cpp | 3 +- dom/media/gtest/TestAudioPacketizer.cpp | 7 +- dom/media/gtest/TestAudioSegment.cpp | 3 +- dom/media/gtest/TestAudioTrackEncoder.cpp | 15 +- dom/media/gtest/TestBitWriter.cpp | 6 +- dom/media/gtest/TestBlankVideoDataCreator.cpp | 6 +- dom/media/gtest/TestBufferReader.cpp | 3 +- dom/media/gtest/TestCDMStorage.cpp | 64 +- dom/media/gtest/TestDataMutex.cpp | 3 +- dom/media/gtest/TestGMPCrossOrigin.cpp | 6 +- dom/media/gtest/TestGMPRemoveAndDelete.cpp | 12 +- dom/media/gtest/TestGMPUtils.cpp | 6 +- dom/media/gtest/TestGroupId.cpp | 30 +- dom/media/gtest/TestIntervalSet.cpp | 84 +-- dom/media/gtest/TestMP4Demuxer.cpp | 86 ++- dom/media/gtest/TestMediaDataDecoder.cpp | 6 +- dom/media/gtest/TestMediaDataEncoder.cpp | 60 +- dom/media/gtest/TestMediaEventSource.cpp | 39 +- dom/media/gtest/TestMediaMIMETypes.cpp | 18 +- dom/media/gtest/TestOpusParser.cpp | 3 +- dom/media/gtest/TestRust.cpp | 3 +- dom/media/gtest/TestTimeUnit.cpp | 3 +- dom/media/gtest/TestVPXDecoding.cpp | 3 +- dom/media/gtest/TestVideoSegment.cpp | 6 +- dom/media/gtest/TestVideoTrackEncoder.cpp | 90 +-- dom/media/gtest/TestVideoUtils.cpp | 9 +- dom/media/gtest/TestWebMBuffered.cpp | 9 +- dom/media/gtest/TestWebMWriter.cpp | 12 +- dom/media/gtest/mp4_demuxer/TestInterval.cpp | 15 +- dom/media/gtest/mp4_demuxer/TestMP4.cpp | 6 +- dom/media/gtest/mp4_demuxer/TestParser.cpp | 33 +- dom/media/ipc/RemoteDecoderParent.cpp | 31 +- dom/media/ipc/RemoteMediaDataDecoder.cpp | 25 +- dom/media/mediasink/VideoSink.cpp | 31 +- dom/media/mediasource/SourceBuffer.cpp | 13 +- dom/media/mediasource/TrackBuffersManager.cpp | 27 +- .../mediasource/gtest/TestContainerParser.cpp | 9 +- .../gtest/TestExtractVPXCodecDetails.cpp | 9 +- dom/media/platforms/AllocationPolicy.cpp | 105 ++- .../agnostic/eme/EMEDecoderModule.cpp | 61 +- dom/media/platforms/omx/OmxDataDecoder.cpp | 226 ++++--- dom/media/platforms/omx/OmxPromiseLayer.cpp | 4 +- dom/media/platforms/wmf/MFTDecoder.h | 7 +- .../platforms/wrappers/MediaChangeMonitor.cpp | 211 +++--- dom/media/systemservices/MediaUtils.h | 27 +- dom/media/webaudio/blink/DenormalDisabler.h | 8 +- .../webrtc/MediaEngineRemoteVideoSource.cpp | 4 +- .../recognition/SpeechRecognition.cpp | 45 +- dom/payments/PaymentActionResponse.cpp | 4 +- dom/payments/PaymentMethodChangeEvent.cpp | 4 +- dom/payments/PaymentRequestManager.cpp | 12 +- dom/payments/PaymentRequestService.cpp | 12 +- dom/payments/ipc/PaymentRequestParent.cpp | 16 +- dom/prio/test/gtest/TestPrioEncoder.cpp | 9 +- dom/quota/ActorsParent.cpp | 12 +- dom/quota/test/gtest/TestQuotaManager.cpp | 3 +- .../tests/gtest/TestReportToParser.cpp | 3 +- .../test/gtest/TestFeaturePolicyParser.cpp | 3 +- dom/security/test/gtest/TestCSPParser.cpp | 45 +- dom/security/test/gtest/TestSecureContext.cpp | 9 +- .../ServiceWorkerContainerImpl.cpp | 92 ++- .../ServiceWorkerContainerParent.cpp | 25 +- dom/serviceworkers/ServiceWorkerManager.cpp | 17 +- .../ServiceWorkerRegistrationImpl.cpp | 84 ++- .../test/gtest/TestReadWrite.cpp | 81 +-- dom/webauthn/U2FTokenManager.cpp | 66 +- dom/workers/WorkerDebugger.cpp | 25 +- dom/xhr/XMLHttpRequestMainThread.cpp | 4 +- dom/xslt/xml/txXMLUtils.cpp | 4 +- dom/xslt/xpath/XPathResult.cpp | 4 +- dom/xslt/xpath/txCoreFunctionCall.cpp | 4 +- dom/xslt/xpath/txRelationalExpr.cpp | 4 +- dom/xslt/xpath/txResultRecycler.cpp | 4 +- dom/xslt/xslt/txBufferingHandler.cpp | 4 +- dom/xslt/xslt/txMozillaXSLTProcessor.cpp | 4 +- editor/spellchecker/EditorSpellCheck.cpp | 45 +- editor/txmgr/tests/TestTXMgr.cpp | 21 +- extensions/cookie/nsPermissionManager.cpp | 13 +- gfx/2d/BlurLS3.cpp | 66 +- gfx/2d/unittest/TestCairo.cpp | 9 +- gfx/gl/GLReadTexImageHelper.cpp | 8 +- gfx/layers/ScrollableLayerGuid.h | 4 +- gfx/layers/TreeTraversal.h | 3 +- gfx/layers/composite/TextureHost.cpp | 4 +- gfx/layers/d3d11/TextureD3D11.cpp | 12 +- .../ipc/CompositableTransactionParent.cpp | 8 +- gfx/layers/mlgpu/LayerManagerMLGPU.cpp | 4 +- .../opengl/MacIOSurfaceTextureHostOGL.cpp | 8 +- gfx/layers/opengl/TextureHostOGL.cpp | 8 +- gfx/layers/wr/WebRenderCommandBuilder.cpp | 4 +- gfx/src/FilterSupport.cpp | 4 +- gfx/tests/gtest/PolygonTestUtils.cpp | 3 +- gfx/tests/gtest/TestArena.cpp | 6 +- gfx/tests/gtest/TestArrayView.cpp | 3 +- gfx/tests/gtest/TestBSPTree.cpp | 84 +-- gfx/tests/gtest/TestBufferRotation.cpp | 12 +- gfx/tests/gtest/TestColorNames.cpp | 18 +- gfx/tests/gtest/TestCompositor.cpp | 8 +- gfx/tests/gtest/TestGfxPrefs.cpp | 15 +- gfx/tests/gtest/TestGfxWidgets.cpp | 6 +- gfx/tests/gtest/TestJobScheduler.cpp | 9 +- gfx/tests/gtest/TestLayers.cpp | 21 +- gfx/tests/gtest/TestMoz2D.cpp | 9 +- gfx/tests/gtest/TestPolygon.cpp | 12 +- gfx/tests/gtest/TestQcms.cpp | 12 +- gfx/tests/gtest/TestRect.cpp | 15 +- gfx/tests/gtest/TestRegion.cpp | 82 +-- gfx/tests/gtest/TestSkipChars.cpp | 3 +- gfx/tests/gtest/TestSwizzle.cpp | 9 +- gfx/tests/gtest/TestTextureCompatibility.cpp | 3 +- gfx/tests/gtest/TestTextures.cpp | 6 +- gfx/tests/gtest/TestTreeTraversal.cpp | 81 +-- gfx/tests/gtest/gfxSurfaceRefCountTest.cpp | 3 +- gfx/thebes/gfxFontUtils.h | 4 +- gfx/thebes/gfxTypes.h | 2 +- gfx/vr/VRDisplayClient.cpp | 8 +- gfx/vr/ipc/VRChild.cpp | 10 +- .../gtest/TestADAM7InterpolatingFilter.cpp | 96 +-- image/test/gtest/TestBlendAnimationFilter.cpp | 37 +- image/test/gtest/TestCopyOnWrite.cpp | 12 +- image/test/gtest/TestDownscalingFilter.cpp | 45 +- .../gtest/TestDownscalingFilterNoSkia.cpp | 3 +- .../test/gtest/TestRemoveFrameRectFilter.cpp | 64 +- image/test/gtest/TestSurfaceSink.cpp | 54 +- intl/locale/nsLanguageAtomService.cpp | 11 +- intl/locale/tests/gtest/TestCollation.cpp | 3 +- .../locale/tests/gtest/TestDateTimeFormat.cpp | 12 +- intl/locale/tests/gtest/TestLocaleService.cpp | 33 +- .../gtest/TestLocaleServiceNegotiate.cpp | 6 +- intl/locale/tests/gtest/TestMozLocale.cpp | 30 +- intl/locale/tests/gtest/TestOSPreferences.cpp | 9 +- intl/lwbrk/gtest/TestLineBreak.cpp | 9 +- intl/strres/nsStringBundle.cpp | 6 +- intl/uconv/nsTextToSubURI.cpp | 12 +- ipc/chromium/src/base/thread_local_win.cc | 3 +- ipc/chromium/src/base/waitable_event_win.cc | 2 +- .../src/chrome/common/ipc_channel_posix.cc | 5 +- ipc/glue/WindowsMessageLoop.cpp | 7 +- js/public/Conversions.h | 3 +- js/public/RegExp.h | 4 +- js/src/builtin/String.cpp | 24 +- js/src/gc/Barrier.h | 1 + js/src/gc/GC.cpp | 3 +- js/src/jit/BaselineJIT.cpp | 52 +- js/src/jit/ExecutableAllocator.h | 2 +- js/src/jit/arm/MacroAssembler-arm.cpp | 4 +- js/src/jit/arm64/MacroAssembler-arm64.cpp | 4 +- .../shared/AtomicOperations-shared-jit.cpp | 8 +- js/src/jsapi-tests/testChromeBuffer.cpp | 6 +- js/src/jsapi-tests/testCompileUtf8.cpp | 160 +++-- js/src/jsapi-tests/testSetProperty.cpp | 4 +- js/src/jsapi-tests/testUbiNode.cpp | 11 +- js/src/jsapi-tests/tests.h | 2 +- js/src/shell/js.cpp | 4 +- js/src/vm/BigIntType.cpp | 4 +- js/src/vm/Debugger.cpp | 16 +- js/src/vm/MallocProvider.h | 11 +- js/src/vm/TypedArrayObject.cpp | 4 +- js/src/vm/TypedArrayObject.h | 3 +- js/src/wasm/WasmBaselineCompile.cpp | 44 +- js/src/wasm/WasmCraneliftCompile.cpp | 4 +- js/src/wasm/WasmInstance.cpp | 4 +- js/src/wasm/WasmIonCompile.cpp | 10 +- js/src/wasm/WasmJS.cpp | 12 +- js/src/wasm/WasmStubs.cpp | 4 +- js/src/wasm/WasmValidate.cpp | 4 +- js/xpconnect/loader/AutoMemMap.h | 3 +- layout/build/nsContentDLF.cpp | 108 +-- layout/generic/WritingModes.h | 5 +- layout/generic/nsTextFrameUtils.cpp | 2 +- layout/painting/FrameLayerBuilder.cpp | 3 +- layout/style/Loader.cpp | 27 +- .../0.1/gtest/TestClearKeyUtils.cpp | 3 +- media/mtransport/test/ice_unittest.cpp | 29 +- .../test/simpletokenbucket_unittest.cpp | 33 +- .../test/test_nr_socket_unittest.cpp | 7 +- media/psshparser/gtest/TestPsshParser.cpp | 3 +- .../signaling/gtest/jsep_session_unittest.cpp | 29 +- .../webrtc/signaling/gtest/sdp_unittests.cpp | 245 +++---- .../src/media-conduit/RtpSourceObserver.cpp | 1 + .../WebrtcMediaDataDecoderCodec.cpp | 20 +- .../MediaTransportHandlerIPC.cpp | 23 +- .../src/peerconnection/PeerConnectionCtx.cpp | 15 +- .../src/peerconnection/PeerConnectionImpl.cpp | 19 +- .../WebrtcGlobalInformation.cpp | 82 ++- .../src/sdp/SipccSdpAttributeList.cpp | 3 +- memory/gtest/TestJemalloc.cpp | 15 +- memory/volatile/tests/TestVolatileBuffer.cpp | 21 +- mfbt/Variant.h | 6 +- mfbt/tests/gtest/TestBuffer.cpp | 9 +- mfbt/tests/gtest/TestLinkedList.cpp | 6 +- mfbt/tests/gtest/TestMozDbg.cpp | 3 +- modules/libpref/SharedPrefMap.cpp | 11 +- modules/libpref/test/gtest/Basics.cpp | 3 +- .../test/gtest/CallbackAndVarCacheOrder.cpp | 27 +- modules/libpref/test/gtest/Parser.cpp | 3 +- mozglue/tests/gtest/TestDLLBlocklist.cpp | 12 +- mozglue/tests/gtest/TestDLLEject.cpp | 12 +- netwerk/base/ProxyAutoConfig.cpp | 6 +- netwerk/base/nsBaseChannel.cpp | 25 +- netwerk/protocol/http/HttpChannelParent.cpp | 32 +- netwerk/test/TestBind.cpp | 3 +- netwerk/test/TestCookie.cpp | 3 +- netwerk/test/TestNamedPipeService.cpp | 3 +- netwerk/test/TestUDPSocket.cpp | 3 +- .../test/gtest/TestBufferedInputStream.cpp | 18 +- netwerk/test/gtest/TestHeaders.cpp | 3 +- netwerk/test/gtest/TestHttpAuthUtils.cpp | 3 +- netwerk/test/gtest/TestIsValidIp.cpp | 36 +- netwerk/test/gtest/TestMIMEInputStream.cpp | 18 +- netwerk/test/gtest/TestMozURL.cpp | 30 +- .../TestPartiallySeekableInputStream.cpp | 27 +- .../test/gtest/TestProtocolProxyService.cpp | 3 +- netwerk/test/gtest/TestReadStreamToString.cpp | 30 +- netwerk/test/gtest/TestServerTimingHeader.cpp | 3 +- netwerk/test/gtest/TestStandardURL.cpp | 18 +- netwerk/test/gtest/TestURIMutator.cpp | 6 +- .../test/gtest/parse-ftp/TestParseFTPList.cpp | 3 +- parser/html/nsHtml5MetaScanner.cpp | 12 +- parser/html/nsHtml5Tokenizer.cpp | 44 +- parser/html/nsHtml5TreeBuilder.cpp | 44 +- parser/html/nsHtml5TreeOperation.cpp | 4 +- .../tests/gtest/TrustOverrideTest.cpp | 21 +- .../manager/ssl/tests/gtest/CertDBTest.cpp | 28 +- .../manager/ssl/tests/gtest/CertListTest.cpp | 57 +- .../ssl/tests/gtest/DeserializeCertTest.cpp | 12 +- security/sandbox/linux/gtest/TestBroker.cpp | 6 +- .../sandbox/linux/gtest/TestBrokerPolicy.cpp | 9 +- security/sandbox/mac/Sandbox.mm | 1 + storage/test/gtest/test_AsXXX_helpers.cpp | 6 +- ...st_asyncStatementExecution_transaction.cpp | 44 +- ..._async_callbacks_with_spun_event_loops.cpp | 7 +- storage/test/gtest/test_binding_params.cpp | 9 +- storage/test/gtest/test_file_perms.cpp | 3 +- storage/test/gtest/test_mutex.cpp | 6 +- .../test_service_init_background_thread.cpp | 3 +- .../gtest/test_spinningSynchronousClose.cpp | 6 +- storage/test/gtest/test_statement_scoper.cpp | 6 +- .../test/gtest/test_transaction_helper.cpp | 18 +- storage/test/gtest/test_true_async.cpp | 9 +- storage/test/gtest/test_unlock_notify.cpp | 3 +- testing/gtest/mozilla/MozGTestBench.h | 3 +- testing/gtest/mozilla/SanityTest.cpp | 6 +- .../extensions/webrequest/StreamFilter.cpp | 15 +- .../PerformanceMetricsCollector.cpp | 15 +- .../tests/gtest/places_test_harness_tail.h | 3 +- .../places/tests/gtest/test_casing.cpp | 6 +- .../test/gtest/TestExecutableLists.cpp | 12 +- .../tests/test_reduceprecision.cpp | 27 +- .../geckoview/gtest/TestGeckoView.cpp | 10 +- .../tests/gtest/TelemetryTestHelpers.cpp | 50 +- .../tests/gtest/TestCombinedStacks.cpp | 2 +- .../telemetry/tests/gtest/TestEvents.cpp | 25 +- .../telemetry/tests/gtest/TestHistograms.cpp | 18 +- .../telemetry/tests/gtest/TestOrigins.cpp | 28 +- .../telemetry/tests/gtest/TestScalars.cpp | 5 +- .../tests/gtest/TestCaching.cpp | 34 +- .../tests/gtest/TestChunkSet.cpp | 21 +- .../tests/gtest/TestClassifier.cpp | 6 +- .../tests/gtest/TestFailUpdate.cpp | 3 +- .../tests/gtest/TestFindFullHash.cpp | 6 +- .../tests/gtest/TestLookupCacheV4.cpp | 21 +- .../tests/gtest/TestPerProviderDirectory.cpp | 6 +- .../tests/gtest/TestProtocolParser.cpp | 6 +- .../tests/gtest/TestRiceDeltaDecoder.cpp | 6 +- .../tests/gtest/TestSafeBrowsingProtobuf.cpp | 3 +- .../tests/gtest/TestSafebrowsingHash.cpp | 6 +- .../url-classifier/tests/gtest/TestTable.cpp | 3 +- .../gtest/TestUrlClassifierTableUpdateV4.cpp | 48 +- .../tests/gtest/TestUrlClassifierUtils.cpp | 21 +- .../gtest/TestVariableLengthPrefixSet.cpp | 33 +- .../Win64ModuleUnwindMetadata.cpp | 4 +- .../test/gtest/TestCrashThreadAnnotation.cpp | 43 +- toolkit/profile/gtest/TestProfileLock.cpp | 3 +- .../profile/gtest/TestProfileLockRetry.cpp | 3 +- toolkit/recordreplay/HashTable.cpp | 24 +- .../tests/gtest/TestProxyBypassRules.cpp | 9 +- .../tests/gtest/TestProxyBypassRules.cpp | 9 +- .../interface/FuzzingInterfaceStream.h | 3 +- tools/profiler/gecko/nsProfiler.cpp | 162 +++-- tools/profiler/tests/gtest/GeckoProfiler.cpp | 45 +- tools/profiler/tests/gtest/LulTest.cpp | 3 +- .../tests/gtest/ThreadProfileTest.cpp | 9 +- widget/PuppetWidget.cpp | 15 +- widget/cocoa/nsPrintDialogX.mm | 3 +- widget/gtk/nsFilePicker.cpp | 18 +- widget/gtk/nsNativeThemeGTK.cpp | 4 +- widget/windows/ToastNotificationHandler.cpp | 9 +- widget/windows/nsClipboard.cpp | 3 +- xpcom/base/nsSystemInfo.cpp | 6 +- xpcom/ds/PLDHashTable.cpp | 29 +- xpcom/ds/nsTArray.h | 15 +- xpcom/reflect/xptinfo/xptinfo.h | 4 +- xpcom/rust/gtest/nsstring/Test.cpp | 30 +- xpcom/rust/gtest/xpcom/Test.cpp | 6 +- xpcom/tests/gtest/TestAllocReplacement.cpp | 18 +- xpcom/tests/gtest/TestArenaAllocator.cpp | 33 +- xpcom/tests/gtest/TestAtoms.cpp | 18 +- xpcom/tests/gtest/TestAutoPtr.cpp | 21 +- xpcom/tests/gtest/TestAutoRef.cpp | 3 +- xpcom/tests/gtest/TestAutoRefCnt.cpp | 3 +- xpcom/tests/gtest/TestBase64.cpp | 40 +- xpcom/tests/gtest/TestCOMArray.cpp | 12 +- xpcom/tests/gtest/TestCOMPtr.cpp | 24 +- xpcom/tests/gtest/TestCOMPtrEq.cpp | 3 +- xpcom/tests/gtest/TestCRT.cpp | 3 +- xpcom/tests/gtest/TestCloneInputStream.cpp | 18 +- xpcom/tests/gtest/TestDafsa.cpp | 12 +- .../gtest/TestDeadlockDetectorScalability.cpp | 15 +- xpcom/tests/gtest/TestEncoding.cpp | 12 +- xpcom/tests/gtest/TestEscape.cpp | 15 +- xpcom/tests/gtest/TestEventPriorities.cpp | 6 +- xpcom/tests/gtest/TestEventTargetQI.cpp | 18 +- xpcom/tests/gtest/TestExpirationTracker.cpp | 3 +- xpcom/tests/gtest/TestFile.cpp | 3 +- xpcom/tests/gtest/TestFilePreferencesUnix.cpp | 6 +- xpcom/tests/gtest/TestFilePreferencesWin.cpp | 6 +- xpcom/tests/gtest/TestGCPostBarriers.cpp | 3 +- xpcom/tests/gtest/TestHashtables.cpp | 24 +- xpcom/tests/gtest/TestID.cpp | 3 +- .../gtest/TestInputStreamLengthHelper.cpp | 15 +- .../tests/gtest/TestLogCommandLineHandler.cpp | 15 +- xpcom/tests/gtest/TestMoveString.cpp | 36 +- xpcom/tests/gtest/TestMozPromise.cpp | 237 +++---- xpcom/tests/gtest/TestMruCache.cpp | 36 +- .../tests/gtest/TestMultiplexInputStream.cpp | 27 +- .../tests/gtest/TestNSPRLogModulesParser.cpp | 15 +- .../gtest/TestNonBlockingAsyncInputStream.cpp | 22 +- xpcom/tests/gtest/TestNsDeque.cpp | 30 +- xpcom/tests/gtest/TestNsRefPtr.cpp | 18 +- xpcom/tests/gtest/TestObserverArray.cpp | 26 +- xpcom/tests/gtest/TestObserverService.cpp | 21 +- xpcom/tests/gtest/TestPLDHash.cpp | 18 +- xpcom/tests/gtest/TestPipes.cpp | 56 +- xpcom/tests/gtest/TestPriorityQueue.cpp | 3 +- xpcom/tests/gtest/TestRWLock.cpp | 3 +- .../tests/gtest/TestRacingServiceManager.cpp | 3 +- xpcom/tests/gtest/TestRecursiveMutex.cpp | 3 +- xpcom/tests/gtest/TestSlicedInputStream.cpp | 63 +- xpcom/tests/gtest/TestSnappyStreams.cpp | 60 +- xpcom/tests/gtest/TestStateWatching.cpp | 3 +- xpcom/tests/gtest/TestStorageStream.cpp | 6 +- xpcom/tests/gtest/TestStringStream.cpp | 6 +- xpcom/tests/gtest/TestStrings.cpp | 6 +- xpcom/tests/gtest/TestSynchronization.cpp | 27 +- xpcom/tests/gtest/TestTArray.cpp | 21 +- xpcom/tests/gtest/TestTArray2.cpp | 142 ++-- xpcom/tests/gtest/TestTaskQueue.cpp | 3 +- xpcom/tests/gtest/TestTextFormatter.cpp | 27 +- xpcom/tests/gtest/TestThreadManager.cpp | 6 +- xpcom/tests/gtest/TestThreadPool.cpp | 12 +- xpcom/tests/gtest/TestThreadPoolListener.cpp | 3 +- xpcom/tests/gtest/TestThreadUtils.cpp | 28 +- xpcom/tests/gtest/TestThreads.cpp | 12 +- xpcom/tests/gtest/TestThrottledEventQueue.cpp | 36 +- xpcom/tests/gtest/TestTimeStamp.cpp | 3 +- xpcom/tests/gtest/TestTimers.cpp | 12 +- xpcom/tests/gtest/TestTokenizer.cpp | 93 +-- xpcom/tests/gtest/TestUTF.cpp | 24 +- xpcom/tests/windows/TestCOM.cpp | 3 +- xpcom/tests/windows/TestNtPathToDosPath.cpp | 3 +- xpcom/threads/MozPromise.h | 15 +- xpcom/threads/nsThreadUtils.cpp | 3 +- 427 files changed, 4485 insertions(+), 6393 deletions(-) diff --git a/accessible/base/MarkupMap.h b/accessible/base/MarkupMap.h index 6a72e28bc021..5b4a6317cd3d 100644 --- a/accessible/base/MarkupMap.h +++ b/accessible/base/MarkupMap.h @@ -5,20 +5,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -MARKUPMAP( - a, - [](Element* aElement, Accessible* aContext) -> Accessible* { - // Only some roles truly enjoy life as HTMLLinkAccessibles, for - // details see closed bug 494807. - const nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aElement); - if (roleMapEntry && roleMapEntry->role != roles::NOTHING && - roleMapEntry->role != roles::LINK) { - return new HyperTextAccessibleWrap(aElement, aContext->Document()); - } +MARKUPMAP(a, + [](Element* aElement, Accessible* aContext) -> Accessible* { + // Only some roles truly enjoy life as HTMLLinkAccessibles, for + // details see closed bug 494807. + const nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aElement); + if (roleMapEntry && roleMapEntry->role != roles::NOTHING && + roleMapEntry->role != roles::LINK) { + return new HyperTextAccessibleWrap(aElement, + aContext->Document()); + } - return new HTMLLinkAccessible(aElement, aContext->Document()); - }, - roles::LINK); + return new HTMLLinkAccessible(aElement, aContext->Document()); + }, + roles::LINK) MARKUPMAP(abbr, New_HyperText, 0) @@ -30,27 +30,26 @@ MARKUPMAP(aside, New_HyperText, roles::LANDMARK) MARKUPMAP(blockquote, New_HyperText, roles::BLOCKQUOTE) -MARKUPMAP( - button, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLButtonAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(button, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLButtonAccessible(aElement, aContext->Document()); + }, + 0) -MARKUPMAP( - caption, - [](Element* aElement, Accessible* aContext) -> Accessible* { - if (aContext->IsTable()) { - dom::HTMLTableElement* tableEl = - dom::HTMLTableElement::FromNode(aContext->GetContent()); - if (tableEl && tableEl == aElement->GetParent() && - tableEl->GetCaption() == aElement) { - return new HTMLCaptionAccessible(aElement, aContext->Document()); - } - } - return nullptr; - }, - 0) +MARKUPMAP(caption, + [](Element* aElement, Accessible* aContext) -> Accessible* { + if (aContext->IsTable()) { + dom::HTMLTableElement* tableEl = + dom::HTMLTableElement::FromNode(aContext->GetContent()); + if (tableEl && tableEl == aElement->GetParent() && + tableEl->GetCaption() == aElement) { + return new HTMLCaptionAccessible(aElement, + aContext->Document()); + } + } + return nullptr; + }, + 0) MARKUPMAP(dd, New_HTMLDtOrDd, roles::DEFINITION) @@ -121,56 +120,51 @@ MARKUPMAP( }, roles::SECTION) -MARKUPMAP( - dl, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLListAccessible(aElement, aContext->Document()); - }, - roles::DEFINITION_LIST) +MARKUPMAP(dl, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLListAccessible(aElement, aContext->Document()); + }, + roles::DEFINITION_LIST) MARKUPMAP(dt, New_HTMLDtOrDd, roles::TERM) -MARKUPMAP( - figcaption, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLFigcaptionAccessible(aElement, aContext->Document()); - }, - roles::CAPTION) +MARKUPMAP(figcaption, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLFigcaptionAccessible(aElement, aContext->Document()); + }, + roles::CAPTION) -MARKUPMAP( - figure, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLFigureAccessible(aElement, aContext->Document()); - }, - roles::FIGURE, Attr(xmlroles, figure)) +MARKUPMAP(figure, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLFigureAccessible(aElement, aContext->Document()); + }, + roles::FIGURE, Attr(xmlroles, figure)) -MARKUPMAP( - fieldset, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLGroupboxAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(fieldset, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLGroupboxAccessible(aElement, aContext->Document()); + }, + 0) -MARKUPMAP( - form, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLFormAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(form, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLFormAccessible(aElement, aContext->Document()); + }, + 0) -MARKUPMAP( - footer, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLHeaderOrFooterAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(footer, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLHeaderOrFooterAccessible(aElement, + aContext->Document()); + }, + 0) -MARKUPMAP( - header, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLHeaderOrFooterAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(header, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLHeaderOrFooterAccessible(aElement, + aContext->Document()); + }, + 0) MARKUPMAP(h1, New_HyperText, roles::HEADING) @@ -184,75 +178,71 @@ MARKUPMAP(h5, New_HyperText, roles::HEADING) MARKUPMAP(h6, New_HyperText, roles::HEADING) -MARKUPMAP( - hr, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLHRAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(hr, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLHRAccessible(aElement, aContext->Document()); + }, + 0) -MARKUPMAP( - input, - [](Element* aElement, Accessible* aContext) -> Accessible* { - // TODO(emilio): This would be faster if it used - // HTMLInputElement's already-parsed representation. - if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, - nsGkAtoms::checkbox, eIgnoreCase)) { - return new CheckboxAccessible(aElement, aContext->Document()); - } - if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, - nsGkAtoms::image, eIgnoreCase)) { - return new HTMLButtonAccessible(aElement, aContext->Document()); - } - if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, - nsGkAtoms::radio, eIgnoreCase)) { - return new HTMLRadioButtonAccessible(aElement, aContext->Document()); - } - if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, - nsGkAtoms::time, eIgnoreCase)) { - return new EnumRoleAccessible(aElement, - aContext->Document()); - } - if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, - nsGkAtoms::date, eIgnoreCase)) { - return new EnumRoleAccessible(aElement, - aContext->Document()); - } - return nullptr; - }, - 0) +MARKUPMAP(input, + [](Element* aElement, Accessible* aContext) -> Accessible* { + // TODO(emilio): This would be faster if it used + // HTMLInputElement's already-parsed representation. + if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, + nsGkAtoms::checkbox, eIgnoreCase)) { + return new CheckboxAccessible(aElement, aContext->Document()); + } + if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, + nsGkAtoms::image, eIgnoreCase)) { + return new HTMLButtonAccessible(aElement, aContext->Document()); + } + if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, + nsGkAtoms::radio, eIgnoreCase)) { + return new HTMLRadioButtonAccessible(aElement, + aContext->Document()); + } + if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, + nsGkAtoms::time, eIgnoreCase)) { + return new EnumRoleAccessible( + aElement, aContext->Document()); + } + if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, + nsGkAtoms::date, eIgnoreCase)) { + return new EnumRoleAccessible( + aElement, aContext->Document()); + } + return nullptr; + }, + 0) MARKUPMAP(ins, New_HyperText, roles::CONTENT_INSERTION) -MARKUPMAP( - label, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLLabelAccessible(aElement, aContext->Document()); - }, - roles::LABEL) +MARKUPMAP(label, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLLabelAccessible(aElement, aContext->Document()); + }, + roles::LABEL) -MARKUPMAP( - legend, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLLegendAccessible(aElement, aContext->Document()); - }, - roles::LABEL) +MARKUPMAP(legend, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLLegendAccessible(aElement, aContext->Document()); + }, + roles::LABEL) -MARKUPMAP( - li, - [](Element* aElement, Accessible* aContext) -> Accessible* { - // If list item is a child of accessible list then create an - // accessible for it unconditionally by tag name. nsBlockFrame - // creates the list item accessible for other elements styled as - // list items. - if (aContext->IsList() && - aContext->GetContent() == aElement->GetParent()) { - return new HTMLLIAccessible(aElement, aContext->Document()); - } +MARKUPMAP(li, + [](Element* aElement, Accessible* aContext) -> Accessible* { + // If list item is a child of accessible list then create an + // accessible for it unconditionally by tag name. nsBlockFrame + // creates the list item accessible for other elements styled as + // list items. + if (aContext->IsList() && + aContext->GetContent() == aElement->GetParent()) { + return new HTMLLIAccessible(aElement, aContext->Document()); + } - return nullptr; - }, - 0) + return nullptr; + }, + 0) MARKUPMAP(main, New_HyperText, roles::LANDMARK) @@ -311,34 +301,31 @@ MARKUPMAP(munderover_, New_HyperText, roles::MATHML_UNDER_OVER, MARKUPMAP(mmultiscripts_, New_HyperText, roles::MATHML_MULTISCRIPTS) -MARKUPMAP( - mtable_, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLTableAccessible(aElement, aContext->Document()); - }, - roles::MATHML_TABLE, AttrFromDOM(align, align), - AttrFromDOM(columnlines_, columnlines_), AttrFromDOM(rowlines_, rowlines_)) +MARKUPMAP(mtable_, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLTableAccessible(aElement, aContext->Document()); + }, + roles::MATHML_TABLE, AttrFromDOM(align, align), + AttrFromDOM(columnlines_, columnlines_), + AttrFromDOM(rowlines_, rowlines_)) -MARKUPMAP( - mlabeledtr_, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLTableRowAccessible(aElement, aContext->Document()); - }, - roles::MATHML_LABELED_ROW) +MARKUPMAP(mlabeledtr_, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLTableRowAccessible(aElement, aContext->Document()); + }, + roles::MATHML_LABELED_ROW) -MARKUPMAP( - mtr_, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLTableRowAccessible(aElement, aContext->Document()); - }, - roles::MATHML_TABLE_ROW) +MARKUPMAP(mtr_, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLTableRowAccessible(aElement, aContext->Document()); + }, + roles::MATHML_TABLE_ROW) -MARKUPMAP( - mtd_, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLTableCellAccessible(aElement, aContext->Document()); - }, - roles::MATHML_CELL) +MARKUPMAP(mtd_, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLTableCellAccessible(aElement, aContext->Document()); + }, + roles::MATHML_CELL) MARKUPMAP(maction_, New_HyperText, roles::MATHML_ACTION, AttrFromDOM(actiontype_, actiontype_), @@ -369,183 +356,173 @@ MARKUPMAP(msline_, New_HyperText, roles::MATHML_STACK_LINE, MARKUPMAP(nav, New_HyperText, roles::LANDMARK) -MARKUPMAP( - ol, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLListAccessible(aElement, aContext->Document()); - }, - roles::LIST) +MARKUPMAP(ol, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLListAccessible(aElement, aContext->Document()); + }, + roles::LIST) -MARKUPMAP( - option, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLSelectOptionAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(option, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLSelectOptionAccessible(aElement, + aContext->Document()); + }, + 0) -MARKUPMAP( - optgroup, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLSelectOptGroupAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(optgroup, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLSelectOptGroupAccessible(aElement, + aContext->Document()); + }, + 0) -MARKUPMAP( - output, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLOutputAccessible(aElement, aContext->Document()); - }, - roles::SECTION, Attr(live, polite)) +MARKUPMAP(output, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLOutputAccessible(aElement, aContext->Document()); + }, + roles::SECTION, Attr(live, polite)) MARKUPMAP(p, nullptr, roles::PARAGRAPH) -MARKUPMAP( - progress, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLProgressAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(progress, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLProgressAccessible(aElement, aContext->Document()); + }, + 0) MARKUPMAP(q, New_HyperText, 0) -MARKUPMAP( - section, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLSectionAccessible(aElement, aContext->Document()); - }, - 0) +MARKUPMAP(section, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLSectionAccessible(aElement, aContext->Document()); + }, + 0) -MARKUPMAP( - summary, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLSummaryAccessible(aElement, aContext->Document()); - }, - roles::SUMMARY) +MARKUPMAP(summary, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLSummaryAccessible(aElement, aContext->Document()); + }, + roles::SUMMARY) -MARKUPMAP( - table, - [](Element* aElement, Accessible* aContext) -> Accessible* { - if (aElement->GetPrimaryFrame() && - aElement->GetPrimaryFrame()->AccessibleType() != eHTMLTableType) { - return new ARIAGridAccessibleWrap(aElement, aContext->Document()); - } - return nullptr; - }, - 0) +MARKUPMAP(table, + [](Element* aElement, Accessible* aContext) -> Accessible* { + if (aElement->GetPrimaryFrame() && + aElement->GetPrimaryFrame()->AccessibleType() != + eHTMLTableType) { + return new ARIAGridAccessibleWrap(aElement, aContext->Document()); + } + return nullptr; + }, + 0) MARKUPMAP(time, New_HyperText, 0, Attr(xmlroles, time), AttrFromDOM(datetime, datetime)) -MARKUPMAP( - tbody, - [](Element* aElement, Accessible* aContext) -> Accessible* { - // Expose this as a grouping if its frame type is non-standard. - if (aElement->GetPrimaryFrame() && - aElement->GetPrimaryFrame()->IsTableRowGroupFrame()) { - return nullptr; - } - return new HyperTextAccessibleWrap(aElement, aContext->Document()); - }, - roles::GROUPING) +MARKUPMAP(tbody, + [](Element* aElement, Accessible* aContext) -> Accessible* { + // Expose this as a grouping if its frame type is non-standard. + if (aElement->GetPrimaryFrame() && + aElement->GetPrimaryFrame()->IsTableRowGroupFrame()) { + return nullptr; + } + return new HyperTextAccessibleWrap(aElement, aContext->Document()); + }, + roles::GROUPING) -MARKUPMAP( - td, - [](Element* aElement, Accessible* aContext) -> Accessible* { - if (aContext->IsTableRow() && - aContext->GetContent() == aElement->GetParent()) { - // If HTML:td element is part of its HTML:table, which has CSS - // display style other than 'table', then create a generic table - // cell accessible, because there's no underlying table layout and - // thus native HTML table cell class doesn't work. The same is - // true if the cell itself has CSS display:block;. - if (!aContext->IsHTMLTableRow() || - (aElement->GetPrimaryFrame() && - aElement->GetPrimaryFrame()->AccessibleType() != - eHTMLTableCellType)) { - return new ARIAGridCellAccessibleWrap(aElement, aContext->Document()); - } - if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::scope)) { - return new HTMLTableHeaderCellAccessibleWrap(aElement, - aContext->Document()); - } - } - return nullptr; - }, - 0) +MARKUPMAP(td, + [](Element* aElement, Accessible* aContext) -> Accessible* { + if (aContext->IsTableRow() && + aContext->GetContent() == aElement->GetParent()) { + // If HTML:td element is part of its HTML:table, which has CSS + // display style other than 'table', then create a generic table + // cell accessible, because there's no underlying table layout and + // thus native HTML table cell class doesn't work. The same is + // true if the cell itself has CSS display:block;. + if (!aContext->IsHTMLTableRow() || + (aElement->GetPrimaryFrame() && + aElement->GetPrimaryFrame()->AccessibleType() != + eHTMLTableCellType)) { + return new ARIAGridCellAccessibleWrap(aElement, + aContext->Document()); + } + if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::scope)) { + return new HTMLTableHeaderCellAccessibleWrap( + aElement, aContext->Document()); + } + } + return nullptr; + }, + 0) -MARKUPMAP( - tfoot, - [](Element* aElement, Accessible* aContext) -> Accessible* { - // Expose this as a grouping if its frame type is non-standard. - if (aElement->GetPrimaryFrame() && - aElement->GetPrimaryFrame()->IsTableRowGroupFrame()) { - return nullptr; - } - return new HyperTextAccessibleWrap(aElement, aContext->Document()); - }, - roles::GROUPING) +MARKUPMAP(tfoot, + [](Element* aElement, Accessible* aContext) -> Accessible* { + // Expose this as a grouping if its frame type is non-standard. + if (aElement->GetPrimaryFrame() && + aElement->GetPrimaryFrame()->IsTableRowGroupFrame()) { + return nullptr; + } + return new HyperTextAccessibleWrap(aElement, aContext->Document()); + }, + roles::GROUPING) -MARKUPMAP( - th, - [](Element* aElement, Accessible* aContext) -> Accessible* { - if (aContext->IsTableRow() && - aContext->GetContent() == aElement->GetParent()) { - if (!aContext->IsHTMLTableRow()) { - return new ARIAGridCellAccessibleWrap(aElement, aContext->Document()); - } - return new HTMLTableHeaderCellAccessibleWrap(aElement, - aContext->Document()); - } - return nullptr; - }, - 0) +MARKUPMAP(th, + [](Element* aElement, Accessible* aContext) -> Accessible* { + if (aContext->IsTableRow() && + aContext->GetContent() == aElement->GetParent()) { + if (!aContext->IsHTMLTableRow()) { + return new ARIAGridCellAccessibleWrap(aElement, + aContext->Document()); + } + return new HTMLTableHeaderCellAccessibleWrap( + aElement, aContext->Document()); + } + return nullptr; + }, + 0) -MARKUPMAP( - tfoot, - [](Element* aElement, Accessible* aContext) -> Accessible* { - // Expose this as a grouping if its frame type is non-standard. - if (aElement->GetPrimaryFrame() && - aElement->GetPrimaryFrame()->IsTableRowGroupFrame()) { - return nullptr; - } - return new HyperTextAccessibleWrap(aElement, aContext->Document()); - }, - roles::GROUPING) +MARKUPMAP(tfoot, + [](Element* aElement, Accessible* aContext) -> Accessible* { + // Expose this as a grouping if its frame type is non-standard. + if (aElement->GetPrimaryFrame() && + aElement->GetPrimaryFrame()->IsTableRowGroupFrame()) { + return nullptr; + } + return new HyperTextAccessibleWrap(aElement, aContext->Document()); + }, + roles::GROUPING) -MARKUPMAP( - tr, - [](Element* aElement, Accessible* aContext) -> Accessible* { - // If HTML:tr element is part of its HTML:table, which has CSS - // display style other than 'table', then create a generic table row - // accessible, because there's no underlying table layout and thus - // native HTML table row class doesn't work. Refer to - // CreateAccessibleByFrameType dual logic. - Accessible* table = aContext->IsTable() ? aContext : nullptr; - if (!table && aContext->Parent() && aContext->Parent()->IsTable()) { - table = aContext->Parent(); - } - if (table) { - nsIContent* parentContent = aElement->GetParent(); - nsIFrame* parentFrame = parentContent->GetPrimaryFrame(); - if (parentFrame && !parentFrame->IsTableWrapperFrame()) { - parentContent = parentContent->GetParent(); - parentFrame = parentContent->GetPrimaryFrame(); - if (table->GetContent() == parentContent && - ((parentFrame && !parentFrame->IsTableWrapperFrame()) || - (aElement->GetPrimaryFrame() && - aElement->GetPrimaryFrame()->AccessibleType() != - eHTMLTableRowType))) { - return new ARIARowAccessible(aElement, aContext->Document()); - } - } - } - return nullptr; - }, - 0) +MARKUPMAP(tr, + [](Element* aElement, Accessible* aContext) -> Accessible* { + // If HTML:tr element is part of its HTML:table, which has CSS + // display style other than 'table', then create a generic table row + // accessible, because there's no underlying table layout and thus + // native HTML table row class doesn't work. Refer to + // CreateAccessibleByFrameType dual logic. + Accessible* table = aContext->IsTable() ? aContext : nullptr; + if (!table && aContext->Parent() && aContext->Parent()->IsTable()) { + table = aContext->Parent(); + } + if (table) { + nsIContent* parentContent = aElement->GetParent(); + nsIFrame* parentFrame = parentContent->GetPrimaryFrame(); + if (parentFrame && !parentFrame->IsTableWrapperFrame()) { + parentContent = parentContent->GetParent(); + parentFrame = parentContent->GetPrimaryFrame(); + if (table->GetContent() == parentContent && + ((parentFrame && !parentFrame->IsTableWrapperFrame()) || + (aElement->GetPrimaryFrame() && + aElement->GetPrimaryFrame()->AccessibleType() != + eHTMLTableRowType))) { + return new ARIARowAccessible(aElement, aContext->Document()); + } + } + } + return nullptr; + }, + 0) -MARKUPMAP( - ul, - [](Element* aElement, Accessible* aContext) -> Accessible* { - return new HTMLListAccessible(aElement, aContext->Document()); - }, - roles::LIST) +MARKUPMAP(ul, + [](Element* aElement, Accessible* aContext) -> Accessible* { + return new HTMLListAccessible(aElement, aContext->Document()); + }, + roles::LIST) diff --git a/caps/tests/gtest/TestOriginAttributes.cpp b/caps/tests/gtest/TestOriginAttributes.cpp index 91416c7201cf..ffa4349939e4 100644 --- a/caps/tests/gtest/TestOriginAttributes.cpp +++ b/caps/tests/gtest/TestOriginAttributes.cpp @@ -17,20 +17,17 @@ static void TestSuffix(const OriginAttributes& attrs) { EXPECT_EQ(attrs, attrsFromSuffix); } -TEST(OriginAttributes, Suffix_default) -{ +TEST(OriginAttributes, Suffix_default) { OriginAttributes attrs; TestSuffix(attrs); } -TEST(OriginAttributes, Suffix_appId_inIsolatedMozBrowser) -{ +TEST(OriginAttributes, Suffix_appId_inIsolatedMozBrowser) { OriginAttributes attrs(1, true); TestSuffix(attrs); } -TEST(OriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser) -{ +TEST(OriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser) { OriginAttributes attrs(4294967295, true); TestSuffix(attrs); } diff --git a/dom/base/AnonymousContent.cpp b/dom/base/AnonymousContent.cpp index a89dad079b9d..56e2abd853f9 100644 --- a/dom/base/AnonymousContent.cpp +++ b/dom/base/AnonymousContent.cpp @@ -197,7 +197,8 @@ void AnonymousContent::GetComputedStylePropertyValue( aRv = cs->GetPropertyValue(aPropertyName, aResult); } -void AnonymousContent::GetTargetIdForEvent(Event& aEvent, DOMString& aResult) { +void AnonymousContent::GetTargetIdForEvent(Event& aEvent, DOMString& aResult) +{ nsCOMPtr el = do_QueryInterface(aEvent.GetOriginalTarget()); if (el && el->IsInNativeAnonymousSubtree() && mContentNode->Contains(el)) { aResult.SetKnownLiveAtom(el->GetID(), DOMString::eTreatNullAsNull); diff --git a/dom/base/DocGroup.cpp b/dom/base/DocGroup.cpp index 8b8d4ea0b760..30a5551816ea 100644 --- a/dom/base/DocGroup.cpp +++ b/dom/base/DocGroup.cpp @@ -143,21 +143,20 @@ RefPtr DocGroup::ReportPerformanceInfo() { RefPtr self = this; return CollectMemoryInfo(top, mainThread) - ->Then( - mainThread, __func__, - [self, host, pid, windowID, duration, isTopLevel, - items](const PerformanceMemoryInfo& aMemoryInfo) { - PerformanceInfo info = - PerformanceInfo(host, pid, windowID, duration, - self->mPerformanceCounter->GetID(), false, - isTopLevel, aMemoryInfo, items); + ->Then(mainThread, __func__, + [self, host, pid, windowID, duration, isTopLevel, + items](const PerformanceMemoryInfo& aMemoryInfo) { + PerformanceInfo info = + PerformanceInfo(host, pid, windowID, duration, + self->mPerformanceCounter->GetID(), false, + isTopLevel, aMemoryInfo, items); - return PerformanceInfoPromise::CreateAndResolve(std::move(info), - __func__); - }, - [self](const nsresult rv) { - return PerformanceInfoPromise::CreateAndReject(rv, __func__); - }); + return PerformanceInfoPromise::CreateAndResolve(std::move(info), + __func__); + }, + [self](const nsresult rv) { + return PerformanceInfoPromise::CreateAndReject(rv, __func__); + }); } nsresult DocGroup::Dispatch(TaskCategory aCategory, diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index af7675fcb02b..097e9ef598c3 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -12621,20 +12621,19 @@ already_AddRefed Document::RequestStorageAccess( AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor( NodePrincipal(), inner, AntiTrackingCommon::eStorageAccessAPI, performFinalChecks) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [outer, promise] { - // Step 10. Grant the document access to cookies and store - // that fact for - // the purposes of future calls to - // hasStorageAccess() and requestStorageAccess(). - outer->SetHasStorageAccess(true); - promise->MaybeResolveWithUndefined(); - }, - [outer, promise] { - outer->SetHasStorageAccess(false); - promise->MaybeRejectWithUndefined(); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [outer, promise] { + // Step 10. Grant the document access to cookies and store + // that fact for + // the purposes of future calls to + // hasStorageAccess() and requestStorageAccess(). + outer->SetHasStorageAccess(true); + promise->MaybeResolveWithUndefined(); + }, + [outer, promise] { + outer->SetHasStorageAccess(false); + promise->MaybeRejectWithUndefined(); + }); return promise.forget(); } diff --git a/dom/base/TreeOrderedArrayInlines.h b/dom/base/TreeOrderedArrayInlines.h index 13d0394eefe8..4b6ab9d00eda 100644 --- a/dom/base/TreeOrderedArrayInlines.h +++ b/dom/base/TreeOrderedArrayInlines.h @@ -47,7 +47,8 @@ size_t TreeOrderedArray::Insert(Node& aNode) { }; size_t idx; - BinarySearchIf(mList, 0, mList.Length(), PositionComparator(aNode), &idx); + BinarySearchIf(mList, 0, mList.Length(), + PositionComparator(aNode), &idx); mList.InsertElementAt(idx, &aNode); return idx; } diff --git a/dom/base/UIDirectionManager.cpp b/dom/base/UIDirectionManager.cpp index 5caa306d41b2..141ec377602c 100644 --- a/dom/base/UIDirectionManager.cpp +++ b/dom/base/UIDirectionManager.cpp @@ -51,7 +51,8 @@ void OnPrefChange(const char* aPrefName, void*) { void UIDirectionManager::Initialize() { DebugOnly rv = Preferences::RegisterCallback(OnPrefChange, "intl.uidirection"); - MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed to observe \"intl.uidirection\""); + MOZ_ASSERT(NS_SUCCEEDED(rv), + "Failed to observe \"intl.uidirection\""); } /* static */ diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp index b448d0e121dc..a315ee898b49 100644 --- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -1645,9 +1645,7 @@ MiscContainer* nsAttrValue::ClearMiscContainer() { delete cont->mValue.mIntMargin; break; } - default: { - break; - } + default: { break; } } } ResetMiscAtomOrString(); diff --git a/dom/base/nsAttrValueInlines.h b/dom/base/nsAttrValueInlines.h index 6d3069292e1f..94005efe9466 100644 --- a/dom/base/nsAttrValueInlines.h +++ b/dom/base/nsAttrValueInlines.h @@ -242,9 +242,7 @@ inline void nsAttrValue::ToString(mozilla::dom::DOMString& aResult) const { aResult.SetKnownLiveAtom(atom, mozilla::dom::DOMString::eNullNotExpected); break; } - default: { - ToString(aResult.AsAString()); - } + default: { ToString(aResult.AsAString()); } } } diff --git a/dom/base/nsCCUncollectableMarker.cpp b/dom/base/nsCCUncollectableMarker.cpp index c18412aa67b0..524b236852ff 100644 --- a/dom/base/nsCCUncollectableMarker.cpp +++ b/dom/base/nsCCUncollectableMarker.cpp @@ -426,9 +426,7 @@ nsresult nsCCUncollectableMarker::Observe(nsISupports* aSubject, xpc_UnmarkSkippableJSHolders(); break; } - default: { - break; - } + default: { break; } } return NS_OK; diff --git a/dom/base/test/gtest/TestContentUtils.cpp b/dom/base/test/gtest/TestContentUtils.cpp index ad4b59378725..53f3bbdc85b9 100644 --- a/dom/base/test/gtest/TestContentUtils.cpp +++ b/dom/base/test/gtest/TestContentUtils.cpp @@ -11,8 +11,7 @@ #include "mozilla/CycleCollectedJSContext.h" #include "mozilla/dom/SimpleGlobalObject.h" -TEST(DOM_Base_ContentUtils, StringifyJSON_EmptyValue) -{ +TEST(DOM_Base_ContentUtils, StringifyJSON_EmptyValue) { JSObject* globalObject = mozilla::dom::SimpleGlobalObject::Create( mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail); mozilla::dom::AutoJSAPI jsAPI; @@ -26,8 +25,7 @@ TEST(DOM_Base_ContentUtils, StringifyJSON_EmptyValue) ASSERT_TRUE(serializedValue.EqualsLiteral("null")); } -TEST(DOM_Base_ContentUtils, StringifyJSON_Object) -{ +TEST(DOM_Base_ContentUtils, StringifyJSON_Object) { JSObject* globalObject = mozilla::dom::SimpleGlobalObject::Create( mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail); mozilla::dom::AutoJSAPI jsAPI; diff --git a/dom/base/test/gtest/TestMimeType.cpp b/dom/base/test/gtest/TestMimeType.cpp index cf8af0105450..a2759d382491 100644 --- a/dom/base/test/gtest/TestMimeType.cpp +++ b/dom/base/test/gtest/TestMimeType.cpp @@ -11,688 +11,576 @@ using mozilla::UniquePtr; -TEST(MimeType, EmptyString) -{ +TEST(MimeType, EmptyString) { const auto in = NS_LITERAL_STRING(""); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Empty string"; } -TEST(MimeType, JustWhitespace) -{ +TEST(MimeType, JustWhitespace) { const auto in = NS_LITERAL_STRING(" \t\r\n "); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Just whitespace"; } -TEST(MimeType, JustBackslash) -{ +TEST(MimeType, JustBackslash) { const auto in = NS_LITERAL_STRING("\\"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Just backslash"; } -TEST(MimeType, JustForwardslash) -{ +TEST(MimeType, JustForwardslash) { const auto in = NS_LITERAL_STRING("/"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Just forward slash"; } -TEST(MimeType, MissingType1) -{ +TEST(MimeType, MissingType1) { const auto in = NS_LITERAL_STRING("/bogus"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Missing type #1"; } -TEST(MimeType, MissingType2) -{ +TEST(MimeType, MissingType2) { const auto in = NS_LITERAL_STRING(" \r\n\t/bogus"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Missing type #2"; } -TEST(MimeType, MissingSubtype1) -{ +TEST(MimeType, MissingSubtype1) { const auto in = NS_LITERAL_STRING("bogus"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Missing subtype #1"; } -TEST(MimeType, MissingSubType2) -{ +TEST(MimeType, MissingSubType2) { const auto in = NS_LITERAL_STRING("bogus/"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Missing subtype #2"; } -TEST(MimeType, MissingSubType3) -{ +TEST(MimeType, MissingSubType3) { const auto in = NS_LITERAL_STRING("bogus;"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Missing subtype #3"; } -TEST(MimeType, MissingSubType4) -{ +TEST(MimeType, MissingSubType4) { const auto in = NS_LITERAL_STRING("bogus; \r\n\t"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Missing subtype #3"; } -TEST(MimeType, ExtraForwardSlash) -{ +TEST(MimeType, ExtraForwardSlash) { const auto in = NS_LITERAL_STRING("bogus/bogus/;"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Extra forward slash"; } -TEST(MimeType, WhitespaceInType) -{ +TEST(MimeType, WhitespaceInType) { const auto in = NS_LITERAL_STRING("t\re\nx\tt /html"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Type with whitespace"; } -TEST(MimeType, WhitespaceInSubtype) -{ +TEST(MimeType, WhitespaceInSubtype) { const auto in = NS_LITERAL_STRING("text/ h\rt\nm\tl"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Subtype with whitespace"; } -TEST(MimeType, NonAlphanumericMediaType1) -{ +TEST(MimeType, NonAlphanumericMediaType1) { const auto in = NS_LITERAL_STRING(""); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-alphanumeric media type #1"; } -TEST(MimeType, NonAlphanumericMediaType2) -{ +TEST(MimeType, NonAlphanumericMediaType2) { const auto in = NS_LITERAL_STRING("(/)"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-alphanumeric media type #2"; } -TEST(MimeType, NonAlphanumericMediaType3) -{ +TEST(MimeType, NonAlphanumericMediaType3) { const auto in = NS_LITERAL_STRING("{/}"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-alphanumeric media type #3"; } -TEST(MimeType, NonAlphanumericMediaType4) -{ +TEST(MimeType, NonAlphanumericMediaType4) { const auto in = NS_LITERAL_STRING("\"/\""); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-alphanumeric media type #4"; } -TEST(MimeType, NonAlphanumericMediaType5) -{ +TEST(MimeType, NonAlphanumericMediaType5) { const auto in = NS_LITERAL_STRING("\0/\0"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-alphanumeric media type #5"; } -TEST(MimeType, NonAlphanumericMediaType6) -{ +TEST(MimeType, NonAlphanumericMediaType6) { const auto in = NS_LITERAL_STRING("text/html(;doesnot=matter"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-alphanumeric media type #6"; } -TEST(MimeType, NonLatin1MediaType1) -{ +TEST(MimeType, NonLatin1MediaType1) { const auto in = NS_LITERAL_STRING("ÿ/ÿ"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-latin1 media type #1"; } -TEST(MimeType, NonLatin1MediaType2) -{ +TEST(MimeType, NonLatin1MediaType2) { const auto in = NS_LITERAL_STRING(u"\x0100/\x0100"); UniquePtr parsed = MimeType::Parse(in); ASSERT_FALSE(parsed) << "Non-latin1 media type #2"; } -TEST(MimeType, MultipleParameters) -{ +TEST(MimeType, MultipleParameters) { const auto in = NS_LITERAL_STRING("text/html;charset=gbk;no=1;charset_=gbk_;yes=2"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsString out; parsed->Serialize(out); ASSERT_TRUE(out.Equals( NS_LITERAL_STRING("text/html;charset=gbk;no=1;charset_=gbk_;yes=2"))) - << "Multiple parameters"; + << "Multiple parameters"; } -TEST(MimeType, DuplicateParameter1) -{ +TEST(MimeType, DuplicateParameter1) { const auto in = NS_LITERAL_STRING("text/html;charset=gbk;charset=windows-1255"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsString out; parsed->Serialize(out); ASSERT_TRUE(out.Equals(NS_LITERAL_STRING("text/html;charset=gbk"))) - << "Duplicate parameter #1"; + << "Duplicate parameter #1"; } -TEST(MimeType, DuplicateParameter2) -{ +TEST(MimeType, DuplicateParameter2) { const auto in = NS_LITERAL_STRING("text/html;charset=();charset=GBK"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsString out; parsed->Serialize(out); ASSERT_TRUE(out.Equals(NS_LITERAL_STRING("text/html;charset=\"()\""))) - << "Duplicate parameter #2"; + << "Duplicate parameter #2"; } -TEST(MimeType, CString) -{ +TEST(MimeType, CString) { const auto in = NS_LITERAL_CSTRING("text/html;charset=();charset=GBK"); UniquePtr parsed = CMimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsCString out; parsed->Serialize(out); ASSERT_TRUE(out.Equals(NS_LITERAL_CSTRING("text/html;charset=\"()\""))) - << "Duplicate parameter #2"; + << "Duplicate parameter #2"; } #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable : 4819) #endif -TEST(MimeType, NonAlphanumericParametersAreQuoted) -{ +TEST(MimeType, NonAlphanumericParametersAreQuoted) { const auto in = NS_LITERAL_STRING("text/html;test=\x00FF\\;charset=gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsString out; parsed->Serialize(out); ASSERT_TRUE(out.Equals( NS_LITERAL_STRING("text/html;test=\"\x00FF\\\\\";charset=gbk"))) - << "Non-alphanumeric parameters are quoted"; + << "Non-alphanumeric parameters are quoted"; } #ifdef _MSC_VER # pragma warning(pop) #endif -TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace1) -{ +TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace1) { const auto in = NS_LITERAL_STRING("text/html;charset= g\\\"bk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" g\\\\\\\"bk\"")) - << "Parameter is quoted if has leading whitespace #1"; + << "Parameter is quoted if has leading whitespace #1"; } -TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace2) -{ +TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace2) { const auto in = NS_LITERAL_STRING("text/html;charset= \"g\\bk\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" \\\"g\\\\bk\\\"\"")) - << "Parameter is quoted if has leading whitespace #2"; + << "Parameter is quoted if has leading whitespace #2"; } -TEST(MimeType, ParameterQuotedIfHasInternalWhitespace) -{ +TEST(MimeType, ParameterQuotedIfHasInternalWhitespace) { const auto in = NS_LITERAL_STRING("text/html;charset=g \\b\"k"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"g \\\\b\\\"k\"")) - << "Parameter is quoted if has internal whitespace"; + << "Parameter is quoted if has internal whitespace"; } -TEST(MimeType, ImproperlyQuotedParameter1) -{ +TEST(MimeType, ImproperlyQuotedParameter1) { const auto in = NS_LITERAL_STRING("x/x;test=\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("x/x;test=\"\"")) - << "Improperly-quoted parameter is handled properly #1"; + << "Improperly-quoted parameter is handled properly #1"; } -TEST(MimeType, ImproperlyQuotedParameter2) -{ +TEST(MimeType, ImproperlyQuotedParameter2) { const auto in = NS_LITERAL_STRING("x/x;test=\"\\"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("x/x;test=\"\\\\\"")) - << "Improperly-quoted parameter is handled properly #2"; + << "Improperly-quoted parameter is handled properly #2"; } -TEST(MimeType, NonLatin1ParameterIgnored) -{ +TEST(MimeType, NonLatin1ParameterIgnored) { const auto in = NS_LITERAL_STRING(u"x/x;test=\xFFFD;x=x"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("x/x;x=x")) - << "Non latin-1 parameters are ignored"; + << "Non latin-1 parameters are ignored"; } -TEST(MimeType, ParameterIgnoredIfWhitespaceInName1) -{ +TEST(MimeType, ParameterIgnoredIfWhitespaceInName1) { const auto in = NS_LITERAL_STRING("text/html;charset =gbk;charset=123"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=123")) - << "Parameter ignored if whitespace in name #1"; + << "Parameter ignored if whitespace in name #1"; } -TEST(MimeType, ParameterIgnoredIfWhitespaceInName2) -{ +TEST(MimeType, ParameterIgnoredIfWhitespaceInName2) { const auto in = NS_LITERAL_STRING("text/html;cha rset =gbk;charset=123"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=123")) - << "Parameter ignored if whitespace in name #2"; + << "Parameter ignored if whitespace in name #2"; } -TEST(MimeType, WhitespaceTrimmed) -{ +TEST(MimeType, WhitespaceTrimmed) { const auto in = NS_LITERAL_STRING( "\n\r\t text/plain\n\r\t ;\n\r\t charset=123\n\r\t "); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/plain;charset=123")) - << "Whitespace appropriately ignored"; + << "Whitespace appropriately ignored"; } -TEST(MimeType, WhitespaceOnlyParameterIgnored) -{ +TEST(MimeType, WhitespaceOnlyParameterIgnored) { const auto in = NS_LITERAL_STRING("x/x;x= \r\n\t"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("x/x")) - << "Whitespace-only parameter is ignored"; + << "Whitespace-only parameter is ignored"; } -TEST(MimeType, IncompleteParameterIgnored1) -{ +TEST(MimeType, IncompleteParameterIgnored1) { const auto in = NS_LITERAL_STRING("x/x;test"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); - ASSERT_TRUE(out.EqualsLiteral("x/x")) - << "Incomplete parameter is ignored #1"; + ASSERT_TRUE(out.EqualsLiteral("x/x")) << "Incomplete parameter is ignored #1"; } -TEST(MimeType, IncompleteParameterIgnored2) -{ +TEST(MimeType, IncompleteParameterIgnored2) { const auto in = NS_LITERAL_STRING("x/x;test="); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); - ASSERT_TRUE(out.EqualsLiteral("x/x")) - << "Incomplete parameter is ignored #2"; + ASSERT_TRUE(out.EqualsLiteral("x/x")) << "Incomplete parameter is ignored #2"; } -TEST(MimeType, IncompleteParameterIgnored3) -{ +TEST(MimeType, IncompleteParameterIgnored3) { const auto in = NS_LITERAL_STRING("x/x;test= \r\n\t"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); - ASSERT_TRUE(out.EqualsLiteral("x/x")) - << "Incomplete parameter is ignored #3"; + ASSERT_TRUE(out.EqualsLiteral("x/x")) << "Incomplete parameter is ignored #3"; } -TEST(MimeType, IncompleteParameterIgnored4) -{ +TEST(MimeType, IncompleteParameterIgnored4) { const auto in = NS_LITERAL_STRING("text/html;test;charset=gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Incomplete parameter is ignored #4"; + << "Incomplete parameter is ignored #4"; } -TEST(MimeType, IncompleteParameterIgnored5) -{ +TEST(MimeType, IncompleteParameterIgnored5) { const auto in = NS_LITERAL_STRING("text/html;test=;charset=gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Incomplete parameter is ignored #5"; + << "Incomplete parameter is ignored #5"; } -TEST(MimeType, EmptyParameterIgnored1) -{ +TEST(MimeType, EmptyParameterIgnored1) { const auto in = NS_LITERAL_STRING("text/html ; ; charset=gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Empty parameter ignored #1"; + << "Empty parameter ignored #1"; } -TEST(MimeType, EmptyParameterIgnored2) -{ +TEST(MimeType, EmptyParameterIgnored2) { const auto in = NS_LITERAL_STRING("text/html;;;;charset=gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Empty parameter ignored #2"; + << "Empty parameter ignored #2"; } -TEST(MimeType, InvalidParameterIgnored1) -{ +TEST(MimeType, InvalidParameterIgnored1) { const auto in = NS_LITERAL_STRING("text/html;';charset=gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Invalid parameter ignored #1"; + << "Invalid parameter ignored #1"; } -TEST(MimeType, InvalidParameterIgnored2) -{ +TEST(MimeType, InvalidParameterIgnored2) { const auto in = NS_LITERAL_STRING("text/html;\";charset=gbk;=123; =321"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Invalid parameter ignored #2"; + << "Invalid parameter ignored #2"; } -TEST(MimeType, InvalidParameterIgnored3) -{ +TEST(MimeType, InvalidParameterIgnored3) { const auto in = NS_LITERAL_STRING("text/html;charset= \"\u007F;charset=GBK"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=GBK")) - << "Invalid parameter ignored #3"; + << "Invalid parameter ignored #3"; } -TEST(MimeType, InvalidParameterIgnored4) -{ +TEST(MimeType, InvalidParameterIgnored4) { const auto in = NS_LITERAL_STRING( "text/html;charset=\"\u007F;charset=foo\";charset=GBK;charset="); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=GBK")) - << "Invalid parameter ignored #4"; + << "Invalid parameter ignored #4"; } -TEST(MimeType, SingleQuotes1) -{ +TEST(MimeType, SingleQuotes1) { const auto in = NS_LITERAL_STRING("text/html;charset='gbk'"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset='gbk'")) - << "Single quotes handled properly #1"; + << "Single quotes handled properly #1"; } -TEST(MimeType, SingleQuotes2) -{ +TEST(MimeType, SingleQuotes2) { const auto in = NS_LITERAL_STRING("text/html;charset='gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset='gbk")) - << "Single quotes handled properly #2"; + << "Single quotes handled properly #2"; } -TEST(MimeType, SingleQuotes3) -{ +TEST(MimeType, SingleQuotes3) { const auto in = NS_LITERAL_STRING("text/html;charset=gbk'"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk'")) - << "Single quotes handled properly #3"; + << "Single quotes handled properly #3"; } -TEST(MimeType, SingleQuotes4) -{ +TEST(MimeType, SingleQuotes4) { const auto in = NS_LITERAL_STRING("text/html;charset=';charset=GBK"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset='")) - << "Single quotes handled properly #4"; + << "Single quotes handled properly #4"; } -TEST(MimeType, SingleQuotes5) -{ +TEST(MimeType, SingleQuotes5) { const auto in = NS_LITERAL_STRING("text/html;charset=''';charset=GBK"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset='''")) - << "Single quotes handled properly #5"; + << "Single quotes handled properly #5"; } -TEST(MimeType, DoubleQuotes1) -{ +TEST(MimeType, DoubleQuotes1) { const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Double quotes handled properly #1"; + << "Double quotes handled properly #1"; } -TEST(MimeType, DoubleQuotes2) -{ +TEST(MimeType, DoubleQuotes2) { const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Double quotes handled properly #2"; + << "Double quotes handled properly #2"; } -TEST(MimeType, DoubleQuotes3) -{ +TEST(MimeType, DoubleQuotes3) { const auto in = NS_LITERAL_STRING("text/html;charset=gbk\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk\\\"\"")) - << "Double quotes handled properly #3"; + << "Double quotes handled properly #3"; } -TEST(MimeType, DoubleQuotes4) -{ +TEST(MimeType, DoubleQuotes4) { const auto in = NS_LITERAL_STRING("text/html;charset=\" gbk\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" gbk\"")) - << "Double quotes handled properly #4"; + << "Double quotes handled properly #4"; } -TEST(MimeType, DoubleQuotes5) -{ +TEST(MimeType, DoubleQuotes5) { const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk \""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk \"")) - << "Double quotes handled properly #5"; + << "Double quotes handled properly #5"; } -TEST(MimeType, DoubleQuotes6) -{ +TEST(MimeType, DoubleQuotes6) { const auto in = NS_LITERAL_STRING("text/html;charset=\"\\ gbk\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" gbk\"")) - << "Double quotes handled properly #6"; + << "Double quotes handled properly #6"; } -TEST(MimeType, DoubleQuotes7) -{ +TEST(MimeType, DoubleQuotes7) { const auto in = NS_LITERAL_STRING("text/html;charset=\"\\g\\b\\k\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Double quotes handled properly #7"; + << "Double quotes handled properly #7"; } -TEST(MimeType, DoubleQuotes8) -{ +TEST(MimeType, DoubleQuotes8) { const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk\"x"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk")) - << "Double quotes handled properly #8"; + << "Double quotes handled properly #8"; } -TEST(MimeType, DoubleQuotes9) -{ +TEST(MimeType, DoubleQuotes9) { const auto in = NS_LITERAL_STRING("text/html;charset=\"\";charset=GBK"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"\"")) - << "Double quotes handled properly #9"; + << "Double quotes handled properly #9"; } -TEST(MimeType, DoubleQuotes10) -{ +TEST(MimeType, DoubleQuotes10) { const auto in = NS_LITERAL_STRING("text/html;charset=\";charset=GBK"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\";charset=GBK\"")) - << "Double quotes handled properly #10"; + << "Double quotes handled properly #10"; } -TEST(MimeType, UnexpectedCodePoints) -{ +TEST(MimeType, UnexpectedCodePoints) { const auto in = NS_LITERAL_STRING("text/html;charset={gbk}"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"{gbk}\"")) - << "Unexpected code points handled properly"; + << "Unexpected code points handled properly"; } -TEST(MimeType, LongTypesSubtypesAccepted) -{ +TEST(MimeType, LongTypesSubtypesAccepted) { const auto in = NS_LITERAL_STRING( "012345678901234567890123456789012345678901234567890123456789012345678901" "2345678901234567890123456789012345678901234567890123456789/" "012345678901234567890123456789012345678901234567890123456789012345678901" "2345678901234567890123456789012345678901234567890123456789"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); - ASSERT_TRUE(out.Equals(in)) - << "Long type/subtype accepted"; + ASSERT_TRUE(out.Equals(in)) << "Long type/subtype accepted"; } -TEST(MimeType, LongParametersAccepted) -{ +TEST(MimeType, LongParametersAccepted) { const auto in = NS_LITERAL_STRING( "text/" "html;" @@ -700,16 +588,13 @@ TEST(MimeType, LongParametersAccepted) "2345678901234567890123456789012345678901234567890123456789=x;charset=" "gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); - ASSERT_TRUE(out.Equals(in)) - << "Long parameters accepted"; + ASSERT_TRUE(out.Equals(in)) << "Long parameters accepted"; } -TEST(MimeType, AllValidCharactersAccepted1) -{ +TEST(MimeType, AllValidCharactersAccepted1) { const auto in = NS_LITERAL_STRING( u"x/x;x=\"\t " u"!\\\"#$%&'()*+,-./" @@ -728,28 +613,23 @@ TEST(MimeType, AllValidCharactersAccepted1) u"\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8" u"\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF\""); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); - ASSERT_TRUE(out.Equals(in)) - << "All valid characters accepted #1"; + ASSERT_TRUE(out.Equals(in)) << "All valid characters accepted #1"; } -TEST(MimeType, CaseNormalization1) -{ +TEST(MimeType, CaseNormalization1) { const auto in = NS_LITERAL_STRING("TEXT/PLAIN;CHARSET=TEST"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/plain;charset=TEST")) - << "Case normalized properly #1"; + << "Case normalized properly #1"; } -TEST(MimeType, CaseNormalization2) -{ +TEST(MimeType, CaseNormalization2) { const auto in = NS_LITERAL_STRING( "!#$%&'*+-.^_`|~" "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/" @@ -759,8 +639,7 @@ TEST(MimeType, CaseNormalization2) "%&'*+-.^_`|~" "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral( @@ -771,29 +650,25 @@ TEST(MimeType, CaseNormalization2) ".^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$" "%&'*+-.^_`|~" "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) - << "Case normalized properly #2"; + << "Case normalized properly #2"; } -TEST(MimeType, LegacyCommentSyntax1) -{ +TEST(MimeType, LegacyCommentSyntax1) { const auto in = NS_LITERAL_STRING("text/html;charset=gbk("); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk(\"")) - << "Legacy comment syntax #1"; + << "Legacy comment syntax #1"; } -TEST(MimeType, LegacyCommentSyntax2) -{ +TEST(MimeType, LegacyCommentSyntax2) { const auto in = NS_LITERAL_STRING("text/html;x=(;charset=gbk"); UniquePtr parsed = MimeType::Parse(in); - ASSERT_TRUE(parsed) - << "Parsing succeeded"; + ASSERT_TRUE(parsed) << "Parsing succeeded"; nsAutoString out; parsed->Serialize(out); ASSERT_TRUE(out.EqualsLiteral("text/html;x=\"(\";charset=gbk")) - << "Legacy comment syntax #2"; + << "Legacy comment syntax #2"; } diff --git a/dom/base/test/gtest/TestPlainTextSerializer.cpp b/dom/base/test/gtest/TestPlainTextSerializer.cpp index 133b10de91fd..2754cedda2a1 100644 --- a/dom/base/test/gtest/TestPlainTextSerializer.cpp +++ b/dom/base/test/gtest/TestPlainTextSerializer.cpp @@ -18,8 +18,7 @@ void ConvertBufToPlainText(nsString &aConBuf, int aFlag) { } // Test for ASCII with format=flowed; delsp=yes -TEST(PlainTextSerializer, ASCIIWithFlowedDelSp) -{ +TEST(PlainTextSerializer, ASCIIWithFlowedDelSp) { nsString test; nsString result; @@ -43,12 +42,11 @@ TEST(PlainTextSerializer, ASCIIWithFlowedDelSp) "Firefox \r\nFirefox Firefox Firefox\r\n"); ASSERT_TRUE(test.Equals(result)) - << "Wrong HTML to ASCII text serialization with format=flowed; delsp=yes"; + << "Wrong HTML to ASCII text serialization with format=flowed; delsp=yes"; } // Test for CJK with format=flowed; delsp=yes -TEST(PlainTextSerializer, CJKWithFlowedDelSp) -{ +TEST(PlainTextSerializer, CJKWithFlowedDelSp) { nsString test; nsString result; @@ -76,12 +74,11 @@ TEST(PlainTextSerializer, CJKWithFlowedDelSp) result.AppendLiteral("\r\n"); ASSERT_TRUE(test.Equals(result)) - << "Wrong HTML to CJK text serialization with format=flowed; delsp=yes"; + << "Wrong HTML to CJK text serialization with format=flowed; delsp=yes"; } // Test for CJK with DisallowLineBreaking -TEST(PlainTextSerializer, CJKWithDisallowLineBreaking) -{ +TEST(PlainTextSerializer, CJKWithDisallowLineBreaking) { nsString test; nsString result; @@ -106,12 +103,11 @@ TEST(PlainTextSerializer, CJKWithDisallowLineBreaking) result.AppendLiteral("\r\n"); ASSERT_TRUE(test.Equals(result)) - << "Wrong HTML to CJK text serialization with OutputDisallowLineBreaking"; + << "Wrong HTML to CJK text serialization with OutputDisallowLineBreaking"; } // Test for ASCII with format=flowed; and quoted lines in preformatted span. -TEST(PlainTextSerializer, PreformatFlowedQuotes) -{ +TEST(PlainTextSerializer, PreformatFlowedQuotes) { nsString test; nsString result; @@ -138,14 +134,12 @@ TEST(PlainTextSerializer, PreformatFlowedQuotes) ">> Firefox Firefox Firefox Firefox \r\n" ">> Firefox Firefox Firefox Firefox\r\n"); - ASSERT_TRUE(test.Equals(result)) - << "Wrong HTML to ASCII text serialization " - "with format=flowed; and quoted " - "lines"; + ASSERT_TRUE(test.Equals(result)) << "Wrong HTML to ASCII text serialization " + "with format=flowed; and quoted " + "lines"; } -TEST(PlainTextSerializer, PrettyPrintedHtml) -{ +TEST(PlainTextSerializer, PrettyPrintedHtml) { nsString test; test.AppendLiteral("" NS_LINEBREAK "" NS_LINEBREAK " first
" NS_LINEBREAK " second
" NS_LINEBREAK @@ -153,11 +147,10 @@ TEST(PlainTextSerializer, PrettyPrintedHtml) ConvertBufToPlainText(test, 0); ASSERT_TRUE(test.EqualsLiteral("first" NS_LINEBREAK "second" NS_LINEBREAK)) - << "Wrong prettyprinted html to text serialization"; + << "Wrong prettyprinted html to text serialization"; } -TEST(PlainTextSerializer, PreElement) -{ +TEST(PlainTextSerializer, PreElement) { nsString test; test.AppendLiteral("" NS_LINEBREAK "" NS_LINEBREAK "
" NS_LINEBREAK "  first" NS_LINEBREAK
@@ -167,11 +160,10 @@ TEST(PlainTextSerializer, PreElement)
   ConvertBufToPlainText(test, 0);
   ASSERT_TRUE(test.EqualsLiteral("  first" NS_LINEBREAK
                                  "  second" NS_LINEBREAK NS_LINEBREAK))
-  << "Wrong prettyprinted html to text serialization";
+      << "Wrong prettyprinted html to text serialization";
 }
 
-TEST(PlainTextSerializer, BlockElement)
-{
+TEST(PlainTextSerializer, BlockElement) {
   nsString test;
   test.AppendLiteral("" NS_LINEBREAK "" NS_LINEBREAK
                      "
" NS_LINEBREAK " first" NS_LINEBREAK @@ -181,11 +173,10 @@ TEST(PlainTextSerializer, BlockElement) ConvertBufToPlainText(test, 0); ASSERT_TRUE(test.EqualsLiteral("first" NS_LINEBREAK "second" NS_LINEBREAK)) - << "Wrong prettyprinted html to text serialization"; + << "Wrong prettyprinted html to text serialization"; } -TEST(PlainTextSerializer, PreWrapElementForThunderbird) -{ +TEST(PlainTextSerializer, PreWrapElementForThunderbird) { // This test examines the magic pre-wrap setup that Thunderbird relies on. nsString test; test.AppendLiteral( @@ -202,16 +193,15 @@ TEST(PlainTextSerializer, PreWrapElementForThunderbird) " first" NS_LINEBREAK "line is" NS_LINEBREAK "too long" NS_LINEBREAK " second" NS_LINEBREAK "line is" NS_LINEBREAK "even" NS_LINEBREAK "loooonger" NS_LINEBREAK NS_LINEBREAK NS_LINEBREAK)) - << "Wrong prettyprinted html to text serialization"; + << "Wrong prettyprinted html to text serialization"; } -TEST(PlainTextSerializer, Simple) -{ +TEST(PlainTextSerializer, Simple) { nsString test; test.AppendLiteral( "basespan" "body"); ConvertBufToPlainText(test, 0); ASSERT_TRUE(test.EqualsLiteral("basespanbody")) - << "Wrong html to text serialization"; + << "Wrong html to text serialization"; } diff --git a/dom/base/test/gtest/TestXPathGenerator.cpp b/dom/base/test/gtest/TestXPathGenerator.cpp index c9f4993179ad..0b6a09233d98 100644 --- a/dom/base/test/gtest/TestXPathGenerator.cpp +++ b/dom/base/test/gtest/TestXPathGenerator.cpp @@ -8,8 +8,7 @@ #include "XPathGenerator.h" #include "nsString.h" -TEST(TestXPathGenerator, TestQuoteArgumentWithoutQuote) -{ +TEST(TestXPathGenerator, TestQuoteArgumentWithoutQuote) { nsAutoString arg; arg.AssignLiteral(u"testing"); @@ -22,8 +21,7 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithoutQuote) ASSERT_TRUE(expectedResult.Equals(result)); } -TEST(TestXPathGenerator, TestQuoteArgumentWithSingleQuote) -{ +TEST(TestXPathGenerator, TestQuoteArgumentWithSingleQuote) { nsAutoString arg; arg.AssignLiteral(u"\'testing\'"); @@ -36,8 +34,7 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithSingleQuote) ASSERT_TRUE(expectedResult.Equals(result)); } -TEST(TestXPathGenerator, TestQuoteArgumentWithDoubleQuote) -{ +TEST(TestXPathGenerator, TestQuoteArgumentWithDoubleQuote) { nsAutoString arg; arg.AssignLiteral(u"\"testing\""); @@ -50,8 +47,7 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithDoubleQuote) ASSERT_TRUE(expectedResult.Equals(result)); } -TEST(TestXPathGenerator, TestQuoteArgumentWithSingleAndDoubleQuote) -{ +TEST(TestXPathGenerator, TestQuoteArgumentWithSingleAndDoubleQuote) { nsAutoString arg; arg.AssignLiteral(u"\'testing\""); @@ -67,8 +63,7 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithSingleAndDoubleQuote) } TEST(TestXPathGenerator, - TestQuoteArgumentWithDoubleQuoteAndASequenceOfSingleQuote) -{ + TestQuoteArgumentWithDoubleQuoteAndASequenceOfSingleQuote) { nsAutoString arg; arg.AssignLiteral(u"\'\'\'\'testing\""); @@ -84,8 +79,7 @@ TEST(TestXPathGenerator, } TEST(TestXPathGenerator, - TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuote) -{ + TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuote) { nsAutoString arg; arg.AssignLiteral(u"\'\'\'\'testing\'\'\'\'\'\'\""); @@ -102,8 +96,7 @@ TEST(TestXPathGenerator, } TEST(TestXPathGenerator, - TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuoteInMiddle) -{ + TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuoteInMiddle) { nsAutoString arg; arg.AssignLiteral(u"t\'\'\'\'estin\'\'\'\'\'\'\"g"); @@ -119,8 +112,7 @@ TEST(TestXPathGenerator, ASSERT_TRUE(expectedResult.Equals(result)); } -TEST(TestXPathGenerator, TestEscapeNameWithNormalCharacters) -{ +TEST(TestXPathGenerator, TestEscapeNameWithNormalCharacters) { nsAutoString arg; arg.AssignLiteral(u"testing"); @@ -133,8 +125,7 @@ TEST(TestXPathGenerator, TestEscapeNameWithNormalCharacters) ASSERT_TRUE(expectedResult.Equals(result)); } -TEST(TestXPathGenerator, TestEscapeNameWithSpecialCharacters) -{ +TEST(TestXPathGenerator, TestEscapeNameWithSpecialCharacters) { nsAutoString arg; arg.AssignLiteral(u"^testing!"); diff --git a/dom/cache/Context.cpp b/dom/cache/Context.cpp index d330fc973fe0..2c656e745b19 100644 --- a/dom/cache/Context.cpp +++ b/dom/cache/Context.cpp @@ -437,9 +437,7 @@ Context::QuotaInitRunnable::Run() { } // ----- case STATE_WAIT_FOR_DIRECTORY_LOCK: - default: { - MOZ_CRASH("unexpected state in QuotaInitRunnable"); - } + default: { MOZ_CRASH("unexpected state in QuotaInitRunnable"); } } if (resolver->Resolved()) { diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 0f35c2c9eab5..4ca93749656a 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -893,7 +893,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasRenderingContext2D) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END -CanvasRenderingContext2D::ContextState::ContextState() = default; +CanvasRenderingContext2D::ContextState::ContextState() = default; CanvasRenderingContext2D::ContextState::ContextState(const ContextState& aOther) : fontGroup(aOther.fontGroup), diff --git a/dom/canvas/WebGLContextVertices.cpp b/dom/canvas/WebGLContextVertices.cpp index fb336ffdcaf7..605accc1f024 100644 --- a/dom/canvas/WebGLContextVertices.cpp +++ b/dom/canvas/WebGLContextVertices.cpp @@ -402,8 +402,8 @@ void WebGLContext::VertexAttribAnyPointer(bool isFuncInt, GLuint index, } WebGLVertexAttribData& vd = mBoundVertexArray->mAttribs[index]; - vd.VertexAttribPointer(isFuncInt, buffer, AutoAssertCast(size), type, - normalized, stride, byteOffset); + vd.VertexAttribPointer(isFuncInt, buffer, AutoAssertCast(size), type, normalized, stride, + byteOffset); mBoundVertexArray->InvalidateCaches(); } diff --git a/dom/canvas/WebGLTexelConversions.h b/dom/canvas/WebGLTexelConversions.h index 7a594a8c05d2..31f121a8a314 100644 --- a/dom/canvas/WebGLTexelConversions.h +++ b/dom/canvas/WebGLTexelConversions.h @@ -962,7 +962,7 @@ MOZ_ALWAYS_INLINE void pack(const uint8_t* __restrict src, uint16_t* __restrict dst) { *dst = uint16_t(((src[0] & 0xF8) << 8) | ((src[1] & 0xFC) << 3) | - ((src[2] & 0xF8) >> 3)); + ((src[2] & 0xF8) >> 3)); } template <> @@ -974,8 +974,7 @@ pack(src[0] * scaleFactor); uint8_t srcG = static_cast(src[1] * scaleFactor); uint8_t srcB = static_cast(src[2] * scaleFactor); - *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) | - ((srcB & 0xF8) >> 3)); + *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) | ((srcB & 0xF8) >> 3)); } // FIXME: this routine is lossy and must be removed. @@ -988,8 +987,7 @@ pack(src[0] * scaleFactor); uint8_t srcG = static_cast(src[1] * scaleFactor); uint8_t srcB = static_cast(src[2] * scaleFactor); - *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) | - ((srcB & 0xF8) >> 3)); + *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) | ((srcB & 0xF8) >> 3)); } template <> @@ -1123,8 +1121,8 @@ template <> MOZ_ALWAYS_INLINE void pack(const uint8_t* __restrict src, uint16_t* __restrict dst) { - *dst = uint16_t(((src[0] & 0xF0) << 8) | ((src[1] & 0xF0) << 4) | - (src[2] & 0xF0) | (src[3] >> 4)); + *dst = uint16_t(((src[0] & 0xF0) << 8) | ((src[1] & 0xF0) << 4) | (src[2] & 0xF0) | + (src[3] >> 4)); } template <> @@ -1137,7 +1135,7 @@ pack(src[1] * scaleFactor); uint8_t srcB = static_cast(src[2] * scaleFactor); *dst = uint16_t(((srcR & 0xF0) << 8) | ((srcG & 0xF0) << 4) | (srcB & 0xF0) | - (src[3] >> 4)); + (src[3] >> 4)); } // FIXME: this routine is lossy and must be removed. @@ -1151,7 +1149,7 @@ pack(src[1] * scaleFactor); uint8_t srcB = static_cast(src[2] * scaleFactor); *dst = uint16_t(((srcR & 0xF0) << 8) | ((srcG & 0xF0) << 4) | (srcB & 0xF0) | - (src[3] >> 4)); + (src[3] >> 4)); } template <> @@ -1159,7 +1157,7 @@ MOZ_ALWAYS_INLINE void pack(const uint8_t* __restrict src, uint16_t* __restrict dst) { *dst = uint16_t(((src[0] & 0xF8) << 8) | ((src[1] & 0xF8) << 3) | - ((src[2] & 0xF8) >> 2) | (src[3] >> 7)); + ((src[2] & 0xF8) >> 2) | (src[3] >> 7)); } template <> @@ -1171,8 +1169,8 @@ pack(src[0] * scaleFactor); uint8_t srcG = static_cast(src[1] * scaleFactor); uint8_t srcB = static_cast(src[2] * scaleFactor); - *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) | - ((srcB & 0xF8) >> 2) | (src[3] >> 7)); + *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) | ((srcB & 0xF8) >> 2) | + (src[3] >> 7)); } // FIXME: this routine is lossy and must be removed. @@ -1185,8 +1183,8 @@ pack(src[0] * scaleFactor); uint8_t srcG = static_cast(src[1] * scaleFactor); uint8_t srcB = static_cast(src[2] * scaleFactor); - *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) | - ((srcB & 0xF8) >> 2) | (src[3] >> 7)); + *dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) | ((srcB & 0xF8) >> 2) | + (src[3] >> 7)); } template <> diff --git a/dom/canvas/WebGLTexture.h b/dom/canvas/WebGLTexture.h index 030cc5e83cfd..e96909a75627 100644 --- a/dom/canvas/WebGLTexture.h +++ b/dom/canvas/WebGLTexture.h @@ -270,8 +270,7 @@ class WebGLTexture final : public nsWrapperCache, case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z: case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - return AutoAssertCast(rawTexImageTarget - - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X); + return AutoAssertCast(rawTexImageTarget - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X); default: return 0; diff --git a/dom/canvas/WebGLTypes.h b/dom/canvas/WebGLTypes.h index c1102873e2f6..e3472aa905a9 100644 --- a/dom/canvas/WebGLTypes.h +++ b/dom/canvas/WebGLTypes.h @@ -60,14 +60,14 @@ inline void* calloc(const ForbidNarrowing n, namespace detail { -template +template class AutoAssertCastT final { const From mVal; - public: - explicit AutoAssertCastT(const From val) : mVal(val) {} +public: + explicit AutoAssertCastT(const From val) : mVal(val) { } - template + template operator To() const { return AssertedCast(mVal); } @@ -75,7 +75,7 @@ class AutoAssertCastT final { } // namespace detail -template +template inline auto AutoAssertCast(const From val) { return detail::AutoAssertCastT(val); } diff --git a/dom/canvas/gtest/TestImageBitmapColorUtils.cpp b/dom/canvas/gtest/TestImageBitmapColorUtils.cpp index 1f33f3a2d57e..2aa69ef11629 100644 --- a/dom/canvas/gtest/TestImageBitmapColorUtils.cpp +++ b/dom/canvas/gtest/TestImageBitmapColorUtils.cpp @@ -720,8 +720,7 @@ class LabData : public SimpleImage { /* * From RGB24. */ -TEST(ImageBitmapColorUtils, RGB24ToBGR24_) -{ +TEST(ImageBitmapColorUtils, RGB24ToBGR24_) { const RGB24Data srcData; const BGR24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -746,8 +745,7 @@ TEST(ImageBitmapColorUtils, RGB24ToBGR24_) } } -TEST(ImageBitmapColorUtils, RGB24ToRGBA32) -{ +TEST(ImageBitmapColorUtils, RGB24ToRGBA32) { const RGB24Data srcData; const RGBA32Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -775,8 +773,7 @@ TEST(ImageBitmapColorUtils, RGB24ToRGBA32) } } -TEST(ImageBitmapColorUtils, RGB24ToBGRA32) -{ +TEST(ImageBitmapColorUtils, RGB24ToBGRA32) { const RGB24Data srcData; const BGRA32Data dstData; @@ -848,8 +845,7 @@ TEST(ImageBitmapColorUtils, RGB24ToBGRA32) // gbaPixel[0], rgbaPixel[1], rgbaPixel[2], rgbaPixel[3]); //} -TEST(ImageBitmapColorUtils, RGB24ToYUV444P) -{ +TEST(ImageBitmapColorUtils, RGB24ToYUV444P) { const RGB24Data srcData; const YUV444PData dstData; @@ -876,8 +872,7 @@ TEST(ImageBitmapColorUtils, RGB24ToYUV444P) } } -TEST(ImageBitmapColorUtils, RGB24ToYUV422P) -{ +TEST(ImageBitmapColorUtils, RGB24ToYUV422P) { const RGB24Data srcData; const YUV422PData dstData; @@ -909,8 +904,7 @@ TEST(ImageBitmapColorUtils, RGB24ToYUV422P) } } -TEST(ImageBitmapColorUtils, RGB24ToYUV420P) -{ +TEST(ImageBitmapColorUtils, RGB24ToYUV420P) { const RGB24Data srcData; const YUV420PData dstData; @@ -943,8 +937,7 @@ TEST(ImageBitmapColorUtils, RGB24ToYUV420P) } } -TEST(ImageBitmapColorUtils, RGB24ToNV12) -{ +TEST(ImageBitmapColorUtils, RGB24ToNV12) { const RGB24Data srcData; const NV12Data dstData; @@ -975,8 +968,7 @@ TEST(ImageBitmapColorUtils, RGB24ToNV12) } } -TEST(ImageBitmapColorUtils, RGB24ToNV21) -{ +TEST(ImageBitmapColorUtils, RGB24ToNV21) { const RGB24Data srcData; const NV21Data dstData; @@ -1007,8 +999,7 @@ TEST(ImageBitmapColorUtils, RGB24ToNV21) } } -TEST(ImageBitmapColorUtils, RGB24ToHSV) -{ +TEST(ImageBitmapColorUtils, RGB24ToHSV) { const RGB24Data srcData; const HSVData dstData; @@ -1031,8 +1022,7 @@ TEST(ImageBitmapColorUtils, RGB24ToHSV) } } -TEST(ImageBitmapColorUtils, RGB24ToLab) -{ +TEST(ImageBitmapColorUtils, RGB24ToLab) { const RGB24Data srcData; const LabData dstData; @@ -1055,8 +1045,7 @@ TEST(ImageBitmapColorUtils, RGB24ToLab) } } -TEST(ImageBitmapColorUtils, RGB24ToGray8) -{ +TEST(ImageBitmapColorUtils, RGB24ToGray8) { const RGB24Data srcData; const GrayData dstData; @@ -1079,8 +1068,7 @@ TEST(ImageBitmapColorUtils, RGB24ToGray8) * From BGR24. */ -TEST(ImageBitmapColorUtils, BGR24ToRGB24_) -{ +TEST(ImageBitmapColorUtils, BGR24ToRGB24_) { const BGR24Data srcData; const RGB24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -1105,8 +1093,7 @@ TEST(ImageBitmapColorUtils, BGR24ToRGB24_) } } -TEST(ImageBitmapColorUtils, BGR24ToRGBA32) -{ +TEST(ImageBitmapColorUtils, BGR24ToRGBA32) { const BGR24Data srcData; const RGBA32Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -1134,8 +1121,7 @@ TEST(ImageBitmapColorUtils, BGR24ToRGBA32) } } -TEST(ImageBitmapColorUtils, BGR24ToBGRA32) -{ +TEST(ImageBitmapColorUtils, BGR24ToBGRA32) { const BGR24Data srcData; const BGRA32Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -1163,8 +1149,7 @@ TEST(ImageBitmapColorUtils, BGR24ToBGRA32) } } -TEST(ImageBitmapColorUtils, BGR24ToYUV444P) -{ +TEST(ImageBitmapColorUtils, BGR24ToYUV444P) { const BGR24Data srcData; const YUV444PData dstData; @@ -1191,8 +1176,7 @@ TEST(ImageBitmapColorUtils, BGR24ToYUV444P) } } -TEST(ImageBitmapColorUtils, BGR24ToYUV422P) -{ +TEST(ImageBitmapColorUtils, BGR24ToYUV422P) { const BGR24Data srcData; const YUV422PData dstData; @@ -1224,8 +1208,7 @@ TEST(ImageBitmapColorUtils, BGR24ToYUV422P) } } -TEST(ImageBitmapColorUtils, BGR24ToYUV420P) -{ +TEST(ImageBitmapColorUtils, BGR24ToYUV420P) { const BGR24Data srcData; const YUV420PData dstData; @@ -1258,8 +1241,7 @@ TEST(ImageBitmapColorUtils, BGR24ToYUV420P) } } -TEST(ImageBitmapColorUtils, BGR24ToNV12) -{ +TEST(ImageBitmapColorUtils, BGR24ToNV12) { const BGR24Data srcData; const NV12Data dstData; @@ -1290,8 +1272,7 @@ TEST(ImageBitmapColorUtils, BGR24ToNV12) } } -TEST(ImageBitmapColorUtils, BGR24ToNV21) -{ +TEST(ImageBitmapColorUtils, BGR24ToNV21) { const BGR24Data srcData; const NV21Data dstData; @@ -1322,8 +1303,7 @@ TEST(ImageBitmapColorUtils, BGR24ToNV21) } } -TEST(ImageBitmapColorUtils, BGR24ToHSV) -{ +TEST(ImageBitmapColorUtils, BGR24ToHSV) { const BGR24Data srcData; const HSVData dstData; @@ -1346,8 +1326,7 @@ TEST(ImageBitmapColorUtils, BGR24ToHSV) } } -TEST(ImageBitmapColorUtils, BGR24ToLab) -{ +TEST(ImageBitmapColorUtils, BGR24ToLab) { const BGR24Data srcData; const LabData dstData; @@ -1370,8 +1349,7 @@ TEST(ImageBitmapColorUtils, BGR24ToLab) } } -TEST(ImageBitmapColorUtils, BGR24ToGray8) -{ +TEST(ImageBitmapColorUtils, BGR24ToGray8) { const BGR24Data srcData; const GrayData dstData; @@ -1393,8 +1371,7 @@ TEST(ImageBitmapColorUtils, BGR24ToGray8) /* * From RGBA32. */ -TEST(ImageBitmapColorUtils, RGBA32ToRGB24) -{ +TEST(ImageBitmapColorUtils, RGBA32ToRGB24) { const RGBA32Data srcData; const RGB24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -1419,8 +1396,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToRGB24) } } -TEST(ImageBitmapColorUtils, RGBA32ToBGR24) -{ +TEST(ImageBitmapColorUtils, RGBA32ToBGR24) { const RGBA32Data srcData; const BGR24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -1445,8 +1421,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToBGR24) } } -TEST(ImageBitmapColorUtils, RGBA32ToYUV444P) -{ +TEST(ImageBitmapColorUtils, RGBA32ToYUV444P) { const RGBA32Data srcData; const YUV444PData dstData; @@ -1473,8 +1448,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToYUV444P) } } -TEST(ImageBitmapColorUtils, RGBA32ToYUV422P) -{ +TEST(ImageBitmapColorUtils, RGBA32ToYUV422P) { const RGBA32Data srcData; const YUV422PData dstData; @@ -1506,8 +1480,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToYUV422P) } } -TEST(ImageBitmapColorUtils, RGBA32ToYUV420P) -{ +TEST(ImageBitmapColorUtils, RGBA32ToYUV420P) { const RGBA32Data srcData; const YUV420PData dstData; @@ -1540,8 +1513,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToYUV420P) } } -TEST(ImageBitmapColorUtils, RGBA32ToNV12) -{ +TEST(ImageBitmapColorUtils, RGBA32ToNV12) { const RGBA32Data srcData; const NV12Data dstData; @@ -1572,8 +1544,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToNV12) } } -TEST(ImageBitmapColorUtils, RGBA32ToNV21) -{ +TEST(ImageBitmapColorUtils, RGBA32ToNV21) { const RGBA32Data srcData; const NV21Data dstData; @@ -1604,8 +1575,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToNV21) } } -TEST(ImageBitmapColorUtils, RGBA32ToHSV) -{ +TEST(ImageBitmapColorUtils, RGBA32ToHSV) { const RGBA32Data srcData; const HSVData dstData; @@ -1628,8 +1598,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToHSV) } } -TEST(ImageBitmapColorUtils, RGBA32ToLab) -{ +TEST(ImageBitmapColorUtils, RGBA32ToLab) { const RGBA32Data srcData; const LabData dstData; @@ -1652,8 +1621,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToLab) } } -TEST(ImageBitmapColorUtils, RGBA32ToGray8) -{ +TEST(ImageBitmapColorUtils, RGBA32ToGray8) { const RGBA32Data srcData; const GrayData dstData; @@ -1675,8 +1643,7 @@ TEST(ImageBitmapColorUtils, RGBA32ToGray8) /* * From BGRA32. */ -TEST(ImageBitmapColorUtils, BGRA32ToRGB24) -{ +TEST(ImageBitmapColorUtils, BGRA32ToRGB24) { const BGRA32Data srcData; const RGB24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -1701,8 +1668,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToRGB24) } } -TEST(ImageBitmapColorUtils, BGRA32ToBGR24) -{ +TEST(ImageBitmapColorUtils, BGRA32ToBGR24) { const BGRA32Data srcData; const BGR24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -1727,8 +1693,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToBGR24) } } -TEST(ImageBitmapColorUtils, BGRA32ToYUV444P) -{ +TEST(ImageBitmapColorUtils, BGRA32ToYUV444P) { const BGRA32Data srcData; const YUV444PData dstData; @@ -1755,8 +1720,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToYUV444P) } } -TEST(ImageBitmapColorUtils, BGRA32ToYUV422P) -{ +TEST(ImageBitmapColorUtils, BGRA32ToYUV422P) { const BGRA32Data srcData; const YUV422PData dstData; @@ -1788,8 +1752,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToYUV422P) } } -TEST(ImageBitmapColorUtils, BGRA32ToYUV420P) -{ +TEST(ImageBitmapColorUtils, BGRA32ToYUV420P) { const BGRA32Data srcData; const YUV420PData dstData; @@ -1822,8 +1785,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToYUV420P) } } -TEST(ImageBitmapColorUtils, BGRA32ToNV12) -{ +TEST(ImageBitmapColorUtils, BGRA32ToNV12) { const BGRA32Data srcData; const NV12Data dstData; @@ -1854,8 +1816,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToNV12) } } -TEST(ImageBitmapColorUtils, BGRA32ToNV21) -{ +TEST(ImageBitmapColorUtils, BGRA32ToNV21) { const BGRA32Data srcData; const NV21Data dstData; @@ -1886,8 +1847,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToNV21) } } -TEST(ImageBitmapColorUtils, BGRA32ToHSV) -{ +TEST(ImageBitmapColorUtils, BGRA32ToHSV) { const BGRA32Data srcData; const HSVData dstData; @@ -1910,8 +1870,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToHSV) } } -TEST(ImageBitmapColorUtils, BGRA32ToLab) -{ +TEST(ImageBitmapColorUtils, BGRA32ToLab) { const BGRA32Data srcData; const LabData dstData; @@ -1934,8 +1893,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToLab) } } -TEST(ImageBitmapColorUtils, BGRA32ToGray8) -{ +TEST(ImageBitmapColorUtils, BGRA32ToGray8) { const BGRA32Data srcData; const GrayData dstData; @@ -1957,8 +1915,7 @@ TEST(ImageBitmapColorUtils, BGRA32ToGray8) /* * From YUV444P. */ -TEST(ImageBitmapColorUtils, YUV444PToRGB24) -{ +TEST(ImageBitmapColorUtils, YUV444PToRGB24) { const YUV444PData srcData; const RGBA32DataFromYUV444PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -1984,8 +1941,7 @@ TEST(ImageBitmapColorUtils, YUV444PToRGB24) } } -TEST(ImageBitmapColorUtils, YUV444PToBGR24) -{ +TEST(ImageBitmapColorUtils, YUV444PToBGR24) { const YUV444PData srcData; const RGBA32DataFromYUV444PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2011,8 +1967,7 @@ TEST(ImageBitmapColorUtils, YUV444PToBGR24) } } -TEST(ImageBitmapColorUtils, YUV444PToRGBA32) -{ +TEST(ImageBitmapColorUtils, YUV444PToRGBA32) { const YUV444PData srcData; const RGBA32DataFromYUV444PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2042,8 +1997,7 @@ TEST(ImageBitmapColorUtils, YUV444PToRGBA32) } } -TEST(ImageBitmapColorUtils, YUV444PToBGRA32) -{ +TEST(ImageBitmapColorUtils, YUV444PToBGRA32) { const YUV444PData srcData; const RGBA32DataFromYUV444PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2073,8 +2027,7 @@ TEST(ImageBitmapColorUtils, YUV444PToBGRA32) } } -TEST(ImageBitmapColorUtils, YUV444PToGray8) -{ +TEST(ImageBitmapColorUtils, YUV444PToGray8) { const YUV444PData srcData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 1); @@ -2096,8 +2049,7 @@ TEST(ImageBitmapColorUtils, YUV444PToGray8) /* * From YUV422P. */ -TEST(ImageBitmapColorUtils, YUV422PToRGB24) -{ +TEST(ImageBitmapColorUtils, YUV422PToRGB24) { const YUV422PData srcData; const RGBA32DataFromYUV422PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2123,8 +2075,7 @@ TEST(ImageBitmapColorUtils, YUV422PToRGB24) } } -TEST(ImageBitmapColorUtils, YUV422PToBGR24) -{ +TEST(ImageBitmapColorUtils, YUV422PToBGR24) { const YUV422PData srcData; const RGBA32DataFromYUV422PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2150,8 +2101,7 @@ TEST(ImageBitmapColorUtils, YUV422PToBGR24) } } -TEST(ImageBitmapColorUtils, YUV422PToRGBA32) -{ +TEST(ImageBitmapColorUtils, YUV422PToRGBA32) { const YUV422PData srcData; const RGBA32DataFromYUV422PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2181,8 +2131,7 @@ TEST(ImageBitmapColorUtils, YUV422PToRGBA32) } } -TEST(ImageBitmapColorUtils, YUV422PToBGRA32) -{ +TEST(ImageBitmapColorUtils, YUV422PToBGRA32) { const YUV422PData srcData; const RGBA32DataFromYUV422PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2212,8 +2161,7 @@ TEST(ImageBitmapColorUtils, YUV422PToBGRA32) } } -TEST(ImageBitmapColorUtils, YUV422PToGray8) -{ +TEST(ImageBitmapColorUtils, YUV422PToGray8) { const YUV422PData srcData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 1); @@ -2235,8 +2183,7 @@ TEST(ImageBitmapColorUtils, YUV422PToGray8) /* * From YUV420P. */ -TEST(ImageBitmapColorUtils, YUV420PToRGB24) -{ +TEST(ImageBitmapColorUtils, YUV420PToRGB24) { const YUV420PData srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2262,8 +2209,7 @@ TEST(ImageBitmapColorUtils, YUV420PToRGB24) } } -TEST(ImageBitmapColorUtils, YUV420PToBGR24) -{ +TEST(ImageBitmapColorUtils, YUV420PToBGR24) { const YUV420PData srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2289,8 +2235,7 @@ TEST(ImageBitmapColorUtils, YUV420PToBGR24) } } -TEST(ImageBitmapColorUtils, YUV420PToRGBA32) -{ +TEST(ImageBitmapColorUtils, YUV420PToRGBA32) { const YUV420PData srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2320,8 +2265,7 @@ TEST(ImageBitmapColorUtils, YUV420PToRGBA32) } } -TEST(ImageBitmapColorUtils, YUV420PToBGRA32) -{ +TEST(ImageBitmapColorUtils, YUV420PToBGRA32) { const YUV420PData srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2351,8 +2295,7 @@ TEST(ImageBitmapColorUtils, YUV420PToBGRA32) } } -TEST(ImageBitmapColorUtils, YUV420PToGray8) -{ +TEST(ImageBitmapColorUtils, YUV420PToGray8) { const YUV420PData srcData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 1); @@ -2374,8 +2317,7 @@ TEST(ImageBitmapColorUtils, YUV420PToGray8) /* * From NV12. */ -TEST(ImageBitmapColorUtils, NV12ToRGB24) -{ +TEST(ImageBitmapColorUtils, NV12ToRGB24) { const NV12Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2400,8 +2342,7 @@ TEST(ImageBitmapColorUtils, NV12ToRGB24) } } -TEST(ImageBitmapColorUtils, NV12ToBGR24) -{ +TEST(ImageBitmapColorUtils, NV12ToBGR24) { const NV12Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2426,8 +2367,7 @@ TEST(ImageBitmapColorUtils, NV12ToBGR24) } } -TEST(ImageBitmapColorUtils, NV12ToRGBA32) -{ +TEST(ImageBitmapColorUtils, NV12ToRGBA32) { const NV12Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2456,8 +2396,7 @@ TEST(ImageBitmapColorUtils, NV12ToRGBA32) } } -TEST(ImageBitmapColorUtils, NV12ToBGRA32) -{ +TEST(ImageBitmapColorUtils, NV12ToBGRA32) { const NV12Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2486,8 +2425,7 @@ TEST(ImageBitmapColorUtils, NV12ToBGRA32) } } -TEST(ImageBitmapColorUtils, NV12ToGray8) -{ +TEST(ImageBitmapColorUtils, NV12ToGray8) { const NV12Data srcData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 1); @@ -2508,8 +2446,7 @@ TEST(ImageBitmapColorUtils, NV12ToGray8) /* * From NV21. */ -TEST(ImageBitmapColorUtils, NV21ToRGB24) -{ +TEST(ImageBitmapColorUtils, NV21ToRGB24) { const NV21Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2534,8 +2471,7 @@ TEST(ImageBitmapColorUtils, NV21ToRGB24) } } -TEST(ImageBitmapColorUtils, NV21ToBGR24) -{ +TEST(ImageBitmapColorUtils, NV21ToBGR24) { const NV21Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 3); @@ -2560,8 +2496,7 @@ TEST(ImageBitmapColorUtils, NV21ToBGR24) } } -TEST(ImageBitmapColorUtils, NV21ToRGBA32) -{ +TEST(ImageBitmapColorUtils, NV21ToRGBA32) { const NV21Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2590,8 +2525,7 @@ TEST(ImageBitmapColorUtils, NV21ToRGBA32) } } -TEST(ImageBitmapColorUtils, NV21ToBGRA32) -{ +TEST(ImageBitmapColorUtils, NV21ToBGRA32) { const NV21Data srcData; const RGBA32DataFromYUV420PData dstData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, @@ -2620,8 +2554,7 @@ TEST(ImageBitmapColorUtils, NV21ToBGRA32) } } -TEST(ImageBitmapColorUtils, NV21ToGray8) -{ +TEST(ImageBitmapColorUtils, NV21ToGray8) { const NV21Data srcData; SimpleImage result_(srcData.mYWidth, srcData.mYHeight, 1); @@ -2642,8 +2575,7 @@ TEST(ImageBitmapColorUtils, NV21ToGray8) /* * From HSV. */ -TEST(ImageBitmapColorUtils, HSVToRGB24) -{ +TEST(ImageBitmapColorUtils, HSVToRGB24) { const HSVData srcData; const RGB24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -2664,8 +2596,7 @@ TEST(ImageBitmapColorUtils, HSVToRGB24) } } -TEST(ImageBitmapColorUtils, HSVToBGR24) -{ +TEST(ImageBitmapColorUtils, HSVToBGR24) { const HSVData srcData; const BGR24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -2686,8 +2617,7 @@ TEST(ImageBitmapColorUtils, HSVToBGR24) } } -TEST(ImageBitmapColorUtils, HSVToRGBA32) -{ +TEST(ImageBitmapColorUtils, HSVToRGBA32) { const HSVData srcData; const RGBA32Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -2708,8 +2638,7 @@ TEST(ImageBitmapColorUtils, HSVToRGBA32) } } -TEST(ImageBitmapColorUtils, HSVToBGRA32) -{ +TEST(ImageBitmapColorUtils, HSVToBGRA32) { const HSVData srcData; const BGRA32Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -2733,8 +2662,7 @@ TEST(ImageBitmapColorUtils, HSVToBGRA32) /* * From Lab. */ -TEST(ImageBitmapColorUtils, LabToRGB24) -{ +TEST(ImageBitmapColorUtils, LabToRGB24) { const LabData srcData; const RGB24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -2757,8 +2685,7 @@ TEST(ImageBitmapColorUtils, LabToRGB24) } } -TEST(ImageBitmapColorUtils, LabToBGR24) -{ +TEST(ImageBitmapColorUtils, LabToBGR24) { const LabData srcData; const BGR24Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -2781,8 +2708,7 @@ TEST(ImageBitmapColorUtils, LabToBGR24) } } -TEST(ImageBitmapColorUtils, LabToRGBA32) -{ +TEST(ImageBitmapColorUtils, LabToRGBA32) { const LabData srcData; const RGBA32Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, @@ -2805,8 +2731,7 @@ TEST(ImageBitmapColorUtils, LabToRGBA32) } } -TEST(ImageBitmapColorUtils, LabToBGRA32) -{ +TEST(ImageBitmapColorUtils, LabToBGRA32) { const LabData srcData; const BGRA32Data dstData; SimpleImage result_(srcData.mWidth, srcData.mHeight, diff --git a/dom/clients/api/Client.cpp b/dom/clients/api/Client.cpp index b18f2fd70832..81d8259749b1 100644 --- a/dom/clients/api/Client.cpp +++ b/dom/clients/api/Client.cpp @@ -150,20 +150,19 @@ already_AddRefed Client::Focus(ErrorResult& aRv) { MakeRefPtr>(mGlobal); mHandle->Focus() - ->Then( - mGlobal->EventTargetFor(TaskCategory::Other), __func__, - [ipcClientInfo, holder, outerPromise](const ClientState& aResult) { - holder->Complete(); - NS_ENSURE_TRUE_VOID(holder->GetParentObject()); - RefPtr newClient = - new Client(holder->GetParentObject(), - ClientInfoAndState(ipcClientInfo, aResult.ToIPC())); - outerPromise->MaybeResolve(newClient); - }, - [holder, outerPromise](nsresult aResult) { - holder->Complete(); - outerPromise->MaybeReject(aResult); - }) + ->Then(mGlobal->EventTargetFor(TaskCategory::Other), __func__, + [ipcClientInfo, holder, outerPromise](const ClientState& aResult) { + holder->Complete(); + NS_ENSURE_TRUE_VOID(holder->GetParentObject()); + RefPtr newClient = new Client( + holder->GetParentObject(), + ClientInfoAndState(ipcClientInfo, aResult.ToIPC())); + outerPromise->MaybeResolve(newClient); + }, + [holder, outerPromise](nsresult aResult) { + holder->Complete(); + outerPromise->MaybeReject(aResult); + }) ->Track(*holder); return outerPromise.forget(); diff --git a/dom/clients/api/ClientDOMUtil.h b/dom/clients/api/ClientDOMUtil.h index ef7831881d91..9fa9922d966a 100644 --- a/dom/clients/api/ClientDOMUtil.h +++ b/dom/clients/api/ClientDOMUtil.h @@ -32,16 +32,15 @@ void StartClientManagerOp(Func aFunc, const Arg& aArg, nsIGlobalObject* aGlobal, MakeRefPtr>(aGlobal); aFunc(aArg, target) - ->Then( - target, __func__, - [aResolve, holder](const ClientOpResult& aResult) { - holder->Complete(); - aResolve(aResult); - }, - [aReject, holder](nsresult aResult) { - holder->Complete(); - aReject(aResult); - }) + ->Then(target, __func__, + [aResolve, holder](const ClientOpResult& aResult) { + holder->Complete(); + aResolve(aResult); + }, + [aReject, holder](nsresult aResult) { + holder->Complete(); + aReject(aResult); + }) ->Track(*holder); } diff --git a/dom/clients/api/Clients.cpp b/dom/clients/api/Clients.cpp index bca98f833ebd..eab633be154c 100644 --- a/dom/clients/api/Clients.cpp +++ b/dom/clients/api/Clients.cpp @@ -80,31 +80,30 @@ already_AddRefed Clients::Get(const nsAString& aClientID, MakeRefPtr>(mGlobal); innerPromise - ->Then( - target, __func__, - [outerPromise, holder, scope](const ClientOpResult& aResult) { - holder->Complete(); - NS_ENSURE_TRUE_VOID(holder->GetParentObject()); - RefPtr client = new Client( - holder->GetParentObject(), aResult.get_ClientInfoAndState()); - if (client->GetStorageAccess() == - nsContentUtils::StorageAccess::eAllow) { - outerPromise->MaybeResolve(std::move(client)); - return; - } - nsCOMPtr r = NS_NewRunnableFunction( - "Clients::Get() storage denied", [scope] { - ServiceWorkerManager::LocalizeAndReportToAllClients( - scope, "ServiceWorkerGetClientStorageError", - nsTArray()); - }); - SystemGroup::Dispatch(TaskCategory::Other, r.forget()); - outerPromise->MaybeResolveWithUndefined(); - }, - [outerPromise, holder](nsresult aResult) { - holder->Complete(); - outerPromise->MaybeResolveWithUndefined(); - }) + ->Then(target, __func__, + [outerPromise, holder, scope](const ClientOpResult& aResult) { + holder->Complete(); + NS_ENSURE_TRUE_VOID(holder->GetParentObject()); + RefPtr client = new Client( + holder->GetParentObject(), aResult.get_ClientInfoAndState()); + if (client->GetStorageAccess() == + nsContentUtils::StorageAccess::eAllow) { + outerPromise->MaybeResolve(std::move(client)); + return; + } + nsCOMPtr r = NS_NewRunnableFunction( + "Clients::Get() storage denied", [scope] { + ServiceWorkerManager::LocalizeAndReportToAllClients( + scope, "ServiceWorkerGetClientStorageError", + nsTArray()); + }); + SystemGroup::Dispatch(TaskCategory::Other, r.forget()); + outerPromise->MaybeResolveWithUndefined(); + }, + [outerPromise, holder](nsresult aResult) { + holder->Complete(); + outerPromise->MaybeResolveWithUndefined(); + }) ->Track(*holder); return outerPromise.forget(); diff --git a/dom/clients/manager/ClientHandle.cpp b/dom/clients/manager/ClientHandle.cpp index 897300ac0a5b..f194a65a2b90 100644 --- a/dom/clients/manager/ClientHandle.cpp +++ b/dom/clients/manager/ClientHandle.cpp @@ -110,14 +110,13 @@ RefPtr ClientHandle::Control( MOZ_RELEASE_ASSERT(ClientMatchPrincipalInfo(mClientInfo.PrincipalInfo(), aServiceWorker.PrincipalInfo())); - StartOp( - ClientControlledArgs(aServiceWorker.ToIPC()), - [outerPromise](const ClientOpResult& aResult) { - outerPromise->Resolve(true, __func__); - }, - [outerPromise](const ClientOpResult& aResult) { - outerPromise->Reject(aResult.get_nsresult(), __func__); - }); + StartOp(ClientControlledArgs(aServiceWorker.ToIPC()), + [outerPromise](const ClientOpResult& aResult) { + outerPromise->Resolve(true, __func__); + }, + [outerPromise](const ClientOpResult& aResult) { + outerPromise->Reject(aResult.get_nsresult(), __func__); + }); return outerPromise.forget(); } @@ -126,15 +125,14 @@ RefPtr ClientHandle::Focus() { RefPtr outerPromise = new ClientStatePromise::Private(__func__); - StartOp( - ClientFocusArgs(), - [outerPromise](const ClientOpResult& aResult) { - outerPromise->Resolve( - ClientState::FromIPC(aResult.get_IPCClientState()), __func__); - }, - [outerPromise](const ClientOpResult& aResult) { - outerPromise->Reject(aResult.get_nsresult(), __func__); - }); + StartOp(ClientFocusArgs(), + [outerPromise](const ClientOpResult& aResult) { + outerPromise->Resolve( + ClientState::FromIPC(aResult.get_IPCClientState()), __func__); + }, + [outerPromise](const ClientOpResult& aResult) { + outerPromise->Reject(aResult.get_nsresult(), __func__); + }); return outerPromise.forget(); } @@ -158,14 +156,13 @@ RefPtr ClientHandle::PostMessage( RefPtr outerPromise = new GenericPromise::Private(__func__); - StartOp( - args, - [outerPromise](const ClientOpResult& aResult) { - outerPromise->Resolve(true, __func__); - }, - [outerPromise](const ClientOpResult& aResult) { - outerPromise->Reject(aResult.get_nsresult(), __func__); - }); + StartOp(args, + [outerPromise](const ClientOpResult& aResult) { + outerPromise->Resolve(true, __func__); + }, + [outerPromise](const ClientOpResult& aResult) { + outerPromise->Reject(aResult.get_nsresult(), __func__); + }); return outerPromise.forget(); } diff --git a/dom/clients/manager/ClientHandleOpParent.cpp b/dom/clients/manager/ClientHandleOpParent.cpp index 0d495989f2ce..c0542b7b2eb7 100644 --- a/dom/clients/manager/ClientHandleOpParent.cpp +++ b/dom/clients/manager/ClientHandleOpParent.cpp @@ -62,16 +62,15 @@ void ClientHandleOpParent::Init(const ClientOpConstructorArgs& aArgs) { // Capturing 'this' is safe here because we disconnect the promise in // ActorDestroy() which ensures neither lambda is called if the actor // is destroyed before the source operation completes. - p->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this](const ClientOpResult& aResult) { - mPromiseRequestHolder.Complete(); - Unused << PClientHandleOpParent::Send__delete__(this, aResult); - }, - [this](nsresult aRv) { - mPromiseRequestHolder.Complete(); - Unused << PClientHandleOpParent::Send__delete__(this, aRv); - }) + p->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this](const ClientOpResult& aResult) { + mPromiseRequestHolder.Complete(); + Unused << PClientHandleOpParent::Send__delete__(this, aResult); + }, + [this](nsresult aRv) { + mPromiseRequestHolder.Complete(); + Unused << PClientHandleOpParent::Send__delete__(this, aRv); + }) ->Track(mPromiseRequestHolder); } diff --git a/dom/clients/manager/ClientManagerOpParent.cpp b/dom/clients/manager/ClientManagerOpParent.cpp index 7d893648d8f8..856e3476b596 100644 --- a/dom/clients/manager/ClientManagerOpParent.cpp +++ b/dom/clients/manager/ClientManagerOpParent.cpp @@ -24,16 +24,15 @@ void ClientManagerOpParent::DoServiceOp(Method aMethod, Args&&... aArgs) { // Capturing `this` is safe here because we disconnect the promise in // ActorDestroy() which ensures neither lambda is called if the actor // is destroyed before the source operation completes. - p->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this](const mozilla::dom::ClientOpResult& aResult) { - mPromiseRequestHolder.Complete(); - Unused << PClientManagerOpParent::Send__delete__(this, aResult); - }, - [this](nsresult aRv) { - mPromiseRequestHolder.Complete(); - Unused << PClientManagerOpParent::Send__delete__(this, aRv); - }) + p->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this](const mozilla::dom::ClientOpResult& aResult) { + mPromiseRequestHolder.Complete(); + Unused << PClientManagerOpParent::Send__delete__(this, aResult); + }, + [this](nsresult aRv) { + mPromiseRequestHolder.Complete(); + Unused << PClientManagerOpParent::Send__delete__(this, aRv); + }) ->Track(mPromiseRequestHolder); } diff --git a/dom/clients/manager/ClientNavigateOpChild.cpp b/dom/clients/manager/ClientNavigateOpChild.cpp index 60b0ed39752d..1336ac78a414 100644 --- a/dom/clients/manager/ClientNavigateOpChild.cpp +++ b/dom/clients/manager/ClientNavigateOpChild.cpp @@ -287,16 +287,15 @@ void ClientNavigateOpChild::Init(const ClientNavigateOpConstructorArgs& aArgs) { // Capturing `this` is safe here since we clear the mPromiseRequestHolder in // ActorDestroy. promise - ->Then( - mSerialEventTarget, __func__, - [this](const ClientOpResult& aResult) { - mPromiseRequestHolder.Complete(); - PClientNavigateOpChild::Send__delete__(this, aResult); - }, - [this](nsresult aResult) { - mPromiseRequestHolder.Complete(); - PClientNavigateOpChild::Send__delete__(this, aResult); - }) + ->Then(mSerialEventTarget, __func__, + [this](const ClientOpResult& aResult) { + mPromiseRequestHolder.Complete(); + PClientNavigateOpChild::Send__delete__(this, aResult); + }, + [this](nsresult aResult) { + mPromiseRequestHolder.Complete(); + PClientNavigateOpChild::Send__delete__(this, aResult); + }) ->Track(mPromiseRequestHolder); } diff --git a/dom/clients/manager/ClientOpenWindowOpChild.cpp b/dom/clients/manager/ClientOpenWindowOpChild.cpp index c19fce3e7e64..1113659ea7e5 100644 --- a/dom/clients/manager/ClientOpenWindowOpChild.cpp +++ b/dom/clients/manager/ClientOpenWindowOpChild.cpp @@ -22,16 +22,15 @@ void ClientOpenWindowOpChild::ActorDestroy(ActorDestroyReason aReason) { void ClientOpenWindowOpChild::Init(const ClientOpenWindowArgs& aArgs) { DoOpenWindow(aArgs) - ->Then( - SystemGroup::EventTargetFor(TaskCategory::Other), __func__, - [this](const ClientOpResult& aResult) { - mPromiseRequestHolder.Complete(); - PClientOpenWindowOpChild::Send__delete__(this, aResult); - }, - [this](nsresult aResult) { - mPromiseRequestHolder.Complete(); - PClientOpenWindowOpChild::Send__delete__(this, aResult); - }) + ->Then(SystemGroup::EventTargetFor(TaskCategory::Other), __func__, + [this](const ClientOpResult& aResult) { + mPromiseRequestHolder.Complete(); + PClientOpenWindowOpChild::Send__delete__(this, aResult); + }, + [this](nsresult aResult) { + mPromiseRequestHolder.Complete(); + PClientOpenWindowOpChild::Send__delete__(this, aResult); + }) ->Track(mPromiseRequestHolder); } diff --git a/dom/clients/manager/ClientOpenWindowUtils.cpp b/dom/clients/manager/ClientOpenWindowUtils.cpp index 3d8c2727752b..e34e5f422022 100644 --- a/dom/clients/manager/ClientOpenWindowUtils.cpp +++ b/dom/clients/manager/ClientOpenWindowUtils.cpp @@ -302,10 +302,9 @@ void WaitForLoad(const ClientOpenWindowArgs& aArgs, } // Hold the listener alive until the promise settles - ref->Then( - aOuterWindow->EventTargetFor(TaskCategory::Other), __func__, - [listener](const ClientOpResult& aResult) {}, - [listener](nsresult aResult) {}); + ref->Then(aOuterWindow->EventTargetFor(TaskCategory::Other), __func__, + [listener](const ClientOpResult& aResult) {}, + [listener](nsresult aResult) {}); } #ifdef MOZ_WIDGET_ANDROID diff --git a/dom/clients/manager/ClientPrincipalUtils.cpp b/dom/clients/manager/ClientPrincipalUtils.cpp index 09f7ccea63f4..f8f43980043e 100644 --- a/dom/clients/manager/ClientPrincipalUtils.cpp +++ b/dom/clients/manager/ClientPrincipalUtils.cpp @@ -35,9 +35,7 @@ bool ClientMatchPrincipalInfo(const PrincipalInfo& aLeft, // null principal never matches return false; } - default: { - break; - } + default: { break; } } // Clients (windows/workers) should never have an expanded principal type. diff --git a/dom/clients/manager/ClientSource.cpp b/dom/clients/manager/ClientSource.cpp index 4df62090bae5..e6251abba6fe 100644 --- a/dom/clients/manager/ClientSource.cpp +++ b/dom/clients/manager/ClientSource.cpp @@ -603,16 +603,15 @@ RefPtr ClientSource::Claim(const ClientClaimArgs& aArgs) { auto holder = MakeRefPtr>(global); innerPromise - ->Then( - mEventTarget, __func__, - [outerPromise, holder](bool aResult) { - holder->Complete(); - outerPromise->Resolve(NS_OK, __func__); - }, - [outerPromise, holder](nsresult aResult) { - holder->Complete(); - outerPromise->Reject(aResult, __func__); - }) + ->Then(mEventTarget, __func__, + [outerPromise, holder](bool aResult) { + holder->Complete(); + outerPromise->Resolve(NS_OK, __func__); + }, + [outerPromise, holder](nsresult aResult) { + holder->Complete(); + outerPromise->Reject(aResult, __func__); + }) ->Track(*holder); return outerPromise.forget(); diff --git a/dom/clients/manager/ClientSourceOpChild.cpp b/dom/clients/manager/ClientSourceOpChild.cpp index 7547ec6a84a9..67df23743131 100644 --- a/dom/clients/manager/ClientSourceOpChild.cpp +++ b/dom/clients/manager/ClientSourceOpChild.cpp @@ -56,16 +56,15 @@ void ClientSourceOpChild::DoSourceOp(Method aMethod, const Args& aArgs) { // If the ClientSource is doing something async it may throw away the // promise on its side if the global is closed. promise - ->Then( - target, __func__, - [this, promise](const mozilla::dom::ClientOpResult& aResult) { - mPromiseRequestHolder.Complete(); - Unused << PClientSourceOpChild::Send__delete__(this, aResult); - }, - [this, promise](nsresult aRv) { - mPromiseRequestHolder.Complete(); - Unused << PClientSourceOpChild::Send__delete__(this, aRv); - }) + ->Then(target, __func__, + [this, promise](const mozilla::dom::ClientOpResult& aResult) { + mPromiseRequestHolder.Complete(); + Unused << PClientSourceOpChild::Send__delete__(this, aResult); + }, + [this, promise](nsresult aRv) { + mPromiseRequestHolder.Complete(); + Unused << PClientSourceOpChild::Send__delete__(this, aRv); + }) ->Track(mPromiseRequestHolder); } diff --git a/dom/clients/manager/ClientThing.h b/dom/clients/manager/ClientThing.h index 69c8e634144f..af16984df35b 100644 --- a/dom/clients/manager/ClientThing.h +++ b/dom/clients/manager/ClientThing.h @@ -68,8 +68,8 @@ class ClientThing { // Conditionally execute the given callable based on the current state. template - void MaybeExecute( - const Callable& aSuccess, const std::function& aFailure = [] {}) { + void MaybeExecute(const Callable& aSuccess, + const std::function& aFailure = [] {}) { AssertIsValid(); if (mShutdown) { aFailure(); diff --git a/dom/clients/manager/ClientValidation.cpp b/dom/clients/manager/ClientValidation.cpp index 1dcea78f08f4..07ba1d6789e1 100644 --- a/dom/clients/manager/ClientValidation.cpp +++ b/dom/clients/manager/ClientValidation.cpp @@ -58,9 +58,7 @@ bool ClientIsValidPrincipalInfo(const PrincipalInfo& aPrincipalInfo) { // cases in the future. return specOrigin == originOrigin; } - default: { - break; - } + default: { break; } } // Windows and workers should not have expanded URLs, etc. @@ -146,9 +144,7 @@ bool ClientIsValidCreationURL(const PrincipalInfo& aPrincipalInfo, // queries anyway. return true; } - default: { - break; - } + default: { break; } } // Clients (windows/workers) should never have an expanded principal type. diff --git a/dom/encoding/FallbackEncoding.cpp b/dom/encoding/FallbackEncoding.cpp index 6ecc12438395..50cddf74773f 100644 --- a/dom/encoding/FallbackEncoding.cpp +++ b/dom/encoding/FallbackEncoding.cpp @@ -29,12 +29,11 @@ static NotNull SearchEncodingProp( const EncodingProp (&aProperties)[N], const nsACString& aKey) { const nsCString& flat = PromiseFlatCString(aKey); size_t index; - if (!BinarySearchIf( - aProperties, 0, ArrayLength(aProperties), - [&flat](const EncodingProp& aProperty) { - return flat.Compare(aProperty.mKey); - }, - &index)) { + if (!BinarySearchIf(aProperties, 0, ArrayLength(aProperties), + [&flat](const EncodingProp& aProperty) { + return flat.Compare(aProperty.mKey); + }, + &index)) { return WINDOWS_1252_ENCODING; } return aProperties[index].mValue; diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index e433e953be3b..a71096bdbe86 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -1296,9 +1296,7 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent, remote->SendPluginEvent(*aEvent->AsPluginEvent()); return; } - default: { - MOZ_CRASH("Attempt to send non-whitelisted event?"); - } + default: { MOZ_CRASH("Attempt to send non-whitelisted event?"); } } } diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 2e6d570f37c8..76816df6cef0 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -6450,25 +6450,24 @@ bool HTMLMediaElement::TryRemoveMediaKeysAssociation() { if (mDecoder) { RefPtr self = this; mDecoder->SetCDMProxy(nullptr) - ->Then( - mAbstractMainThread, __func__, - [self]() { - self->mSetCDMRequest.Complete(); + ->Then(mAbstractMainThread, __func__, + [self]() { + self->mSetCDMRequest.Complete(); - self->RemoveMediaKeys(); - if (self->AttachNewMediaKeys()) { - // No incoming MediaKeys object or MediaDecoder is not - // created yet. - self->MakeAssociationWithCDMResolved(); - } - }, - [self](const MediaResult& aResult) { - self->mSetCDMRequest.Complete(); - // 5.2.4 If the preceding step failed, let this object's - // attaching media keys value be false and reject promise with - // a new DOMException whose name is the appropriate error name. - self->SetCDMProxyFailure(aResult); - }) + self->RemoveMediaKeys(); + if (self->AttachNewMediaKeys()) { + // No incoming MediaKeys object or MediaDecoder is not + // created yet. + self->MakeAssociationWithCDMResolved(); + } + }, + [self](const MediaResult& aResult) { + self->mSetCDMRequest.Complete(); + // 5.2.4 If the preceding step failed, let this object's + // attaching media keys value be false and reject promise with + // a new DOMException whose name is the appropriate error name. + self->SetCDMProxyFailure(aResult); + }) ->Track(mSetCDMRequest); return false; } @@ -6524,16 +6523,15 @@ bool HTMLMediaElement::TryMakeAssociationWithCDM(CDMProxy* aProxy) { // HTMLMediaElement should resolve or reject the DOM promise. RefPtr self = this; mDecoder->SetCDMProxy(aProxy) - ->Then( - mAbstractMainThread, __func__, - [self]() { - self->mSetCDMRequest.Complete(); - self->MakeAssociationWithCDMResolved(); - }, - [self](const MediaResult& aResult) { - self->mSetCDMRequest.Complete(); - self->SetCDMProxyFailure(aResult); - }) + ->Then(mAbstractMainThread, __func__, + [self]() { + self->mSetCDMRequest.Complete(); + self->MakeAssociationWithCDMResolved(); + }, + [self](const MediaResult& aResult) { + self->mSetCDMRequest.Complete(); + self->SetCDMProxyFailure(aResult); + }) ->Track(mSetCDMRequest); return false; } diff --git a/dom/indexedDB/ActorsChild.cpp b/dom/indexedDB/ActorsChild.cpp index 69e4347f8060..750484bdb792 100644 --- a/dom/indexedDB/ActorsChild.cpp +++ b/dom/indexedDB/ActorsChild.cpp @@ -1720,14 +1720,13 @@ mozilla::ipc::IPCResult BackgroundFactoryRequestChild::RecvPermissionChallenge( IPC::Principal ipcPrincipal(principal); tabChild->SendIndexedDBPermissionRequest(ipcPrincipal) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this](const uint32_t& aPermission) { - this->AssertIsOnOwningThread(); - MaybeCollectGarbageOnIPCMessage(); - this->SendPermissionRetry(); - }, - [](const mozilla::ipc::ResponseRejectReason) {}); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this](const uint32_t& aPermission) { + this->AssertIsOnOwningThread(); + MaybeCollectGarbageOnIPCMessage(); + this->SendPermissionRetry(); + }, + [](const mozilla::ipc::ResponseRejectReason) {}); return IPC_OK(); } diff --git a/dom/ipc/SharedStringMap.cpp b/dom/ipc/SharedStringMap.cpp index 6ebdc44ceaa7..59bdba0af31a 100644 --- a/dom/ipc/SharedStringMap.cpp +++ b/dom/ipc/SharedStringMap.cpp @@ -67,12 +67,11 @@ bool SharedStringMap::Get(const nsCString& aKey, nsAString& aValue) { bool SharedStringMap::Find(const nsCString& aKey, size_t* aIndex) { const auto& keys = KeyTable(); - return BinarySearchIf( - Entries(), 0, EntryCount(), - [&](const Entry& aEntry) { - return aKey.Compare(keys.GetBare(aEntry.mKey)); - }, - aIndex); + return BinarySearchIf(Entries(), 0, EntryCount(), + [&](const Entry& aEntry) { + return aKey.Compare(keys.GetBare(aEntry.mKey)); + }, + aIndex); } void SharedStringMapBuilder::Add(const nsCString& aKey, diff --git a/dom/ipc/TabContext.cpp b/dom/ipc/TabContext.cpp index dc29c591885d..6abe871721b3 100644 --- a/dom/ipc/TabContext.cpp +++ b/dom/ipc/TabContext.cpp @@ -219,9 +219,7 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams) break; } - default: { - MOZ_CRASH(); - } + default: { MOZ_CRASH(); } } bool rv; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index cb155b27c910..b537cd34ac53 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -158,8 +158,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabParent) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITabParent) NS_INTERFACE_MAP_END -NS_IMPL_CYCLE_COLLECTION(TabParent, mFrameElement, mBrowserDOMWindow, - mLoadContext, mFrameLoader, mBrowsingContext) +NS_IMPL_CYCLE_COLLECTION(TabParent, mFrameElement, mBrowserDOMWindow, mLoadContext, mFrameLoader, mBrowsingContext) NS_IMPL_CYCLE_COLLECTING_ADDREF(TabParent) NS_IMPL_CYCLE_COLLECTING_RELEASE(TabParent) @@ -3048,19 +3047,18 @@ TabParent::GetContentBlockingLog(Promise** aPromise) { copy.forget(aPromise); auto cblPromise = SendGetContentBlockingLog(); - cblPromise->Then( - GetMainThreadSerialEventTarget(), __func__, - [jsPromise](Tuple&& aResult) { - if (Get<1>(aResult)) { - NS_ConvertUTF8toUTF16 utf16(Get<0>(aResult)); - jsPromise->MaybeResolve(std::move(utf16)); - } else { - jsPromise->MaybeRejectWithUndefined(); - } - }, - [jsPromise](ResponseRejectReason&& aReason) { - jsPromise->MaybeRejectWithUndefined(); - }); + cblPromise->Then(GetMainThreadSerialEventTarget(), __func__, + [jsPromise](Tuple&& aResult) { + if (Get<1>(aResult)) { + NS_ConvertUTF8toUTF16 utf16(Get<0>(aResult)); + jsPromise->MaybeResolve(std::move(utf16)); + } else { + jsPromise->MaybeRejectWithUndefined(); + } + }, + [jsPromise](ResponseRejectReason&& aReason) { + jsPromise->MaybeRejectWithUndefined(); + }); return NS_OK; } @@ -3160,14 +3158,13 @@ void TabParent::RequestRootPaint(gfx::CrossProcessPaint* aPaint, IntRect aRect, RefPtr paint(aPaint); TabId tabId(GetTabId()); - promise->Then( - GetMainThreadSerialEventTarget(), __func__, - [paint, tabId](PaintFragment&& aFragment) { - paint->ReceiveFragment(tabId, std::move(aFragment)); - }, - [paint, tabId](ResponseRejectReason&& aReason) { - paint->LostFragment(tabId); - }); + promise->Then(GetMainThreadSerialEventTarget(), __func__, + [paint, tabId](PaintFragment&& aFragment) { + paint->ReceiveFragment(tabId, std::move(aFragment)); + }, + [paint, tabId](ResponseRejectReason&& aReason) { + paint->LostFragment(tabId); + }); } void TabParent::RequestSubPaint(gfx::CrossProcessPaint* aPaint, float aScale, @@ -3176,14 +3173,13 @@ void TabParent::RequestSubPaint(gfx::CrossProcessPaint* aPaint, float aScale, RefPtr paint(aPaint); TabId tabId(GetTabId()); - promise->Then( - GetMainThreadSerialEventTarget(), __func__, - [paint, tabId](PaintFragment&& aFragment) { - paint->ReceiveFragment(tabId, std::move(aFragment)); - }, - [paint, tabId](ResponseRejectReason&& aReason) { - paint->LostFragment(tabId); - }); + promise->Then(GetMainThreadSerialEventTarget(), __func__, + [paint, tabId](PaintFragment&& aFragment) { + paint->ReceiveFragment(tabId, std::move(aFragment)); + }, + [paint, tabId](ResponseRejectReason&& aReason) { + paint->LostFragment(tabId); + }); } mozilla::ipc::IPCResult TabParent::RecvPaintWhileInterruptingJSNoOp( diff --git a/dom/localstorage/test/gtest/TestLocalStorage.cpp b/dom/localstorage/test/gtest/TestLocalStorage.cpp index c4e6c4670b5a..b6f24ab9434a 100644 --- a/dom/localstorage/test/gtest/TestLocalStorage.cpp +++ b/dom/localstorage/test/gtest/TestLocalStorage.cpp @@ -69,25 +69,21 @@ void CheckGeneratedOriginKey(nsIPrincipal* aPrincipal, const char* aOriginKey) { } // namespace -TEST(LocalStorage, OriginKey) -{ +TEST(LocalStorage, OriginKey) { // Check the system principal. nsCOMPtr secMan = nsContentUtils::GetSecurityManager(); - ASSERT_TRUE(secMan) - << "GetSecurityManager() should not fail"; + ASSERT_TRUE(secMan) << "GetSecurityManager() should not fail"; nsCOMPtr principal; secMan->GetSystemPrincipal(getter_AddRefs(principal)); - ASSERT_TRUE(principal) - << "GetSystemPrincipal() should not fail"; + ASSERT_TRUE(principal) << "GetSystemPrincipal() should not fail"; CheckGeneratedOriginKey(principal, nullptr); // Check the null principal. principal = NullPrincipal::CreateWithoutOriginAttributes(); - ASSERT_TRUE(principal) - << "CreateWithoutOriginAttributes() should not fail"; + ASSERT_TRUE(principal) << "CreateWithoutOriginAttributes() should not fail"; CheckGeneratedOriginKey(principal, nullptr); @@ -110,8 +106,7 @@ TEST(LocalStorage, OriginKey) for (const auto& test : tests) { principal = GetCodebasePrincipal(test.mSpec); - ASSERT_TRUE(principal) - << "GetCodebasePrincipal() should not fail"; + ASSERT_TRUE(principal) << "GetCodebasePrincipal() should not fail"; CheckGeneratedOriginKey(principal, test.mOriginKey); } diff --git a/dom/media/Benchmark.cpp b/dom/media/Benchmark.cpp index 19f70b7585ec..aedb1aee2611 100644 --- a/dom/media/Benchmark.cpp +++ b/dom/media/Benchmark.cpp @@ -282,15 +282,15 @@ void BenchmarkPlayback::GlobalShutdown() { if (mDecoder) { RefPtr ref(mGlobalState); - mDecoder->Flush()->Then( - Thread(), __func__, - [ref, this]() { - mDecoder->Shutdown()->Then( - Thread(), __func__, [ref, this]() { FinalizeShutdown(); }, - []() { MOZ_CRASH("not reached"); }); - mDecoder = nullptr; - }, - []() { MOZ_CRASH("not reached"); }); + mDecoder->Flush()->Then(Thread(), __func__, + [ref, this]() { + mDecoder->Shutdown()->Then( + Thread(), __func__, + [ref, this]() { FinalizeShutdown(); }, + []() { MOZ_CRASH("not reached"); }); + mDecoder = nullptr; + }, + []() { MOZ_CRASH("not reached"); }); } else { FinalizeShutdown(); } @@ -345,36 +345,34 @@ void BenchmarkPlayback::InputExhausted() { mSampleIndex++; if (mSampleIndex == mSamples.Length() && !ref->mParameters.mStopAtFrame) { // Complete current frame decode then drain if still necessary. - p->Then( - Thread(), __func__, - [ref, this](MediaDataDecoder::DecodedData&& aResults) { - Output(std::move(aResults)); - if (!mFinished) { - mDecoder->Drain()->Then( - Thread(), __func__, - [ref, this](MediaDataDecoder::DecodedData&& aResults) { - mDrained = true; - Output(std::move(aResults)); - MOZ_ASSERT(mFinished, "We must be done now"); - }, - [ref, this](const MediaResult& aError) { Error(aError); }); - } - }, - [ref, this](const MediaResult& aError) { Error(aError); }); + p->Then(Thread(), __func__, + [ref, this](MediaDataDecoder::DecodedData&& aResults) { + Output(std::move(aResults)); + if (!mFinished) { + mDecoder->Drain()->Then( + Thread(), __func__, + [ref, this](MediaDataDecoder::DecodedData&& aResults) { + mDrained = true; + Output(std::move(aResults)); + MOZ_ASSERT(mFinished, "We must be done now"); + }, + [ref, this](const MediaResult& aError) { Error(aError); }); + } + }, + [ref, this](const MediaResult& aError) { Error(aError); }); } else { if (mSampleIndex == mSamples.Length() && ref->mParameters.mStopAtFrame) { mSampleIndex = 0; } // Continue decoding - p->Then( - Thread(), __func__, - [ref, this](MediaDataDecoder::DecodedData&& aResults) { - Output(std::move(aResults)); - if (!mFinished) { - InputExhausted(); - } - }, - [ref, this](const MediaResult& aError) { Error(aError); }); + p->Then(Thread(), __func__, + [ref, this](MediaDataDecoder::DecodedData&& aResults) { + Output(std::move(aResults)); + if (!mFinished) { + InputExhausted(); + } + }, + [ref, this](const MediaResult& aError) { Error(aError); }); } } diff --git a/dom/media/ChannelMediaDecoder.cpp b/dom/media/ChannelMediaDecoder.cpp index 99c57130f308..2358ac309956 100644 --- a/dom/media/ChannelMediaDecoder.cpp +++ b/dom/media/ChannelMediaDecoder.cpp @@ -387,20 +387,19 @@ void ChannelMediaDecoder::DownloadProgressed() { MediaStatistics stats = GetStatistics(rate, res, pos); return StatsPromise::CreateAndResolve(stats, __func__); }) - ->Then( - mAbstractMainThread, __func__, - [=, - self = RefPtr(this)](MediaStatistics aStats) { - if (IsShutdown()) { - return; - } - mCanPlayThrough = aStats.CanPlayThrough(); - GetStateMachine()->DispatchCanPlayThrough(mCanPlayThrough); - mResource->ThrottleReadahead(ShouldThrottleDownload(aStats)); - // Update readyState since mCanPlayThrough might have changed. - GetOwner()->UpdateReadyState(); - }, - []() { MOZ_ASSERT_UNREACHABLE("Promise not resolved"); }); + ->Then(mAbstractMainThread, __func__, + [=, self = RefPtr(this)]( + MediaStatistics aStats) { + if (IsShutdown()) { + return; + } + mCanPlayThrough = aStats.CanPlayThrough(); + GetStateMachine()->DispatchCanPlayThrough(mCanPlayThrough); + mResource->ThrottleReadahead(ShouldThrottleDownload(aStats)); + // Update readyState since mCanPlayThrough might have changed. + GetOwner()->UpdateReadyState(); + }, + []() { MOZ_ASSERT_UNREACHABLE("Promise not resolved"); }); } /* static */ ChannelMediaDecoder::PlaybackRateInfo diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 015b04d5d067..202ed09d5316 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -1055,12 +1055,11 @@ void DOMMediaStream::BlockPlaybackTrack(TrackPort* aTrack) { RefPtr that = this; aTrack ->BlockSourceTrackId(aTrack->GetTrack()->mTrackID, BlockingMode::CREATION) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this, that](bool aIgnore) { NotifyPlaybackTrackBlocked(); }, - [](const nsresult& aIgnore) { - NS_ERROR("Could not remove track from MSG"); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this, that](bool aIgnore) { NotifyPlaybackTrackBlocked(); }, + [](const nsresult& aIgnore) { + NS_ERROR("Could not remove track from MSG"); + }); } void DOMMediaStream::NotifyPlaybackTrackBlocked() { diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 89b009261879..eb0691f10753 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -316,12 +316,11 @@ class MediaDecoderStateMachine::DecodeMetadataState // a raw pointer here. Reader() ->ReadMetadata() - ->Then( - OwnerThread(), __func__, - [this](MetadataHolder&& aMetadata) { - OnMetadataRead(std::move(aMetadata)); - }, - [this](const MediaResult& aError) { OnMetadataNotRead(aError); }) + ->Then(OwnerThread(), __func__, + [this](MetadataHolder&& aMetadata) { + OnMetadataRead(std::move(aMetadata)); + }, + [this](const MediaResult& aError) { OnMetadataNotRead(aError); }) ->Track(mMetadataRequest); } @@ -711,13 +710,12 @@ class MediaDecoderStateMachine::DecodingState TimeStamp target = TimeStamp::Now() + TimeDuration::FromMilliseconds(timeout); - mDormantTimer.Ensure( - target, - [this]() { - mDormantTimer.CompleteRequest(); - SetState(); - }, - [this]() { mDormantTimer.CompleteRequest(); }); + mDormantTimer.Ensure(target, + [this]() { + mDormantTimer.CompleteRequest(); + SetState(); + }, + [this]() { mDormantTimer.CompleteRequest(); }); } // Time at which we started decoding. @@ -820,39 +818,38 @@ class MediaDecoderStateMachine::LoopingDecodingState Reader()->ResetDecode(TrackInfo::kAudioTrack); Reader() ->Seek(SeekTarget(media::TimeUnit::Zero(), SeekTarget::Accurate)) - ->Then( - OwnerThread(), __func__, - [this]() -> void { - mAudioSeekRequest.Complete(); - SLOG( - "seeking completed, start to request first sample, " - "queueing audio task - queued=%zu, decoder-queued=%zu", - AudioQueue().GetSize(), Reader()->SizeOfAudioQueueInFrames()); + ->Then(OwnerThread(), __func__, + [this]() -> void { + mAudioSeekRequest.Complete(); + SLOG( + "seeking completed, start to request first sample, " + "queueing audio task - queued=%zu, decoder-queued=%zu", + AudioQueue().GetSize(), + Reader()->SizeOfAudioQueueInFrames()); - Reader() - ->RequestAudioData() - ->Then( - OwnerThread(), __func__, - [this](RefPtr aAudio) { - mIsReachingAudioEOS = false; - mAudioDataRequest.Complete(); - SLOG( - "got audio decoded sample " - "[%" PRId64 ",%" PRId64 "]", - aAudio->mTime.ToMicroseconds(), - aAudio->GetEndTime().ToMicroseconds()); - HandleAudioDecoded(aAudio); - }, - [this](const MediaResult& aError) { - mAudioDataRequest.Complete(); - HandleError(aError); - }) - ->Track(mAudioDataRequest); - }, - [this](const SeekRejectValue& aReject) -> void { - mAudioSeekRequest.Complete(); - HandleError(aReject.mError); - }) + Reader() + ->RequestAudioData() + ->Then(OwnerThread(), __func__, + [this](RefPtr aAudio) { + mIsReachingAudioEOS = false; + mAudioDataRequest.Complete(); + SLOG( + "got audio decoded sample " + "[%" PRId64 ",%" PRId64 "]", + aAudio->mTime.ToMicroseconds(), + aAudio->GetEndTime().ToMicroseconds()); + HandleAudioDecoded(aAudio); + }, + [this](const MediaResult& aError) { + mAudioDataRequest.Complete(); + HandleError(aError); + }) + ->Track(mAudioDataRequest); + }, + [this](const SeekRejectValue& aReject) -> void { + mAudioSeekRequest.Complete(); + HandleError(aReject.mError); + }) ->Track(mAudioSeekRequest); } @@ -1236,18 +1233,17 @@ class MediaDecoderStateMachine::AccurateSeekingState Reader() ->WaitForData(aReject.mType) - ->Then( - OwnerThread(), __func__, - [this](MediaData::Type aType) { - SLOG("OnSeekRejected wait promise resolved"); - mWaitRequest.Complete(); - DemuxerSeek(); - }, - [this](const WaitForDataRejectValue& aRejection) { - SLOG("OnSeekRejected wait promise rejected"); - mWaitRequest.Complete(); - mMaster->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); - }) + ->Then(OwnerThread(), __func__, + [this](MediaData::Type aType) { + SLOG("OnSeekRejected wait promise resolved"); + mWaitRequest.Complete(); + DemuxerSeek(); + }, + [this](const WaitForDataRejectValue& aRejection) { + SLOG("OnSeekRejected wait promise rejected"); + mWaitRequest.Complete(); + mMaster->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); + }) ->Track(mWaitRequest); return; } @@ -2135,10 +2131,9 @@ void MediaDecoderStateMachine::StateObject::HandleResumeVideoDecoding( RefPtr mainThread = mMaster->mAbstractMainThread; SetSeekingState(std::move(seekJob), EventVisibility::Suppressed) - ->Then( - mainThread, __func__, - [start, info, hw]() { ReportRecoveryTelemetry(start, info, hw); }, - []() {}); + ->Then(mainThread, __func__, + [start, info, hw]() { ReportRecoveryTelemetry(start, info, hw); }, + []() {}); } RefPtr @@ -2973,9 +2968,9 @@ void MediaDecoderStateMachine::SetVideoDecodeModeInternal( TimeStamp target = TimeStamp::Now() + SuspendBackgroundVideoDelay(); RefPtr self = this; - mVideoDecodeSuspendTimer.Ensure( - target, [=]() { self->OnSuspendTimerResolved(); }, - []() { MOZ_DIAGNOSTIC_ASSERT(false); }); + mVideoDecodeSuspendTimer.Ensure(target, + [=]() { self->OnSuspendTimerResolved(); }, + []() { MOZ_DIAGNOSTIC_ASSERT(false); }); mOnPlaybackEvent.Notify(MediaPlaybackEvent::StartVideoSuspendTimer); return; } @@ -3069,37 +3064,36 @@ void MediaDecoderStateMachine::RequestAudioData() { RefPtr self = this; mReader->RequestAudioData() - ->Then( - OwnerThread(), __func__, - [this, self](RefPtr aAudio) { - MOZ_ASSERT(aAudio); - mAudioDataRequest.Complete(); - // audio->GetEndTime() is not always mono-increasing in chained - // ogg. - mDecodedAudioEndTime = - std::max(aAudio->GetEndTime(), mDecodedAudioEndTime); - LOGV("OnAudioDecoded [%" PRId64 ",%" PRId64 "]", - aAudio->mTime.ToMicroseconds(), - aAudio->GetEndTime().ToMicroseconds()); - mStateObj->HandleAudioDecoded(aAudio); - }, - [this, self](const MediaResult& aError) { - LOGV("OnAudioNotDecoded aError=%s", aError.ErrorName().get()); - mAudioDataRequest.Complete(); - switch (aError.Code()) { - case NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA: - mStateObj->HandleWaitingForAudio(); - break; - case NS_ERROR_DOM_MEDIA_CANCELED: - mStateObj->HandleAudioCanceled(); - break; - case NS_ERROR_DOM_MEDIA_END_OF_STREAM: - mStateObj->HandleEndOfAudio(); - break; - default: - DecodeError(aError); - } - }) + ->Then(OwnerThread(), __func__, + [this, self](RefPtr aAudio) { + MOZ_ASSERT(aAudio); + mAudioDataRequest.Complete(); + // audio->GetEndTime() is not always mono-increasing in chained + // ogg. + mDecodedAudioEndTime = + std::max(aAudio->GetEndTime(), mDecodedAudioEndTime); + LOGV("OnAudioDecoded [%" PRId64 ",%" PRId64 "]", + aAudio->mTime.ToMicroseconds(), + aAudio->GetEndTime().ToMicroseconds()); + mStateObj->HandleAudioDecoded(aAudio); + }, + [this, self](const MediaResult& aError) { + LOGV("OnAudioNotDecoded aError=%s", aError.ErrorName().get()); + mAudioDataRequest.Complete(); + switch (aError.Code()) { + case NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA: + mStateObj->HandleWaitingForAudio(); + break; + case NS_ERROR_DOM_MEDIA_CANCELED: + mStateObj->HandleAudioCanceled(); + break; + case NS_ERROR_DOM_MEDIA_END_OF_STREAM: + mStateObj->HandleEndOfAudio(); + break; + default: + DecodeError(aError); + } + }) ->Track(mAudioDataRequest); } @@ -3118,36 +3112,35 @@ void MediaDecoderStateMachine::RequestVideoData( TimeStamp videoDecodeStartTime = TimeStamp::Now(); RefPtr self = this; mReader->RequestVideoData(aCurrentTime) - ->Then( - OwnerThread(), __func__, - [this, self, videoDecodeStartTime](RefPtr aVideo) { - MOZ_ASSERT(aVideo); - mVideoDataRequest.Complete(); - // Handle abnormal or negative timestamps. - mDecodedVideoEndTime = - std::max(mDecodedVideoEndTime, aVideo->GetEndTime()); - LOGV("OnVideoDecoded [%" PRId64 ",%" PRId64 "]", - aVideo->mTime.ToMicroseconds(), - aVideo->GetEndTime().ToMicroseconds()); - mStateObj->HandleVideoDecoded(aVideo, videoDecodeStartTime); - }, - [this, self](const MediaResult& aError) { - LOGV("OnVideoNotDecoded aError=%s", aError.ErrorName().get()); - mVideoDataRequest.Complete(); - switch (aError.Code()) { - case NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA: - mStateObj->HandleWaitingForVideo(); - break; - case NS_ERROR_DOM_MEDIA_CANCELED: - mStateObj->HandleVideoCanceled(); - break; - case NS_ERROR_DOM_MEDIA_END_OF_STREAM: - mStateObj->HandleEndOfVideo(); - break; - default: - DecodeError(aError); - } - }) + ->Then(OwnerThread(), __func__, + [this, self, videoDecodeStartTime](RefPtr aVideo) { + MOZ_ASSERT(aVideo); + mVideoDataRequest.Complete(); + // Handle abnormal or negative timestamps. + mDecodedVideoEndTime = + std::max(mDecodedVideoEndTime, aVideo->GetEndTime()); + LOGV("OnVideoDecoded [%" PRId64 ",%" PRId64 "]", + aVideo->mTime.ToMicroseconds(), + aVideo->GetEndTime().ToMicroseconds()); + mStateObj->HandleVideoDecoded(aVideo, videoDecodeStartTime); + }, + [this, self](const MediaResult& aError) { + LOGV("OnVideoNotDecoded aError=%s", aError.ErrorName().get()); + mVideoDataRequest.Complete(); + switch (aError.Code()) { + case NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA: + mStateObj->HandleWaitingForVideo(); + break; + case NS_ERROR_DOM_MEDIA_CANCELED: + mStateObj->HandleVideoCanceled(); + break; + case NS_ERROR_DOM_MEDIA_END_OF_STREAM: + mStateObj->HandleEndOfVideo(); + break; + default: + DecodeError(aError); + } + }) ->Track(mVideoDataRequest); } @@ -3158,31 +3151,29 @@ void MediaDecoderStateMachine::WaitForData(MediaData::Type aType) { RefPtr self = this; if (aType == MediaData::Type::AUDIO_DATA) { mReader->WaitForData(MediaData::Type::AUDIO_DATA) - ->Then( - OwnerThread(), __func__, - [self](MediaData::Type aType) { - self->mAudioWaitRequest.Complete(); - MOZ_ASSERT(aType == MediaData::Type::AUDIO_DATA); - self->mStateObj->HandleAudioWaited(aType); - }, - [self](const WaitForDataRejectValue& aRejection) { - self->mAudioWaitRequest.Complete(); - self->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); - }) + ->Then(OwnerThread(), __func__, + [self](MediaData::Type aType) { + self->mAudioWaitRequest.Complete(); + MOZ_ASSERT(aType == MediaData::Type::AUDIO_DATA); + self->mStateObj->HandleAudioWaited(aType); + }, + [self](const WaitForDataRejectValue& aRejection) { + self->mAudioWaitRequest.Complete(); + self->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); + }) ->Track(mAudioWaitRequest); } else { mReader->WaitForData(MediaData::Type::VIDEO_DATA) - ->Then( - OwnerThread(), __func__, - [self](MediaData::Type aType) { - self->mVideoWaitRequest.Complete(); - MOZ_ASSERT(aType == MediaData::Type::VIDEO_DATA); - self->mStateObj->HandleVideoWaited(aType); - }, - [self](const WaitForDataRejectValue& aRejection) { - self->mVideoWaitRequest.Complete(); - self->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); - }) + ->Then(OwnerThread(), __func__, + [self](MediaData::Type aType) { + self->mVideoWaitRequest.Complete(); + MOZ_ASSERT(aType == MediaData::Type::VIDEO_DATA); + self->mStateObj->HandleVideoWaited(aType); + }, + [self](const WaitForDataRejectValue& aRejection) { + self->mVideoWaitRequest.Complete(); + self->DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA); + }) ->Track(mVideoWaitRequest); } } @@ -3473,13 +3464,12 @@ void MediaDecoderStateMachine::ScheduleStateMachineIn(const TimeUnit& aTime) { // It is OK to capture 'this' without causing UAF because the callback // always happens before shutdown. RefPtr self = this; - mDelayedScheduler.Ensure( - target, - [self]() { - self->mDelayedScheduler.CompleteRequest(); - self->RunStateMachine(); - }, - []() { MOZ_DIAGNOSTIC_ASSERT(false); }); + mDelayedScheduler.Ensure(target, + [self]() { + self->mDelayedScheduler.CompleteRequest(); + self->RunStateMachine(); + }, + []() { MOZ_DIAGNOSTIC_ASSERT(false); }); } bool MediaDecoderStateMachine::OnTaskQueue() const { diff --git a/dom/media/MediaDevices.cpp b/dom/media/MediaDevices.cpp index 4e29508b99a3..282fd8c3c33e 100644 --- a/dom/media/MediaDevices.cpp +++ b/dom/media/MediaDevices.cpp @@ -65,21 +65,20 @@ already_AddRefed MediaDevices::GetUserMedia( RefPtr self(this); MediaManager::Get() ->GetUserMedia(GetOwner(), aConstraints, aCallerType) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this, self, p](RefPtr&& aStream) { - if (!GetWindowIfCurrent()) { - return; // Leave Promise pending after navigation by design. - } - p->MaybeResolve(std::move(aStream)); - }, - [this, self, p](const RefPtr& error) { - nsPIDOMWindowInner* window = GetWindowIfCurrent(); - if (!window) { - return; // Leave Promise pending after navigation by design. - } - p->MaybeReject(MakeRefPtr(window, *error)); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this, self, p](RefPtr&& aStream) { + if (!GetWindowIfCurrent()) { + return; // Leave Promise pending after navigation by design. + } + p->MaybeResolve(std::move(aStream)); + }, + [this, self, p](const RefPtr& error) { + nsPIDOMWindowInner* window = GetWindowIfCurrent(); + if (!window) { + return; // Leave Promise pending after navigation by design. + } + p->MaybeReject(MakeRefPtr(window, *error)); + }); return p.forget(); } @@ -93,41 +92,40 @@ already_AddRefed MediaDevices::EnumerateDevices(CallerType aCallerType, RefPtr self(this); MediaManager::Get() ->EnumerateDevices(GetOwner(), aCallerType) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this, self, - p](RefPtr&& aDevices) { - nsPIDOMWindowInner* window = GetWindowIfCurrent(); - if (!window) { - return; // Leave Promise pending after navigation by design. - } - auto windowId = window->WindowID(); - nsTArray> infos; - for (auto& device : *aDevices) { - MOZ_ASSERT(device->mKind == dom::MediaDeviceKind::Audioinput || - device->mKind == dom::MediaDeviceKind::Videoinput || - device->mKind == dom::MediaDeviceKind::Audiooutput); - // Include name only if page currently has a gUM stream active - // or persistent permissions (audio or video) have been granted - nsString label; - if (MediaManager::Get()->IsActivelyCapturingOrHasAPermission( - windowId) || - Preferences::GetBool("media.navigator.permission.disabled", - false)) { - label = device->mName; - } - infos.AppendElement(MakeRefPtr( - device->mID, device->mKind, label, device->mGroupID)); - } - p->MaybeResolve(std::move(infos)); - }, - [this, self, p](const RefPtr& error) { - nsPIDOMWindowInner* window = GetWindowIfCurrent(); - if (!window) { - return; // Leave Promise pending after navigation by design. - } - p->MaybeReject(MakeRefPtr(window, *error)); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this, self, + p](RefPtr&& aDevices) { + nsPIDOMWindowInner* window = GetWindowIfCurrent(); + if (!window) { + return; // Leave Promise pending after navigation by design. + } + auto windowId = window->WindowID(); + nsTArray> infos; + for (auto& device : *aDevices) { + MOZ_ASSERT(device->mKind == dom::MediaDeviceKind::Audioinput || + device->mKind == dom::MediaDeviceKind::Videoinput || + device->mKind == dom::MediaDeviceKind::Audiooutput); + // Include name only if page currently has a gUM stream active + // or persistent permissions (audio or video) have been granted + nsString label; + if (MediaManager::Get()->IsActivelyCapturingOrHasAPermission( + windowId) || + Preferences::GetBool("media.navigator.permission.disabled", + false)) { + label = device->mName; + } + infos.AppendElement(MakeRefPtr( + device->mID, device->mKind, label, device->mGroupID)); + } + p->MaybeResolve(std::move(infos)); + }, + [this, self, p](const RefPtr& error) { + nsPIDOMWindowInner* window = GetWindowIfCurrent(); + if (!window) { + return; // Leave Promise pending after navigation by design. + } + p->MaybeReject(MakeRefPtr(window, *error)); + }); return p.forget(); } @@ -141,21 +139,20 @@ already_AddRefed MediaDevices::GetDisplayMedia( RefPtr self(this); MediaManager::Get() ->GetDisplayMedia(GetOwner(), aConstraints, aCallerType) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this, self, p](RefPtr&& aStream) { - if (!GetWindowIfCurrent()) { - return; // leave promise pending after navigation. - } - p->MaybeResolve(std::move(aStream)); - }, - [this, self, p](RefPtr&& error) { - nsPIDOMWindowInner* window = GetWindowIfCurrent(); - if (!window) { - return; // leave promise pending after navigation. - } - p->MaybeReject(MakeRefPtr(window, *error)); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this, self, p](RefPtr&& aStream) { + if (!GetWindowIfCurrent()) { + return; // leave promise pending after navigation. + } + p->MaybeResolve(std::move(aStream)); + }, + [this, self, p](RefPtr&& error) { + nsPIDOMWindowInner* window = GetWindowIfCurrent(); + if (!window) { + return; // leave promise pending after navigation. + } + p->MaybeReject(MakeRefPtr(window, *error)); + }); return p.forget(); } diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index e9687caadfb0..65d57c73b019 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -336,18 +336,17 @@ void MediaFormatReader::DecoderFactory::RunStage(Data& aData) { case Stage::None: { MOZ_ASSERT(!aData.mToken); aData.mPolicy->Alloc() - ->Then( - mOwner->OwnerThread(), __func__, - [this, &aData](RefPtr aToken) { - aData.mTokenRequest.Complete(); - aData.mToken = aToken.forget(); - aData.mStage = Stage::CreateDecoder; - RunStage(aData); - }, - [&aData]() { - aData.mTokenRequest.Complete(); - aData.mStage = Stage::None; - }) + ->Then(mOwner->OwnerThread(), __func__, + [this, &aData](RefPtr aToken) { + aData.mTokenRequest.Complete(); + aData.mToken = aToken.forget(); + aData.mStage = Stage::CreateDecoder; + RunStage(aData); + }, + [&aData]() { + aData.mTokenRequest.Complete(); + aData.mStage = Stage::None; + }) ->Track(aData.mTokenRequest); aData.mStage = Stage::WaitForToken; break; @@ -476,33 +475,33 @@ void MediaFormatReader::DecoderFactory::DoInitDecoder(Data& aData) { DDLOGEX2("MediaFormatReader::DecoderFactory", this, DDLogCategory::Log, "initialize_decoder", DDNoValue{}); aData.mDecoder->Init() - ->Then( - mOwner->OwnerThread(), __func__, - [this, &aData, &ownerData](TrackType aTrack) { - aData.mInitRequest.Complete(); - aData.mStage = Stage::None; - MutexAutoLock lock(ownerData.mMutex); - ownerData.mDecoder = aData.mDecoder.forget(); - ownerData.mDescription = ownerData.mDecoder->GetDescriptionName(); - DDLOGEX2("MediaFormatReader::DecoderFactory", this, - DDLogCategory::Log, "decoder_initialized", DDNoValue{}); - DecoderDoctorLogger::LinkParentAndChild( - "MediaFormatReader::DecoderData", &ownerData, "decoder", - ownerData.mDecoder.get()); - mOwner->SetVideoDecodeThreshold(); - mOwner->ScheduleUpdate(aTrack); - }, - [this, &aData, &ownerData](const MediaResult& aError) { - aData.mInitRequest.Complete(); - MOZ_RELEASE_ASSERT(!ownerData.mDecoder, - "Can't have a decoder already set"); - aData.mStage = Stage::None; - mOwner->mShutdownPromisePool->ShutdownDecoder( - aData.mDecoder.forget()); - DDLOGEX2("MediaFormatReader::DecoderFactory", this, - DDLogCategory::Log, "initialize_decoder_error", aError); - mOwner->NotifyError(aData.mTrack, aError); - }) + ->Then(mOwner->OwnerThread(), __func__, + [this, &aData, &ownerData](TrackType aTrack) { + aData.mInitRequest.Complete(); + aData.mStage = Stage::None; + MutexAutoLock lock(ownerData.mMutex); + ownerData.mDecoder = aData.mDecoder.forget(); + ownerData.mDescription = + ownerData.mDecoder->GetDescriptionName(); + DDLOGEX2("MediaFormatReader::DecoderFactory", this, + DDLogCategory::Log, "decoder_initialized", DDNoValue{}); + DecoderDoctorLogger::LinkParentAndChild( + "MediaFormatReader::DecoderData", &ownerData, "decoder", + ownerData.mDecoder.get()); + mOwner->SetVideoDecodeThreshold(); + mOwner->ScheduleUpdate(aTrack); + }, + [this, &aData, &ownerData](const MediaResult& aError) { + aData.mInitRequest.Complete(); + MOZ_RELEASE_ASSERT(!ownerData.mDecoder, + "Can't have a decoder already set"); + aData.mStage = Stage::None; + mOwner->mShutdownPromisePool->ShutdownDecoder( + aData.mDecoder.forget()); + DDLOGEX2("MediaFormatReader::DecoderFactory", this, + DDLogCategory::Log, "initialize_decoder_error", aError); + mOwner->NotifyError(aData.mTrack, aError); + }) ->Track(aData.mInitRequest); } @@ -654,16 +653,15 @@ class MediaFormatReader::DemuxerProxy::Wrapper : public MediaTrackDemuxer { return InvokeAsync( mTaskQueue, __func__, [self, aTime]() { return self->mTrackDemuxer->Seek(aTime); }) - ->Then( - mTaskQueue, __func__, - [self](const TimeUnit& aTime) { - self->UpdateRandomAccessPoint(); - return SeekPromise::CreateAndResolve(aTime, __func__); - }, - [self](const MediaResult& aError) { - self->UpdateRandomAccessPoint(); - return SeekPromise::CreateAndReject(aError, __func__); - }); + ->Then(mTaskQueue, __func__, + [self](const TimeUnit& aTime) { + self->UpdateRandomAccessPoint(); + return SeekPromise::CreateAndResolve(aTime, __func__); + }, + [self](const MediaResult& aError) { + self->UpdateRandomAccessPoint(); + return SeekPromise::CreateAndReject(aError, __func__); + }); } RefPtr GetSamples(int32_t aNumSamples) override { @@ -672,17 +670,16 @@ class MediaFormatReader::DemuxerProxy::Wrapper : public MediaTrackDemuxer { [self, aNumSamples]() { return self->mTrackDemuxer->GetSamples(aNumSamples); }) - ->Then( - mTaskQueue, __func__, - [self](RefPtr aSamples) { - self->UpdateRandomAccessPoint(); - return SamplesPromise::CreateAndResolve(aSamples.forget(), - __func__); - }, - [self](const MediaResult& aError) { - self->UpdateRandomAccessPoint(); - return SamplesPromise::CreateAndReject(aError, __func__); - }); + ->Then(mTaskQueue, __func__, + [self](RefPtr aSamples) { + self->UpdateRandomAccessPoint(); + return SamplesPromise::CreateAndResolve(aSamples.forget(), + __func__); + }, + [self](const MediaResult& aError) { + self->UpdateRandomAccessPoint(); + return SamplesPromise::CreateAndReject(aError, __func__); + }); } bool GetSamplesMayBlock() const override { return mGetSamplesMayBlock; } @@ -791,57 +788,56 @@ RefPtr MediaFormatReader::DemuxerProxy::Init() { } return data->mDemuxer->Init(); }) - ->Then( - taskQueue, __func__, - [data, taskQueue]() { - if (!data->mDemuxer) { // Was shutdown. - return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, - __func__); - } - data->mNumAudioTrack = - data->mDemuxer->GetNumberTracks(TrackInfo::kAudioTrack); - if (data->mNumAudioTrack) { - RefPtr d = - data->mDemuxer->GetTrackDemuxer(TrackInfo::kAudioTrack, 0); - if (d) { - RefPtr wrapper = - new DemuxerProxy::Wrapper(d, taskQueue); - wrapper->UpdateBuffered(); - data->mAudioDemuxer = wrapper; - DecoderDoctorLogger::LinkParentAndChild( - data->mDemuxer.get(), "decoder factory wrapper", - "MediaFormatReader::DecoderFactory::Wrapper", - wrapper.get()); - } - } - data->mNumVideoTrack = - data->mDemuxer->GetNumberTracks(TrackInfo::kVideoTrack); - if (data->mNumVideoTrack) { - RefPtr d = - data->mDemuxer->GetTrackDemuxer(TrackInfo::kVideoTrack, 0); - if (d) { - RefPtr wrapper = - new DemuxerProxy::Wrapper(d, taskQueue); - wrapper->UpdateBuffered(); - data->mVideoDemuxer = wrapper; - DecoderDoctorLogger::LinkParentAndChild( - data->mDemuxer.get(), "decoder factory wrapper", - "MediaFormatReader::DecoderFactory::Wrapper", - wrapper.get()); - } - } - data->mCrypto = data->mDemuxer->GetCrypto(); - data->mSeekable = data->mDemuxer->IsSeekable(); - data->mSeekableOnlyInBufferedRange = - data->mDemuxer->IsSeekableOnlyInBufferedRanges(); - data->mShouldComputeStartTime = - data->mDemuxer->ShouldComputeStartTime(); - data->mInitDone = true; - return InitPromise::CreateAndResolve(NS_OK, __func__); - }, - [](const MediaResult& aError) { - return InitPromise::CreateAndReject(aError, __func__); - }); + ->Then(taskQueue, __func__, + [data, taskQueue]() { + if (!data->mDemuxer) { // Was shutdown. + return InitPromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_CANCELED, __func__); + } + data->mNumAudioTrack = + data->mDemuxer->GetNumberTracks(TrackInfo::kAudioTrack); + if (data->mNumAudioTrack) { + RefPtr d = + data->mDemuxer->GetTrackDemuxer(TrackInfo::kAudioTrack, 0); + if (d) { + RefPtr wrapper = + new DemuxerProxy::Wrapper(d, taskQueue); + wrapper->UpdateBuffered(); + data->mAudioDemuxer = wrapper; + DecoderDoctorLogger::LinkParentAndChild( + data->mDemuxer.get(), "decoder factory wrapper", + "MediaFormatReader::DecoderFactory::Wrapper", + wrapper.get()); + } + } + data->mNumVideoTrack = + data->mDemuxer->GetNumberTracks(TrackInfo::kVideoTrack); + if (data->mNumVideoTrack) { + RefPtr d = + data->mDemuxer->GetTrackDemuxer(TrackInfo::kVideoTrack, 0); + if (d) { + RefPtr wrapper = + new DemuxerProxy::Wrapper(d, taskQueue); + wrapper->UpdateBuffered(); + data->mVideoDemuxer = wrapper; + DecoderDoctorLogger::LinkParentAndChild( + data->mDemuxer.get(), "decoder factory wrapper", + "MediaFormatReader::DecoderFactory::Wrapper", + wrapper.get()); + } + } + data->mCrypto = data->mDemuxer->GetCrypto(); + data->mSeekable = data->mDemuxer->IsSeekable(); + data->mSeekableOnlyInBufferedRange = + data->mDemuxer->IsSeekableOnlyInBufferedRanges(); + data->mShouldComputeStartTime = + data->mDemuxer->ShouldComputeStartTime(); + data->mInitDone = true; + return InitPromise::CreateAndResolve(NS_OK, __func__); + }, + [](const MediaResult& aError) { + return InitPromise::CreateAndReject(aError, __func__); + }); } RefPtr @@ -1448,20 +1444,20 @@ void MediaFormatReader::DoDemuxVideo() { if (mVideo.mFirstDemuxedSampleTime.isNothing()) { RefPtr self = this; - p = p->Then( - OwnerThread(), __func__, - [self](RefPtr aSamples) { - DDLOGEX(self.get(), DDLogCategory::Log, "video_first_demuxed", - DDNoValue{}); - self->OnFirstDemuxCompleted(TrackInfo::kVideoTrack, aSamples); - return SamplesPromise::CreateAndResolve(aSamples.forget(), __func__); - }, - [self](const MediaResult& aError) { - DDLOGEX(self.get(), DDLogCategory::Log, "video_first_demuxing_error", - aError); - self->OnFirstDemuxFailed(TrackInfo::kVideoTrack, aError); - return SamplesPromise::CreateAndReject(aError, __func__); - }); + p = p->Then(OwnerThread(), __func__, + [self](RefPtr aSamples) { + DDLOGEX(self.get(), DDLogCategory::Log, "video_first_demuxed", + DDNoValue{}); + self->OnFirstDemuxCompleted(TrackInfo::kVideoTrack, aSamples); + return SamplesPromise::CreateAndResolve(aSamples.forget(), + __func__); + }, + [self](const MediaResult& aError) { + DDLOGEX(self.get(), DDLogCategory::Log, + "video_first_demuxing_error", aError); + self->OnFirstDemuxFailed(TrackInfo::kVideoTrack, aError); + return SamplesPromise::CreateAndReject(aError, __func__); + }); } p->Then(OwnerThread(), __func__, this, @@ -1526,20 +1522,20 @@ void MediaFormatReader::DoDemuxAudio() { if (mAudio.mFirstDemuxedSampleTime.isNothing()) { RefPtr self = this; - p = p->Then( - OwnerThread(), __func__, - [self](RefPtr aSamples) { - DDLOGEX(self.get(), DDLogCategory::Log, "audio_first_demuxed", - DDNoValue{}); - self->OnFirstDemuxCompleted(TrackInfo::kAudioTrack, aSamples); - return SamplesPromise::CreateAndResolve(aSamples.forget(), __func__); - }, - [self](const MediaResult& aError) { - DDLOGEX(self.get(), DDLogCategory::Log, "audio_first_demuxing_error", - aError); - self->OnFirstDemuxFailed(TrackInfo::kAudioTrack, aError); - return SamplesPromise::CreateAndReject(aError, __func__); - }); + p = p->Then(OwnerThread(), __func__, + [self](RefPtr aSamples) { + DDLOGEX(self.get(), DDLogCategory::Log, "audio_first_demuxed", + DDNoValue{}); + self->OnFirstDemuxCompleted(TrackInfo::kAudioTrack, aSamples); + return SamplesPromise::CreateAndResolve(aSamples.forget(), + __func__); + }, + [self](const MediaResult& aError) { + DDLOGEX(self.get(), DDLogCategory::Log, + "audio_first_demuxing_error", aError); + self->OnFirstDemuxFailed(TrackInfo::kAudioTrack, aError); + return SamplesPromise::CreateAndReject(aError, __func__); + }); } p->Then(OwnerThread(), __func__, this, @@ -1997,47 +1993,46 @@ void MediaFormatReader::InternalSeek(TrackType aTrack, DDLOG(DDLogCategory::Log, "seeking", DDNoValue{}); RefPtr self = this; decoder.mTrackDemuxer->Seek(decoder.mTimeThreshold.ref().Time()) - ->Then( - OwnerThread(), __func__, - [self, aTrack](TimeUnit aTime) { - DDLOGEX(self.get(), DDLogCategory::Log, "seeked", DDNoValue{}); - auto& decoder = self->GetDecoderData(aTrack); - decoder.mSeekRequest.Complete(); - MOZ_ASSERT(decoder.mTimeThreshold, - "Seek promise must be disconnected when " - "timethreshold is reset"); - decoder.mTimeThreshold.ref().mHasSeeked = true; - self->SetVideoDecodeThreshold(); - self->ScheduleUpdate(aTrack); - }, - [self, aTrack](const MediaResult& aError) { - auto& decoder = self->GetDecoderData(aTrack); - decoder.mSeekRequest.Complete(); - switch (aError.Code()) { - case NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA: - DDLOGEX(self.get(), DDLogCategory::Log, "seeking_interrupted", - aError); - self->NotifyWaitingForData(aTrack); - break; - case NS_ERROR_DOM_MEDIA_END_OF_STREAM: - DDLOGEX(self.get(), DDLogCategory::Log, "seeking_interrupted", - aError); - decoder.mTimeThreshold.reset(); - self->NotifyEndOfStream(aTrack); - break; - case NS_ERROR_DOM_MEDIA_CANCELED: - DDLOGEX(self.get(), DDLogCategory::Log, "seeking_interrupted", - aError); - decoder.mTimeThreshold.reset(); - break; - default: - DDLOGEX(self.get(), DDLogCategory::Log, "seeking_error", - aError); - decoder.mTimeThreshold.reset(); - self->NotifyError(aTrack, aError); - break; - } - }) + ->Then(OwnerThread(), __func__, + [self, aTrack](TimeUnit aTime) { + DDLOGEX(self.get(), DDLogCategory::Log, "seeked", DDNoValue{}); + auto& decoder = self->GetDecoderData(aTrack); + decoder.mSeekRequest.Complete(); + MOZ_ASSERT(decoder.mTimeThreshold, + "Seek promise must be disconnected when " + "timethreshold is reset"); + decoder.mTimeThreshold.ref().mHasSeeked = true; + self->SetVideoDecodeThreshold(); + self->ScheduleUpdate(aTrack); + }, + [self, aTrack](const MediaResult& aError) { + auto& decoder = self->GetDecoderData(aTrack); + decoder.mSeekRequest.Complete(); + switch (aError.Code()) { + case NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA: + DDLOGEX(self.get(), DDLogCategory::Log, + "seeking_interrupted", aError); + self->NotifyWaitingForData(aTrack); + break; + case NS_ERROR_DOM_MEDIA_END_OF_STREAM: + DDLOGEX(self.get(), DDLogCategory::Log, + "seeking_interrupted", aError); + decoder.mTimeThreshold.reset(); + self->NotifyEndOfStream(aTrack); + break; + case NS_ERROR_DOM_MEDIA_CANCELED: + DDLOGEX(self.get(), DDLogCategory::Log, + "seeking_interrupted", aError); + decoder.mTimeThreshold.reset(); + break; + default: + DDLOGEX(self.get(), DDLogCategory::Log, "seeking_error", + aError); + decoder.mTimeThreshold.reset(); + self->NotifyError(aTrack, aError); + break; + } + }) ->Track(decoder.mSeekRequest); } @@ -2874,18 +2869,17 @@ void MediaFormatReader::NotifyDataArrived() { RefPtr self = this; mDemuxer->NotifyDataArrived() - ->Then( - OwnerThread(), __func__, - [self]() { - self->mNotifyDataArrivedPromise.Complete(); - self->UpdateBuffered(); - self->NotifyTrackDemuxers(); - if (self->mPendingNotifyDataArrived) { - self->mPendingNotifyDataArrived = false; - self->NotifyDataArrived(); - } - }, - [self]() { self->mNotifyDataArrivedPromise.Complete(); }) + ->Then(OwnerThread(), __func__, + [self]() { + self->mNotifyDataArrivedPromise.Complete(); + self->UpdateBuffered(); + self->NotifyTrackDemuxers(); + if (self->mPendingNotifyDataArrived) { + self->mPendingNotifyDataArrived = false; + self->NotifyDataArrived(); + } + }, + [self]() { self->mNotifyDataArrivedPromise.Complete(); }) ->Track(mNotifyDataArrivedPromise); } diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 2936185af69e..7791cdb50512 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -3139,46 +3139,46 @@ RefPtr MediaManager::EnumerateDevicesImpl( MakeRefPtr(MediaMgrError::Name::AbortError), __func__); }) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [aWindowId, originKey, aVideoInputEnumType, aAudioInputEnumType, - aVideoInputType, aAudioInputType, aOutDevices](bool) { - // Only run if window is still on our active list. - MediaManager* mgr = MediaManager::GetIfExists(); - if (!mgr || !mgr->IsWindowStillActive(aWindowId)) { - return MgrPromise::CreateAndReject( - MakeRefPtr(MediaMgrError::Name::AbortError), - __func__); - } + ->Then(GetMainThreadSerialEventTarget(), __func__, + [aWindowId, originKey, aVideoInputEnumType, aAudioInputEnumType, + aVideoInputType, aAudioInputType, aOutDevices](bool) { + // Only run if window is still on our active list. + MediaManager* mgr = MediaManager::GetIfExists(); + if (!mgr || !mgr->IsWindowStillActive(aWindowId)) { + return MgrPromise::CreateAndReject( + MakeRefPtr(MediaMgrError::Name::AbortError), + __func__); + } - // If we fetched any real cameras or mics, remove the - // "default" part of their IDs. - if (aVideoInputType == MediaSourceEnum::Camera && - aAudioInputType == MediaSourceEnum::Microphone && - (aVideoInputEnumType != DeviceEnumerationType::Fake || - aAudioInputEnumType != DeviceEnumerationType::Fake)) { - mgr->mDeviceIDs.Clear(); - for (auto& device : *aOutDevices) { - nsString id; - device->GetId(id); - id.ReplaceSubstring(NS_LITERAL_STRING("default: "), - NS_LITERAL_STRING("")); - if (!mgr->mDeviceIDs.Contains(id)) { - mgr->mDeviceIDs.AppendElement(id); - } - } - } - if (!mgr->IsWindowStillActive(aWindowId)) { - return MgrPromise::CreateAndReject( - MakeRefPtr(MediaMgrError::Name::AbortError), - __func__); - } - MediaManager::AnonymizeDevices(*aOutDevices, *originKey, aWindowId); - return MgrPromise::CreateAndResolve(false, __func__); - }, - [](RefPtr&& aError) { - return MgrPromise::CreateAndReject(std::move(aError), __func__); - }); + // If we fetched any real cameras or mics, remove the + // "default" part of their IDs. + if (aVideoInputType == MediaSourceEnum::Camera && + aAudioInputType == MediaSourceEnum::Microphone && + (aVideoInputEnumType != DeviceEnumerationType::Fake || + aAudioInputEnumType != DeviceEnumerationType::Fake)) { + mgr->mDeviceIDs.Clear(); + for (auto& device : *aOutDevices) { + nsString id; + device->GetId(id); + id.ReplaceSubstring(NS_LITERAL_STRING("default: "), + NS_LITERAL_STRING("")); + if (!mgr->mDeviceIDs.Contains(id)) { + mgr->mDeviceIDs.AppendElement(id); + } + } + } + if (!mgr->IsWindowStillActive(aWindowId)) { + return MgrPromise::CreateAndReject( + MakeRefPtr(MediaMgrError::Name::AbortError), + __func__); + } + MediaManager::AnonymizeDevices(*aOutDevices, *originKey, + aWindowId); + return MgrPromise::CreateAndResolve(false, __func__); + }, + [](RefPtr&& aError) { + return MgrPromise::CreateAndReject(std::move(aError), __func__); + }); } RefPtr MediaManager::EnumerateDevices( @@ -3250,21 +3250,21 @@ RefPtr MediaManager::EnumerateDevices( MediaSourceEnum::Microphone, audioOutputType, videoEnumerationType, audioEnumerationType, false, devices) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [windowListener, sourceListener, devices](bool) { - DebugOnly rv = windowListener->Remove(sourceListener); - MOZ_ASSERT(rv); - return DevicesPromise::CreateAndResolve(devices, __func__); - }, - [windowListener, sourceListener](RefPtr&& aError) { - // This may fail, if a new doc has been set the OnNavigation - // method should have removed all previous active listeners. - // Attempt to clean it here, just in case, but ignore the return - // value. - Unused << windowListener->Remove(sourceListener); - return DevicesPromise::CreateAndReject(std::move(aError), __func__); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [windowListener, sourceListener, devices](bool) { + DebugOnly rv = windowListener->Remove(sourceListener); + MOZ_ASSERT(rv); + return DevicesPromise::CreateAndResolve(devices, __func__); + }, + [windowListener, sourceListener](RefPtr&& aError) { + // This may fail, if a new doc has been set the OnNavigation + // method should have removed all previous active listeners. + // Attempt to clean it here, just in case, but ignore the return + // value. + Unused << windowListener->Remove(sourceListener); + return DevicesPromise::CreateAndReject(std::move(aError), + __func__); + }); } RefPtr MediaManager::GetSinkDevice(nsPIDOMWindowInner* aWindow, @@ -3298,32 +3298,31 @@ RefPtr MediaManager::GetSinkDevice(nsPIDOMWindowInner* aWindow, MediaSourceEnum::Other, MediaSinkEnum::Speaker, DeviceEnumerationType::Normal, DeviceEnumerationType::Normal, true, devices) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [aDeviceId, isSecure, devices](bool) { - for (RefPtr& device : *devices) { - if (aDeviceId.IsEmpty() && device->mSinkInfo->Preferred()) { - return SinkInfoPromise::CreateAndResolve(device->mSinkInfo, - __func__); - } - if (device->mID.Equals(aDeviceId)) { - // TODO: Check if the application is authorized to play audio - // through this device (Bug 1493982). - if (isSecure || device->mSinkInfo->Preferred()) { - return SinkInfoPromise::CreateAndResolve(device->mSinkInfo, - __func__); - } - return SinkInfoPromise::CreateAndReject( - NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR, __func__); - } - } - return SinkInfoPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, - __func__); - }, - [](RefPtr&& aError) { - return SinkInfoPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, - __func__); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [aDeviceId, isSecure, devices](bool) { + for (RefPtr& device : *devices) { + if (aDeviceId.IsEmpty() && device->mSinkInfo->Preferred()) { + return SinkInfoPromise::CreateAndResolve(device->mSinkInfo, + __func__); + } + if (device->mID.Equals(aDeviceId)) { + // TODO: Check if the application is authorized to play audio + // through this device (Bug 1493982). + if (isSecure || device->mSinkInfo->Preferred()) { + return SinkInfoPromise::CreateAndResolve(device->mSinkInfo, + __func__); + } + return SinkInfoPromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR, __func__); + } + } + return SinkInfoPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, + __func__); + }, + [](RefPtr&& aError) { + return SinkInfoPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, + __func__); + }); } /* @@ -4175,50 +4174,49 @@ SourceListener::InitializeAsync() { LOG("started all sources"); aHolder.Resolve(true, __func__); }) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [self = RefPtr(this), this]() { - if (mStopped) { - // We were shut down during the async init - return SourceListenerPromise::CreateAndResolve(true, __func__); - } + ->Then(GetMainThreadSerialEventTarget(), __func__, + [self = RefPtr(this), this]() { + if (mStopped) { + // We were shut down during the async init + return SourceListenerPromise::CreateAndResolve(true, __func__); + } - for (DeviceState* state : - {mAudioDeviceState.get(), mVideoDeviceState.get()}) { - if (!state) { - continue; - } - MOZ_DIAGNOSTIC_ASSERT(!state->mTrackEnabled); - MOZ_DIAGNOSTIC_ASSERT(!state->mDeviceEnabled); - MOZ_DIAGNOSTIC_ASSERT(!state->mStopped); + for (DeviceState* state : + {mAudioDeviceState.get(), mVideoDeviceState.get()}) { + if (!state) { + continue; + } + MOZ_DIAGNOSTIC_ASSERT(!state->mTrackEnabled); + MOZ_DIAGNOSTIC_ASSERT(!state->mDeviceEnabled); + MOZ_DIAGNOSTIC_ASSERT(!state->mStopped); - state->mDeviceEnabled = true; - state->mTrackEnabled = true; - state->mTrackEnabledTime = TimeStamp::Now(); - } - return SourceListenerPromise::CreateAndResolve(true, __func__); - }, - [self = RefPtr(this), - this](RefPtr&& aResult) { - if (mStopped) { - return SourceListenerPromise::CreateAndReject(std::move(aResult), - __func__); - } + state->mDeviceEnabled = true; + state->mTrackEnabled = true; + state->mTrackEnabledTime = TimeStamp::Now(); + } + return SourceListenerPromise::CreateAndResolve(true, __func__); + }, + [self = RefPtr(this), + this](RefPtr&& aResult) { + if (mStopped) { + return SourceListenerPromise::CreateAndReject( + std::move(aResult), __func__); + } - for (DeviceState* state : - {mAudioDeviceState.get(), mVideoDeviceState.get()}) { - if (!state) { - continue; - } - MOZ_DIAGNOSTIC_ASSERT(!state->mTrackEnabled); - MOZ_DIAGNOSTIC_ASSERT(!state->mDeviceEnabled); - MOZ_DIAGNOSTIC_ASSERT(!state->mStopped); + for (DeviceState* state : + {mAudioDeviceState.get(), mVideoDeviceState.get()}) { + if (!state) { + continue; + } + MOZ_DIAGNOSTIC_ASSERT(!state->mTrackEnabled); + MOZ_DIAGNOSTIC_ASSERT(!state->mDeviceEnabled); + MOZ_DIAGNOSTIC_ASSERT(!state->mStopped); - state->mStopped = true; - } - return SourceListenerPromise::CreateAndReject(std::move(aResult), - __func__); - }); + state->mStopped = true; + } + return SourceListenerPromise::CreateAndReject(std::move(aResult), + __func__); + }); } void SourceListener::Stop() { diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index a278d392069d..7afd4a2f4aa3 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -884,14 +884,13 @@ class MediaRecorder::Session : public PrincipalChangeObserver, } gSessions.Clear(); ShutdownPromise::All(GetCurrentThreadSerialEventTarget(), promises) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [ticket]() mutable { - MOZ_ASSERT(gSessions.Count() == 0); - // Unblock shutdown - ticket = nullptr; - }, - []() { MOZ_CRASH("Not reached"); }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [ticket]() mutable { + MOZ_ASSERT(gSessions.Count() == 0); + // Unblock shutdown + ticket = nullptr; + }, + []() { MOZ_CRASH("Not reached"); }); return NS_OK; } }; @@ -1715,16 +1714,15 @@ RefPtr MediaRecorder::SizeOfExcludingThis( } SizeOfPromise::All(GetCurrentThreadSerialEventTarget(), promises) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [holder](const nsTArray& sizes) { - size_t total = 0; - for (const size_t& size : sizes) { - total += size; - } - holder->Resolve(total, __func__); - }, - []() { MOZ_CRASH("Unexpected reject"); }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [holder](const nsTArray& sizes) { + size_t total = 0; + for (const size_t& size : sizes) { + total += size; + } + holder->Resolve(total, __func__); + }, + []() { MOZ_CRASH("Unexpected reject"); }); return promise; } diff --git a/dom/media/ReaderProxy.cpp b/dom/media/ReaderProxy.cpp index cd4f17e1e192..72e86c935f2f 100644 --- a/dom/media/ReaderProxy.cpp +++ b/dom/media/ReaderProxy.cpp @@ -80,19 +80,18 @@ RefPtr ReaderProxy::RequestVideoData( int64_t startTime = StartTime().ToMicroseconds(); return InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__, &MediaFormatReader::RequestVideoData, threshold) - ->Then( - mOwnerThread, __func__, - [startTime](RefPtr aVideo) { - aVideo->AdjustForStartTime(startTime); - return aVideo->mTime.IsValid() - ? VideoDataPromise::CreateAndResolve(aVideo.forget(), - __func__) - : VideoDataPromise::CreateAndReject( - NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, __func__); - }, - [](const MediaResult& aError) { - return VideoDataPromise::CreateAndReject(aError, __func__); - }); + ->Then(mOwnerThread, __func__, + [startTime](RefPtr aVideo) { + aVideo->AdjustForStartTime(startTime); + return aVideo->mTime.IsValid() + ? VideoDataPromise::CreateAndResolve(aVideo.forget(), + __func__) + : VideoDataPromise::CreateAndReject( + NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, __func__); + }, + [](const MediaResult& aError) { + return VideoDataPromise::CreateAndReject(aError, __func__); + }); } RefPtr ReaderProxy::Seek(const SeekTarget& aTarget) { diff --git a/dom/media/VideoFrameConverter.h b/dom/media/VideoFrameConverter.h index 2e0a92ab62d0..1275b88e1d9d 100644 --- a/dom/media/VideoFrameConverter.h +++ b/dom/media/VideoFrameConverter.h @@ -93,14 +93,13 @@ class VideoFrameConverter { mLastFrameQueuedForPacing = t; mPacingTimer->WaitUntil(t, __func__) - ->Then( - mTaskQueue, __func__, - [self = RefPtr(this), this, - image = RefPtr(aChunk.mFrame.GetImage()), t, size, - aForceBlack]() mutable { - QueueForProcessing(std::move(image), t, size, aForceBlack); - }, - [] {}); + ->Then(mTaskQueue, __func__, + [self = RefPtr(this), this, + image = RefPtr(aChunk.mFrame.GetImage()), t, + size, aForceBlack]() mutable { + QueueForProcessing(std::move(image), t, size, aForceBlack); + }, + [] {}); } void SetTrackEnabled(bool aEnabled) { diff --git a/dom/media/doctor/gtest/TestMultiWriterQueue.cpp b/dom/media/doctor/gtest/TestMultiWriterQueue.cpp index 6366a1428660..fdc290cb07c7 100644 --- a/dom/media/doctor/gtest/TestMultiWriterQueue.cpp +++ b/dom/media/doctor/gtest/TestMultiWriterQueue.cpp @@ -45,8 +45,7 @@ static void TestMultiWriterQueueST(const int loops) { } } -TEST(MultiWriterQueue, SingleThreaded) -{ +TEST(MultiWriterQueue, SingleThreaded) { TestMultiWriterQueueST<1>(10); TestMultiWriterQueueST<2>(10); TestMultiWriterQueueST<4>(10); @@ -156,8 +155,7 @@ static void TestMultiWriterQueueMT(int aWriterThreads, int aReaderThreads, q.AllocatedBuffersStats().mWatermark); } -TEST(MultiWriterQueue, MultiWriterSingleReader) -{ +TEST(MultiWriterQueue, MultiWriterSingleReader) { // Small BufferSize, to exercize the buffer management code. TestMultiWriterQueueMT< MultiWriterQueue>( @@ -216,8 +214,7 @@ TEST(MultiWriterQueue, MultiWriterSingleReader) // MultiWriterQueueReaderLocking_None>>(64, 2, 2*1024*1024); } -TEST(MultiWriterQueue, MultiWriterMultiReader) -{ +TEST(MultiWriterQueue, MultiWriterMultiReader) { static_assert( mozilla::IsSame, MultiWriterQueue< @@ -346,8 +343,7 @@ struct DequeWrapperMT : DequeWrapperMW { } }; -TEST(MultiWriterQueue, nsDequeBenchmark) -{ +TEST(MultiWriterQueue, nsDequeBenchmark) { TestMultiWriterQueueMT(1, 0, 2 * 1024 * 1024, "DequeWrapperST "); diff --git a/dom/media/doctor/gtest/TestRollingNumber.cpp b/dom/media/doctor/gtest/TestRollingNumber.cpp index d4d7167aaeec..1343b4f2c538 100644 --- a/dom/media/doctor/gtest/TestRollingNumber.cpp +++ b/dom/media/doctor/gtest/TestRollingNumber.cpp @@ -14,8 +14,7 @@ using RN8 = mozilla::RollingNumber; -TEST(RollingNumber, Value) -{ +TEST(RollingNumber, Value) { // Value type should reflect template argument. static_assert(mozilla::IsSame::value, ""); @@ -41,8 +40,7 @@ TEST(RollingNumber, Value) EXPECT_EQ(0, n42.Value()); } -TEST(RollingNumber, Operations) -{ +TEST(RollingNumber, Operations) { RN8 n; EXPECT_EQ(0, n.Value()); @@ -92,8 +90,7 @@ TEST(RollingNumber, Operations) EXPECT_EQ(10, n.Value()); } -TEST(RollingNumber, Comparisons) -{ +TEST(RollingNumber, Comparisons) { uint8_t i = 0; do { RN8 n{i}; diff --git a/dom/media/eme/MediaKeySystemAccess.cpp b/dom/media/eme/MediaKeySystemAccess.cpp index 65ff49172115..99a01c20efd6 100644 --- a/dom/media/eme/MediaKeySystemAccess.cpp +++ b/dom/media/eme/MediaKeySystemAccess.cpp @@ -793,9 +793,7 @@ static bool CheckRequirement(const MediaKeysRequirement aRequirement, } break; } - default: { - return false; - } + default: { return false; } } // Set the requirement member of accumulated configuration to equal diff --git a/dom/media/encoder/VP8TrackEncoder.cpp b/dom/media/encoder/VP8TrackEncoder.cpp index ba761052ff0a..56af6cf739d5 100644 --- a/dom/media/encoder/VP8TrackEncoder.cpp +++ b/dom/media/encoder/VP8TrackEncoder.cpp @@ -233,9 +233,7 @@ nsresult VP8TrackEncoder::GetEncodedPartitions(EncodedFrameContainer& aData) { pkt->data.frame.sz); break; } - default: { - break; - } + default: { break; } } // End of frame if ((pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT) == 0) { diff --git a/dom/media/gmp/ChromiumCDMChild.cpp b/dom/media/gmp/ChromiumCDMChild.cpp index 075439f7f0d4..9b3e4ebfb8df 100644 --- a/dom/media/gmp/ChromiumCDMChild.cpp +++ b/dom/media/gmp/ChromiumCDMChild.cpp @@ -392,16 +392,15 @@ mozilla::ipc::IPCResult ChromiumCDMChild::RecvInit( mPersistentStateAllowed = aAllowPersistentState; RefPtr promise = mInitPromise.Ensure(__func__); - promise->Then( - mPlugin->GMPMessageLoop()->SerialEventTarget(), __func__, - [aResolver](bool /* unused */) { aResolver(true); }, - [aResolver](nsresult rv) { - GMP_LOG( - "ChromiumCDMChild::RecvInit() init promise rejected with " - "rv=%" PRIu32, - static_cast(rv)); - aResolver(false); - }); + promise->Then(mPlugin->GMPMessageLoop()->SerialEventTarget(), __func__, + [aResolver](bool /* unused */) { aResolver(true); }, + [aResolver](nsresult rv) { + GMP_LOG( + "ChromiumCDMChild::RecvInit() init promise rejected with " + "rv=%" PRIu32, + static_cast(rv)); + aResolver(false); + }); if (mCDM) { // Once the CDM is initialized we expect it to resolve mInitPromise via diff --git a/dom/media/gmp/ChromiumCDMProxy.cpp b/dom/media/gmp/ChromiumCDMProxy.cpp index 0c3dea377cfb..b9e9e932e783 100644 --- a/dom/media/gmp/ChromiumCDMProxy.cpp +++ b/dom/media/gmp/ChromiumCDMProxy.cpp @@ -93,21 +93,20 @@ void ChromiumCDMProxy::Init(PromiseId aPromiseId, const nsAString& aOrigin, cdm->Init(self->mCallback.get(), self->mDistinctiveIdentifierRequired, self->mPersistentStateRequired, self->mMainThread) - ->Then( - thread, __func__, - [self, aPromiseId, cdm](bool /* unused */) { - // CDM init succeeded - { - MutexAutoLock lock(self->mCDMMutex); - self->mCDM = cdm; - } - self->OnCDMCreated(aPromiseId); - }, - [self, aPromiseId](MediaResult aResult) { - // CDM init failed - self->RejectPromise(aPromiseId, aResult.Code(), - aResult.Message()); - }); + ->Then(thread, __func__, + [self, aPromiseId, cdm](bool /* unused */) { + // CDM init succeeded + { + MutexAutoLock lock(self->mCDMMutex); + self->mCDM = cdm; + } + self->OnCDMCreated(aPromiseId); + }, + [self, aPromiseId](MediaResult aResult) { + // CDM init failed + self->RejectPromise(aPromiseId, aResult.Code(), + aResult.Message()); + }); }, [self, aPromiseId](MediaResult rv) { // service->GetCDM failed diff --git a/dom/media/gmp/GMPService.cpp b/dom/media/gmp/GMPService.cpp index 5c8c58c9e6ea..660018343378 100644 --- a/dom/media/gmp/GMPService.cpp +++ b/dom/media/gmp/GMPService.cpp @@ -355,25 +355,24 @@ GeckoMediaPluginService::GetDecryptingGMPVideoDecoder( RefPtr helper(aHelper); GetContentParent(aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER), *aTags) - ->Then( - thread, __func__, - [rawCallback, helper, - aDecryptorId](RefPtr wrapper) { - RefPtr parent = wrapper->mParent; - UniquePtr callback(rawCallback); - GMPVideoDecoderParent* actor = nullptr; - GMPVideoHostImpl* host = nullptr; - if (parent && NS_SUCCEEDED(parent->GetGMPVideoDecoder( - &actor, aDecryptorId))) { - host = &(actor->Host()); - actor->SetCrashHelper(helper); - } - callback->Done(actor, host); - }, - [rawCallback] { - UniquePtr callback(rawCallback); - callback->Done(nullptr, nullptr); - }); + ->Then(thread, __func__, + [rawCallback, helper, + aDecryptorId](RefPtr wrapper) { + RefPtr parent = wrapper->mParent; + UniquePtr callback(rawCallback); + GMPVideoDecoderParent* actor = nullptr; + GMPVideoHostImpl* host = nullptr; + if (parent && NS_SUCCEEDED(parent->GetGMPVideoDecoder( + &actor, aDecryptorId))) { + host = &(actor->Host()); + actor->SetCrashHelper(helper); + } + callback->Done(actor, host); + }, + [rawCallback] { + UniquePtr callback(rawCallback); + callback->Done(nullptr, nullptr); + }); return NS_OK; } @@ -396,24 +395,23 @@ GeckoMediaPluginService::GetGMPVideoEncoder( RefPtr helper(aHelper); GetContentParent(aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_VIDEO_ENCODER), *aTags) - ->Then( - thread, __func__, - [rawCallback, - helper](RefPtr wrapper) { - RefPtr parent = wrapper->mParent; - UniquePtr callback(rawCallback); - GMPVideoEncoderParent* actor = nullptr; - GMPVideoHostImpl* host = nullptr; - if (parent && NS_SUCCEEDED(parent->GetGMPVideoEncoder(&actor))) { - host = &(actor->Host()); - actor->SetCrashHelper(helper); - } - callback->Done(actor, host); - }, - [rawCallback] { - UniquePtr callback(rawCallback); - callback->Done(nullptr, nullptr); - }); + ->Then(thread, __func__, + [rawCallback, + helper](RefPtr wrapper) { + RefPtr parent = wrapper->mParent; + UniquePtr callback(rawCallback); + GMPVideoEncoderParent* actor = nullptr; + GMPVideoHostImpl* host = nullptr; + if (parent && NS_SUCCEEDED(parent->GetGMPVideoEncoder(&actor))) { + host = &(actor->Host()); + actor->SetCrashHelper(helper); + } + callback->Done(actor, host); + }, + [rawCallback] { + UniquePtr callback(rawCallback); + callback->Done(nullptr, nullptr); + }); return NS_OK; } diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 9cd1d2151e76..8bc29a825770 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -401,18 +401,17 @@ void GeckoMediaPluginServiceParent::InitializePlugins( RefPtr p = mInitPromise.Ensure(__func__); InvokeAsync(aAbstractGMPThread, this, __func__, &GeckoMediaPluginServiceParent::LoadFromEnvironment) - ->Then( - aAbstractGMPThread, __func__, - [self]() -> void { - MonitorAutoLock lock(self->mInitPromiseMonitor); - self->mLoadPluginsFromDiskComplete = true; - self->mInitPromise.Resolve(true, __func__); - }, - [self]() -> void { - MonitorAutoLock lock(self->mInitPromiseMonitor); - self->mLoadPluginsFromDiskComplete = true; - self->mInitPromise.Reject(NS_ERROR_FAILURE, __func__); - }); + ->Then(aAbstractGMPThread, __func__, + [self]() -> void { + MonitorAutoLock lock(self->mInitPromiseMonitor); + self->mLoadPluginsFromDiskComplete = true; + self->mInitPromise.Resolve(true, __func__); + }, + [self]() -> void { + MonitorAutoLock lock(self->mInitPromiseMonitor); + self->mLoadPluginsFromDiskComplete = true; + self->mInitPromise.Reject(NS_ERROR_FAILURE, __func__); + }); } void GeckoMediaPluginServiceParent::NotifySyncShutdownComplete() { @@ -508,12 +507,12 @@ RefPtr GeckoMediaPluginServiceParent::LoadFromEnvironment() { mScannedPluginOnDisk = true; return GenericPromise::All(thread, promises) - ->Then( - thread, __func__, - []() { return GenericPromise::CreateAndResolve(true, __func__); }, - []() { - return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); - }); + ->Then(thread, __func__, + []() { return GenericPromise::CreateAndResolve(true, __func__); }, + []() { + return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, + __func__); + }); } class NotifyObserversTask final : public mozilla::Runnable { @@ -613,24 +612,23 @@ RefPtr GeckoMediaPluginServiceParent::AsyncAddPluginDirectory( RefPtr self = this; return InvokeAsync(thread, this, __func__, &GeckoMediaPluginServiceParent::AddOnGMPThread, dir) - ->Then( - mMainThread, __func__, - [dir, self](bool aVal) { - LOGD( - ("GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s " - "succeeded", - NS_ConvertUTF16toUTF8(dir).get())); - MOZ_ASSERT(NS_IsMainThread()); - self->UpdateContentProcessGMPCapabilities(); - return GenericPromise::CreateAndResolve(aVal, __func__); - }, - [dir](nsresult aResult) { - LOGD( - ("GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s " - "failed", - NS_ConvertUTF16toUTF8(dir).get())); - return GenericPromise::CreateAndReject(aResult, __func__); - }); + ->Then(mMainThread, __func__, + [dir, self](bool aVal) { + LOGD( + ("GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s " + "succeeded", + NS_ConvertUTF16toUTF8(dir).get())); + MOZ_ASSERT(NS_IsMainThread()); + self->UpdateContentProcessGMPCapabilities(); + return GenericPromise::CreateAndResolve(aVal, __func__); + }, + [dir](nsresult aResult) { + LOGD( + ("GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s " + "failed", + NS_ConvertUTF16toUTF8(dir).get())); + return GenericPromise::CreateAndReject(aResult, __func__); + }); } NS_IMETHODIMP diff --git a/dom/media/gtest/TestAudioBuffers.cpp b/dom/media/gtest/TestAudioBuffers.cpp index 2de1e646fbd9..fff087cf3e26 100644 --- a/dom/media/gtest/TestAudioBuffers.cpp +++ b/dom/media/gtest/TestAudioBuffers.cpp @@ -42,8 +42,8 @@ void test_for_number_of_channels(const uint32_t channels) { for (uint32_t i = 0; i < samples; i++) { ASSERT_TRUE(fromCallback[i] == 1.0) - << "Difference at " << i << " (" << fromCallback[i] << " != " << 1.0 - << ")\n"; + << "Difference at " << i << " (" << fromCallback[i] << " != " << 1.0 + << ")\n"; } ASSERT_TRUE(b.Fill(other.data(), FRAMES) == 128); @@ -51,8 +51,7 @@ void test_for_number_of_channels(const uint32_t channels) { ASSERT_TRUE(b.Empty(mBuffer) == 0); } -TEST(AudioBuffers, Test) -{ +TEST(AudioBuffers, Test) { for (uint32_t ch = 1; ch <= 8; ++ch) { test_for_number_of_channels(ch); } diff --git a/dom/media/gtest/TestAudioCompactor.cpp b/dom/media/gtest/TestAudioCompactor.cpp index 563b10e9bda8..92b4a5bda400 100644 --- a/dom/media/gtest/TestAudioCompactor.cpp +++ b/dom/media/gtest/TestAudioCompactor.cpp @@ -75,20 +75,15 @@ static void TestAudioCompactor(size_t aBytes) { EXPECT_LE(slop, maxSlop) << "allowed too much allocation slop"; } -TEST(Media, AudioCompactor_4000) -{ TestAudioCompactor(4000); } +TEST(Media, AudioCompactor_4000) { TestAudioCompactor(4000); } -TEST(Media, AudioCompactor_4096) -{ TestAudioCompactor(4096); } +TEST(Media, AudioCompactor_4096) { TestAudioCompactor(4096); } -TEST(Media, AudioCompactor_5000) -{ TestAudioCompactor(5000); } +TEST(Media, AudioCompactor_5000) { TestAudioCompactor(5000); } -TEST(Media, AudioCompactor_5256) -{ TestAudioCompactor(5256); } +TEST(Media, AudioCompactor_5256) { TestAudioCompactor(5256); } -TEST(Media, AudioCompactor_NativeCopy) -{ +TEST(Media, AudioCompactor_NativeCopy) { const uint32_t channels = 2; const size_t srcBytes = 32; const uint32_t srcSamples = srcBytes / sizeof(AudioDataValue); diff --git a/dom/media/gtest/TestAudioDeviceEnumerator.cpp b/dom/media/gtest/TestAudioDeviceEnumerator.cpp index 4a04998a0a14..4b19c418a440 100644 --- a/dom/media/gtest/TestAudioDeviceEnumerator.cpp +++ b/dom/media/gtest/TestAudioDeviceEnumerator.cpp @@ -482,8 +482,7 @@ void AddDevices(MockCubeb* mock, uint32_t device_count, } #ifndef ANDROID -TEST(CubebDeviceEnumerator, EnumerateSimple) -{ +TEST(CubebDeviceEnumerator, EnumerateSimple) { // It looks like we're leaking this object, but in fact it will be freed by // gecko sometime later: `cubeb_destroy` is called when layout statics are // shutdown and we cast back to a MockCubeb* and call the dtor. @@ -519,8 +518,7 @@ TEST(CubebDeviceEnumerator, EnumerateSimple) } #else // building for Android, which has no device enumeration support -TEST(CubebDeviceEnumerator, EnumerateAndroid) -{ +TEST(CubebDeviceEnumerator, EnumerateAndroid) { MockCubeb* mock = new MockCubeb(); mozilla::CubebUtils::ForceSetCubebContext(mock->AsCubebContext()); @@ -549,8 +547,7 @@ TEST(CubebDeviceEnumerator, EnumerateAndroid) } #endif -TEST(CubebDeviceEnumerator, ForceNullCubebContext) -{ +TEST(CubebDeviceEnumerator, ForceNullCubebContext) { mozilla::CubebUtils::ForceSetCubebContext(nullptr); RefPtr enumerator = CubebDeviceEnumerator::GetInstance(); @@ -569,8 +566,7 @@ TEST(CubebDeviceEnumerator, ForceNullCubebContext) CubebDeviceEnumerator::Shutdown(); } -TEST(CubebDeviceEnumerator, DeviceInfoFromId) -{ +TEST(CubebDeviceEnumerator, DeviceInfoFromId) { MockCubeb* mock = new MockCubeb(); mozilla::CubebUtils::ForceSetCubebContext(mock->AsCubebContext()); @@ -608,8 +604,7 @@ TEST(CubebDeviceEnumerator, DeviceInfoFromId) CubebDeviceEnumerator::Shutdown(); } -TEST(CubebDeviceEnumerator, DeviceInfoFromName) -{ +TEST(CubebDeviceEnumerator, DeviceInfoFromName) { MockCubeb* mock = new MockCubeb(); mozilla::CubebUtils::ForceSetCubebContext(mock->AsCubebContext()); diff --git a/dom/media/gtest/TestAudioMixer.cpp b/dom/media/gtest/TestAudioMixer.cpp index 39a1767d05bc..1951681606d1 100644 --- a/dom/media/gtest/TestAudioMixer.cpp +++ b/dom/media/gtest/TestAudioMixer.cpp @@ -70,8 +70,7 @@ void FillBuffer(AudioDataValue* aBuffer, uint32_t aLength, } } -TEST(AudioMixer, Test) -{ +TEST(AudioMixer, Test) { const uint32_t CHANNEL_LENGTH = 256; const uint32_t AUDIO_RATE = 44100; MixerConsumer consumer; diff --git a/dom/media/gtest/TestAudioPacketizer.cpp b/dom/media/gtest/TestAudioPacketizer.cpp index 1fee110d9a0f..805cfd416aef 100644 --- a/dom/media/gtest/TestAudioPacketizer.cpp +++ b/dom/media/gtest/TestAudioPacketizer.cpp @@ -34,7 +34,7 @@ void IsSequence(std::unique_ptr aBuffer, uint32_t aSize, uint32_t aStart = 0) { for (uint32_t i = 0; i < aSize; i++) { ASSERT_TRUE(aBuffer[i] == static_cast(aStart + i)) - << "Buffer is not a sequence at offset " << i << std::endl; + << "Buffer is not a sequence at offset " << i << std::endl; } // Buffer is a sequence. } @@ -42,14 +42,13 @@ void IsSequence(std::unique_ptr aBuffer, uint32_t aSize, void Zero(std::unique_ptr aBuffer, uint32_t aSize) { for (uint32_t i = 0; i < aSize; i++) { ASSERT_TRUE(aBuffer[i] == 0) - << "Buffer is not null at offset " << i << std::endl; + << "Buffer is not null at offset " << i << std::endl; } } double sine(uint32_t aPhase) { return sin(aPhase * 2 * M_PI * 440 / 44100); } -TEST(AudioPacketizer, Test) -{ +TEST(AudioPacketizer, Test) { for (int16_t channels = 1; channels < 2; channels++) { // Test that the packetizer returns zero on underrun { diff --git a/dom/media/gtest/TestAudioSegment.cpp b/dom/media/gtest/TestAudioSegment.cpp index df49ae1e5555..1abb01d187f7 100644 --- a/dom/media/gtest/TestAudioSegment.cpp +++ b/dom/media/gtest/TestAudioSegment.cpp @@ -224,8 +224,7 @@ void TestDownmixStereo() { delete[] output; } -TEST(AudioSegment, Test) -{ +TEST(AudioSegment, Test) { TestInterleaveAndConvert(); TestInterleaveAndConvert(); TestInterleaveAndConvert(); diff --git a/dom/media/gtest/TestAudioTrackEncoder.cpp b/dom/media/gtest/TestAudioTrackEncoder.cpp index a12eac7d68c8..d00479ea51b3 100644 --- a/dom/media/gtest/TestAudioTrackEncoder.cpp +++ b/dom/media/gtest/TestAudioTrackEncoder.cpp @@ -59,8 +59,7 @@ static bool TestOpusInit(int aChannels, int aSamplingRate) { return encoder.TestOpusRawCreation(aChannels, aSamplingRate); } -TEST(OpusAudioTrackEncoder, InitRaw) -{ +TEST(OpusAudioTrackEncoder, InitRaw) { // Expect false with 0 or negative channels of input signal. EXPECT_FALSE(TestOpusInit(0, 16000)); EXPECT_FALSE(TestOpusInit(-1, 16000)); @@ -90,8 +89,7 @@ TEST(OpusAudioTrackEncoder, InitRaw) EXPECT_FALSE(TestOpusInit(2, 200000)); } -TEST(OpusAudioTrackEncoder, Init) -{ +TEST(OpusAudioTrackEncoder, Init) { { // The encoder does not normally recieve enough info from null data to // init. However, multiple attempts to do so, with sufficiently long @@ -177,8 +175,7 @@ static int TestOpusResampler(int aChannels, int aSamplingRate) { return encoder.TestGetOutputSampleRate(); } -TEST(OpusAudioTrackEncoder, Resample) -{ +TEST(OpusAudioTrackEncoder, Resample) { // Sampling rates of data to be fed to Opus encoder, should remain unchanged // if it is one of Opus supported rates (8000, 12000, 16000, 24000 and 48000 // (kHz)) at initialization. @@ -193,8 +190,7 @@ TEST(OpusAudioTrackEncoder, Resample) EXPECT_TRUE(TestOpusResampler(1, 44100) == 48000); } -TEST(OpusAudioTrackEncoder, FetchMetadata) -{ +TEST(OpusAudioTrackEncoder, FetchMetadata) { const int32_t channels = 1; const int32_t sampleRate = 44100; TestOpusTrackEncoder encoder; @@ -208,8 +204,7 @@ TEST(OpusAudioTrackEncoder, FetchMetadata) EXPECT_EQ(sampleRate, opusMeta->mSamplingFrequency); } -TEST(OpusAudioTrackEncoder, FrameEncode) -{ +TEST(OpusAudioTrackEncoder, FrameEncode) { const int32_t channels = 1; const int32_t sampleRate = 44100; TestOpusTrackEncoder encoder; diff --git a/dom/media/gtest/TestBitWriter.cpp b/dom/media/gtest/TestBitWriter.cpp index 1464a11f63b1..a2ef65a6a474 100644 --- a/dom/media/gtest/TestBitWriter.cpp +++ b/dom/media/gtest/TestBitWriter.cpp @@ -10,8 +10,7 @@ using namespace mozilla; -TEST(BitWriter, BitWriter) -{ +TEST(BitWriter, BitWriter) { RefPtr test = new MediaByteBuffer(); BitWriter b(test); b.WriteBit(false); @@ -50,8 +49,7 @@ TEST(BitWriter, BitWriter) EXPECT_EQ(length, BitReader::GetBitLength(test)); } -TEST(BitWriter, SPS) -{ +TEST(BitWriter, SPS) { uint8_t sps_pps[] = {0x01, 0x4d, 0x40, 0x0c, 0xff, 0xe1, 0x00, 0x1b, 0x67, 0x4d, 0x40, 0x0c, 0xe8, 0x80, 0x80, 0x9d, 0x80, 0xb5, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x40, diff --git a/dom/media/gtest/TestBlankVideoDataCreator.cpp b/dom/media/gtest/TestBlankVideoDataCreator.cpp index 94a6213fd1d9..a4b06d1bfbed 100644 --- a/dom/media/gtest/TestBlankVideoDataCreator.cpp +++ b/dom/media/gtest/TestBlankVideoDataCreator.cpp @@ -8,8 +8,7 @@ using namespace mozilla; -TEST(BlankVideoDataCreator, ShouldNotOverflow) -{ +TEST(BlankVideoDataCreator, ShouldNotOverflow) { RefPtr mrd = new MediaRawData(); const uint32_t width = 1; const uint32_t height = 1; @@ -18,8 +17,7 @@ TEST(BlankVideoDataCreator, ShouldNotOverflow) EXPECT_NE(data.get(), nullptr); } -TEST(BlankVideoDataCreator, ShouldOverflow) -{ +TEST(BlankVideoDataCreator, ShouldOverflow) { RefPtr mrd = new MediaRawData(); const uint32_t width = UINT_MAX; const uint32_t height = UINT_MAX; diff --git a/dom/media/gtest/TestBufferReader.cpp b/dom/media/gtest/TestBufferReader.cpp index 47f48781e6b6..23d2a5f24654 100644 --- a/dom/media/gtest/TestBufferReader.cpp +++ b/dom/media/gtest/TestBufferReader.cpp @@ -6,8 +6,7 @@ #include "gtest/gtest.h" #include "BufferReader.h" -TEST(BufferReader, ReaderCursor) -{ +TEST(BufferReader, ReaderCursor) { // Allocate a buffer and create a BufferReader. const size_t BUFFER_SIZE = 10; uint8_t buffer[BUFFER_SIZE] = {0}; diff --git a/dom/media/gtest/TestCDMStorage.cpp b/dom/media/gtest/TestCDMStorage.cpp index 1cdfbe21b6f3..4649e80efc63 100644 --- a/dom/media/gtest/TestCDMStorage.cpp +++ b/dom/media/gtest/TestCDMStorage.cpp @@ -399,26 +399,24 @@ class CDMStorageTest { RefPtr promise = service->GetCDM(aNodeId, std::move(tags), nullptr); auto thread = GetAbstractGMPThread(); - promise->Then( - thread, __func__, - [self, aUpdates, thread](RefPtr cdm) { - self->mCDM = cdm; - EXPECT_TRUE(!!self->mCDM); - self->mCallback.reset(new CallbackProxy(self)); - nsCString failureReason; - self->mCDM - ->Init(self->mCallback.get(), false, true, - GetMainThreadEventTarget()) - ->Then( - thread, __func__, - [self, aUpdates] { - for (auto& update : aUpdates) { - self->Update(update); - } + promise->Then(thread, __func__, + [self, aUpdates, thread](RefPtr cdm) { + self->mCDM = cdm; + EXPECT_TRUE(!!self->mCDM); + self->mCallback.reset(new CallbackProxy(self)); + nsCString failureReason; + self->mCDM + ->Init(self->mCallback.get(), false, true, + GetMainThreadEventTarget()) + ->Then(thread, __func__, + [self, aUpdates] { + for (auto& update : aUpdates) { + self->Update(update); + } + }, + [](MediaResult rv) { EXPECT_TRUE(false); }); }, [](MediaResult rv) { EXPECT_TRUE(false); }); - }, - [](MediaResult rv) { EXPECT_TRUE(false); }); } void TestBasicStorage() { @@ -1030,64 +1028,54 @@ class CDMStorageTest { UniquePtr mCallback; }; // class CDMStorageTest -TEST(GeckoMediaPlugins, CDMStorageGetNodeId) -{ +TEST(GeckoMediaPlugins, CDMStorageGetNodeId) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestGetNodeId); } -TEST(GeckoMediaPlugins, CDMStorageBasic) -{ +TEST(GeckoMediaPlugins, CDMStorageBasic) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestBasicStorage); } -TEST(GeckoMediaPlugins, CDMStorageForgetThisSite) -{ +TEST(GeckoMediaPlugins, CDMStorageForgetThisSite) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestForgetThisSite); } -TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory1) -{ +TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory1) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestClearRecentHistory1); } -TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory2) -{ +TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory2) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestClearRecentHistory2); } -TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory3) -{ +TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory3) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestClearRecentHistory3); } -TEST(GeckoMediaPlugins, CDMStorageCrossOrigin) -{ +TEST(GeckoMediaPlugins, CDMStorageCrossOrigin) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestCrossOriginStorage); } -TEST(GeckoMediaPlugins, CDMStoragePrivateBrowsing) -{ +TEST(GeckoMediaPlugins, CDMStoragePrivateBrowsing) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestPBStorage); } #if defined(XP_WIN) -TEST(GeckoMediaPlugins, GMPOutputProtection) -{ +TEST(GeckoMediaPlugins, GMPOutputProtection) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestOutputProtection); } #endif -TEST(GeckoMediaPlugins, CDMStorageLongRecordNames) -{ +TEST(GeckoMediaPlugins, CDMStorageLongRecordNames) { RefPtr runner = new CDMStorageTest(); runner->DoTest(&CDMStorageTest::TestLongRecordNames); } diff --git a/dom/media/gtest/TestDataMutex.cpp b/dom/media/gtest/TestDataMutex.cpp index f381e2857b7b..245367077333 100644 --- a/dom/media/gtest/TestDataMutex.cpp +++ b/dom/media/gtest/TestDataMutex.cpp @@ -14,8 +14,7 @@ struct A { int mValue; }; -TEST(DataMutex, Basic) -{ +TEST(DataMutex, Basic) { { DataMutex i(1, "1"); auto x = i.Lock(); diff --git a/dom/media/gtest/TestGMPCrossOrigin.cpp b/dom/media/gtest/TestGMPCrossOrigin.cpp index 3688bee1a0d3..2d5940015980 100644 --- a/dom/media/gtest/TestGMPCrossOrigin.cpp +++ b/dom/media/gtest/TestGMPCrossOrigin.cpp @@ -198,16 +198,14 @@ void GMPTestRunner::DoTest( monitor.AwaitFinished(); } -TEST(GeckoMediaPlugins, GMPTestCodec) -{ +TEST(GeckoMediaPlugins, GMPTestCodec) { RefPtr runner = new GMPTestRunner(); runner->DoTest(&GMPTestRunner::RunTestGMPTestCodec1); runner->DoTest(&GMPTestRunner::RunTestGMPTestCodec2); runner->DoTest(&GMPTestRunner::RunTestGMPTestCodec3); } -TEST(GeckoMediaPlugins, GMPCrossOrigin) -{ +TEST(GeckoMediaPlugins, GMPCrossOrigin) { RefPtr runner = new GMPTestRunner(); runner->DoTest(&GMPTestRunner::RunTestGMPCrossOrigin1); runner->DoTest(&GMPTestRunner::RunTestGMPCrossOrigin2); diff --git a/dom/media/gtest/TestGMPRemoveAndDelete.cpp b/dom/media/gtest/TestGMPRemoveAndDelete.cpp index 93049585fff1..af3800da57dc 100644 --- a/dom/media/gtest/TestGMPRemoveAndDelete.cpp +++ b/dom/media/gtest/TestGMPRemoveAndDelete.cpp @@ -105,8 +105,7 @@ class GMPRemoveTest : public nsIObserver, public GMPVideoDecoderCallbackProxy { /* * Simple test that the plugin is deleted when forcibly removed and deleted. */ -TEST(GeckoMediaPlugins, RemoveAndDeleteForcedSimple) -{ +TEST(GeckoMediaPlugins, RemoveAndDeleteForcedSimple) { RefPtr test(new GMPRemoveTest()); test->Setup(); @@ -117,8 +116,7 @@ TEST(GeckoMediaPlugins, RemoveAndDeleteForcedSimple) /* * Simple test that the plugin is deleted when deferred deletion is allowed. */ -TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredSimple) -{ +TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredSimple) { RefPtr test(new GMPRemoveTest()); test->Setup(); @@ -130,8 +128,7 @@ TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredSimple) * Test that the plugin is unavailable immediately after a forced * RemoveAndDelete, and that the plugin is deleted afterwards. */ -TEST(GeckoMediaPlugins, RemoveAndDeleteForcedInUse) -{ +TEST(GeckoMediaPlugins, RemoveAndDeleteForcedInUse) { RefPtr test(new GMPRemoveTest()); test->Setup(); @@ -155,8 +152,7 @@ TEST(GeckoMediaPlugins, RemoveAndDeleteForcedInUse) * Test that the plugin is still usable after a deferred RemoveAndDelete, and * that the plugin is deleted afterwards. */ -TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredInUse) -{ +TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredInUse) { RefPtr test(new GMPRemoveTest()); test->Setup(); diff --git a/dom/media/gtest/TestGMPUtils.cpp b/dom/media/gtest/TestGMPUtils.cpp index 7cd690d3dcf3..22eeff5c4301 100644 --- a/dom/media/gtest/TestGMPUtils.cpp +++ b/dom/media/gtest/TestGMPUtils.cpp @@ -28,8 +28,7 @@ void TestSplitAt(const char* aInput, const char* aDelims, } } -TEST(GeckoMediaPlugins, TestSplitAt) -{ +TEST(GeckoMediaPlugins, TestSplitAt) { { const char* input = "1,2,3,4"; const char* delims = ","; @@ -56,8 +55,7 @@ TEST(GeckoMediaPlugins, TestSplitAt) } } -TEST(GeckoMediaPlugins, ToHexString) -{ +TEST(GeckoMediaPlugins, ToHexString) { struct Test { nsTArray bytes; string hex; diff --git a/dom/media/gtest/TestGroupId.cpp b/dom/media/gtest/TestGroupId.cpp index 621445d6f368..bf368fdc92c7 100644 --- a/dom/media/gtest/TestGroupId.cpp +++ b/dom/media/gtest/TestGroupId.cpp @@ -90,8 +90,7 @@ RefPtr MakeSpeakerDevice(const nsString& aName, /* Verify that when an audio input device name contains the video input device * name the video device group id is updated to become equal to the audio * device group id. */ -TEST(TestGroupId, MatchInput_PartOfName) -{ +TEST(TestGroupId, MatchInput_PartOfName) { MediaManager::MediaDeviceSet devices; devices.AppendElement( @@ -111,8 +110,7 @@ TEST(TestGroupId, MatchInput_PartOfName) /* Verify that when an audio input device name is the same as the video input * device name the video device group id is updated to become equal to the audio * device group id. */ -TEST(TestGroupId, MatchInput_FullName) -{ +TEST(TestGroupId, MatchInput_FullName) { MediaManager::MediaDeviceSet devices; devices.AppendElement( @@ -130,8 +128,7 @@ TEST(TestGroupId, MatchInput_FullName) /* Verify that when an audio input device name does not contain the video input * device name the video device group id does not change. */ -TEST(TestGroupId, NoMatchInput) -{ +TEST(TestGroupId, NoMatchInput) { MediaManager::MediaDeviceSet devices; nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId"); @@ -152,8 +149,7 @@ TEST(TestGroupId, NoMatchInput) /* Verify that when more that one audio input and more than one audio output * device name contain the video input device name the video device group id * does not change. */ -TEST(TestGroupId, NoMatch_TwoIdenticalDevices) -{ +TEST(TestGroupId, NoMatch_TwoIdenticalDevices) { MediaManager::MediaDeviceSet devices; nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId"); @@ -188,8 +184,7 @@ TEST(TestGroupId, NoMatch_TwoIdenticalDevices) * input device name the video device group id is not updated by audio input * device group id but it continues looking at audio output devices where it * finds a match so video input group id is updated by audio output group id. */ -TEST(TestGroupId, Match_TwoIdenticalInputsMatchOutput) -{ +TEST(TestGroupId, Match_TwoIdenticalInputsMatchOutput) { MediaManager::MediaDeviceSet devices; nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId"); @@ -216,8 +211,7 @@ TEST(TestGroupId, Match_TwoIdenticalInputsMatchOutput) /* Verify that when more that one audio input and more than one audio output * device names contain the video input device name the video device group id * does not change. */ -TEST(TestGroupId, NoMatch_ThreeIdenticalDevices) -{ +TEST(TestGroupId, NoMatch_ThreeIdenticalDevices) { MediaManager::MediaDeviceSet devices; nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId"); @@ -257,8 +251,7 @@ TEST(TestGroupId, NoMatch_ThreeIdenticalDevices) /* Verify that when an audio output device name contains the video input device * name the video device group id is updated to become equal to the audio * device group id. */ -TEST(TestGroupId, MatchOutput) -{ +TEST(TestGroupId, MatchOutput) { MediaManager::MediaDeviceSet devices; devices.AppendElement( @@ -281,8 +274,7 @@ TEST(TestGroupId, MatchOutput) /* Verify that when an audio input device name is the same as audio output * device and video input device name the video device group id is updated to * become equal to the audio input device group id. */ -TEST(TestGroupId, InputOutputSameName) -{ +TEST(TestGroupId, InputOutputSameName) { MediaManager::MediaDeviceSet devices; devices.AppendElement( @@ -305,8 +297,7 @@ TEST(TestGroupId, InputOutputSameName) /* Verify that when an audio input device name contains the video input device * and the audio input group id is an empty string, the video device group id * is updated to become equal to the audio device group id. */ -TEST(TestGroupId, InputEmptyGroupId) -{ +TEST(TestGroupId, InputEmptyGroupId) { MediaManager::MediaDeviceSet devices; devices.AppendElement( @@ -325,8 +316,7 @@ TEST(TestGroupId, InputEmptyGroupId) /* Verify that when an audio output device name contains the video input device * and the audio output group id is an empty string, the video device group id * is updated to become equal to the audio output device group id. */ -TEST(TestGroupId, OutputEmptyGroupId) -{ +TEST(TestGroupId, OutputEmptyGroupId) { MediaManager::MediaDeviceSet devices; devices.AppendElement( diff --git a/dom/media/gtest/TestIntervalSet.cpp b/dom/media/gtest/TestIntervalSet.cpp index 3fdeab0d9986..a5462ba86b8d 100644 --- a/dom/media/gtest/TestIntervalSet.cpp +++ b/dom/media/gtest/TestIntervalSet.cpp @@ -28,8 +28,7 @@ media::IntervalSet CreateByteIntervalSet(int32_t aStart, return test; } -TEST(IntervalSet, Constructors) -{ +TEST(IntervalSet, Constructors) { const int32_t start = 1; const int32_t end = 2; const int32_t fuzz = 0; @@ -74,8 +73,7 @@ media::TimeIntervals CreateTimeIntervals(int32_t aStart, int32_t aEnd) { return test; } -TEST(IntervalSet, TimeIntervalsConstructors) -{ +TEST(IntervalSet, TimeIntervalsConstructors) { const auto start = media::TimeUnit::FromMicroseconds(1); const auto end = media::TimeUnit::FromMicroseconds(2); const media::TimeUnit fuzz; @@ -110,14 +108,12 @@ TEST(IntervalSet, TimeIntervalsConstructors) EXPECT_EQ(0u, i0.Length()); // Constructing with an empty time interval. } -TEST(IntervalSet, Length) -{ +TEST(IntervalSet, Length) { IntInterval i(15, 25); EXPECT_EQ(10, i.Length()); } -TEST(IntervalSet, Intersects) -{ +TEST(IntervalSet, Intersects) { EXPECT_TRUE(IntInterval(1, 5).Intersects(IntInterval(3, 4))); EXPECT_TRUE(IntInterval(1, 5).Intersects(IntInterval(3, 7))); EXPECT_TRUE(IntInterval(1, 5).Intersects(IntInterval(-1, 3))); @@ -133,8 +129,7 @@ TEST(IntervalSet, Intersects) EXPECT_FALSE(IntInterval(1, 1).Intersects(IntInterval(2, 2))); } -TEST(IntervalSet, Intersection) -{ +TEST(IntervalSet, Intersection) { IntInterval i0(10, 20); IntInterval i1(15, 25); IntInterval i = i0.Intersection(i1); @@ -150,8 +145,7 @@ TEST(IntervalSet, Intersection) EXPECT_TRUE(k.IsEmpty()); } -TEST(IntervalSet, Equals) -{ +TEST(IntervalSet, Equals) { IntInterval i0(10, 20); IntInterval i1(10, 20); EXPECT_EQ(i0, i1); @@ -163,8 +157,7 @@ TEST(IntervalSet, Equals) EXPECT_NE(i0, i2); } -TEST(IntervalSet, IntersectionIntervalSet) -{ +TEST(IntervalSet, IntersectionIntervalSet) { IntIntervals i0; i0 += IntInterval(5, 10); i0 += IntInterval(20, 25); @@ -239,8 +232,7 @@ static void GeneratePermutations(const IntIntervals& aI1, } while (std::next_permutation(comb1.begin(), comb1.end())); } -TEST(IntervalSet, IntersectionNormalizedIntervalSet) -{ +TEST(IntervalSet, IntersectionNormalizedIntervalSet) { IntIntervals i0; i0 += IntInterval(5, 10); i0 += IntInterval(20, 25); @@ -255,8 +247,7 @@ TEST(IntervalSet, IntersectionNormalizedIntervalSet) GeneratePermutations(i0, i1); } -TEST(IntervalSet, IntersectionUnorderedNonNormalizedIntervalSet) -{ +TEST(IntervalSet, IntersectionUnorderedNonNormalizedIntervalSet) { IntIntervals i0; i0 += IntInterval(5, 10); i0 += IntInterval(8, 25); @@ -271,8 +262,7 @@ TEST(IntervalSet, IntersectionUnorderedNonNormalizedIntervalSet) GeneratePermutations(i0, i1); } -TEST(IntervalSet, IntersectionNonNormalizedInterval) -{ +TEST(IntervalSet, IntersectionNonNormalizedInterval) { IntIntervals i0; i0 += IntInterval(5, 10); i0 += IntInterval(8, 25); @@ -285,8 +275,7 @@ TEST(IntervalSet, IntersectionNonNormalizedInterval) EXPECT_EQ(i0[0].mEnd, i1.mEnd); } -TEST(IntervalSet, IntersectionUnorderedNonNormalizedInterval) -{ +TEST(IntervalSet, IntersectionUnorderedNonNormalizedInterval) { IntIntervals i0; i0 += IntInterval(1, 3); i0 += IntInterval(1, 10); @@ -309,8 +298,7 @@ static IntIntervals Duplicate(const IntIntervals& aValue) { return value; } -TEST(IntervalSet, Normalize) -{ +TEST(IntervalSet, Normalize) { IntIntervals i; // Test IntervalSet + Interval operator. i = i + IntInterval(20, 30); @@ -344,8 +332,7 @@ TEST(IntervalSet, Normalize) EXPECT_EQ(1u, ti.Length()); } -TEST(IntervalSet, ContainValue) -{ +TEST(IntervalSet, ContainValue) { IntIntervals i0; i0 += IntInterval(0, 10); i0 += IntInterval(15, 20); @@ -356,8 +343,7 @@ TEST(IntervalSet, ContainValue) EXPECT_FALSE(i0.Contains(25)); } -TEST(IntervalSet, ContainValueWithFuzz) -{ +TEST(IntervalSet, ContainValueWithFuzz) { IntIntervals i0; i0 += IntInterval(0, 10); i0 += IntInterval(15, 20, 1); @@ -369,8 +355,7 @@ TEST(IntervalSet, ContainValueWithFuzz) EXPECT_FALSE(i0.Contains(25)); } -TEST(IntervalSet, ContainInterval) -{ +TEST(IntervalSet, ContainInterval) { IntIntervals i0; i0 += IntInterval(0, 10); i0 += IntInterval(15, 20); @@ -385,8 +370,7 @@ TEST(IntervalSet, ContainInterval) EXPECT_FALSE(i0.Contains(IntInterval(30, 55))); } -TEST(IntervalSet, ContainIntervalWithFuzz) -{ +TEST(IntervalSet, ContainIntervalWithFuzz) { IntIntervals i0; i0 += IntInterval(0, 10); i0 += IntInterval(15, 20); @@ -410,8 +394,7 @@ TEST(IntervalSet, ContainIntervalWithFuzz) EXPECT_TRUE(i1.Contains(IntInterval(15, 21))); } -TEST(IntervalSet, Span) -{ +TEST(IntervalSet, Span) { IntInterval i0(0, 10); IntInterval i1(20, 30); IntInterval i{i0.Span(i1)}; @@ -420,8 +403,7 @@ TEST(IntervalSet, Span) EXPECT_EQ(i.mEnd, 30); } -TEST(IntervalSet, Union) -{ +TEST(IntervalSet, Union) { IntIntervals i0; i0 += IntInterval(5, 10); i0 += IntInterval(20, 25); @@ -447,8 +429,7 @@ TEST(IntervalSet, Union) EXPECT_EQ(60, i[2].mEnd); } -TEST(IntervalSet, UnionNotOrdered) -{ +TEST(IntervalSet, UnionNotOrdered) { IntIntervals i0; i0 += IntInterval(20, 25); i0 += IntInterval(40, 60); @@ -474,8 +455,7 @@ TEST(IntervalSet, UnionNotOrdered) EXPECT_EQ(60, i[2].mEnd); } -TEST(IntervalSet, NormalizeFuzz) -{ +TEST(IntervalSet, NormalizeFuzz) { IntIntervals i0; i0 += IntInterval(11, 25, 0); i0 += IntInterval(5, 10, 1); @@ -490,8 +470,7 @@ TEST(IntervalSet, NormalizeFuzz) EXPECT_EQ(60, i0[1].mEnd); } -TEST(IntervalSet, UnionFuzz) -{ +TEST(IntervalSet, UnionFuzz) { IntIntervals i0; i0 += IntInterval(5, 10, 1); i0 += IntInterval(11, 25, 0); @@ -526,16 +505,14 @@ TEST(IntervalSet, UnionFuzz) EXPECT_EQ(60, i[1].mEnd); } -TEST(IntervalSet, Contiguous) -{ +TEST(IntervalSet, Contiguous) { EXPECT_FALSE(IntInterval(5, 10).Contiguous(IntInterval(11, 25))); EXPECT_TRUE(IntInterval(5, 10).Contiguous(IntInterval(10, 25))); EXPECT_TRUE(IntInterval(5, 10, 1).Contiguous(IntInterval(11, 25))); EXPECT_TRUE(IntInterval(5, 10).Contiguous(IntInterval(11, 25, 1))); } -TEST(IntervalSet, TimeRangesSeconds) -{ +TEST(IntervalSet, TimeRangesSeconds) { media::TimeIntervals i0; i0 += media::TimeInterval(media::TimeUnit::FromSeconds(20), media::TimeUnit::FromSeconds(25)); @@ -580,8 +557,7 @@ static void CheckTimeRanges(dom::TimeRanges* aTr, } } -TEST(IntervalSet, TimeRangesConversion) -{ +TEST(IntervalSet, TimeRangesConversion) { RefPtr tr = new dom::TimeRanges(); tr->Add(20, 25); tr->Add(40, 60); @@ -599,8 +575,7 @@ TEST(IntervalSet, TimeRangesConversion) CheckTimeRanges(tr2, i1); } -TEST(IntervalSet, TimeRangesMicroseconds) -{ +TEST(IntervalSet, TimeRangesMicroseconds) { media::TimeIntervals i0; i0 += media::TimeInterval(media::TimeUnit::FromMicroseconds(20), @@ -686,8 +661,7 @@ class Foo { int32_t mArg3; }; -TEST(IntervalSet, FooIntervalSet) -{ +TEST(IntervalSet, FooIntervalSet) { media::Interval> i(Foo(), Foo(4, 5, 6)); media::IntervalSet> is; is += i; @@ -700,8 +674,7 @@ TEST(IntervalSet, FooIntervalSet) EXPECT_EQ(Foo(4, 5, 6), is[0].mEnd); } -TEST(IntervalSet, StaticAssert) -{ +TEST(IntervalSet, StaticAssert) { media::Interval i; static_assert( @@ -714,8 +687,7 @@ TEST(IntervalSet, StaticAssert) "Must use copy constructor"); } -TEST(IntervalSet, Substraction) -{ +TEST(IntervalSet, Substraction) { IntIntervals i0; i0 += IntInterval(5, 10); i0 += IntInterval(20, 25); diff --git a/dom/media/gtest/TestMP4Demuxer.cpp b/dom/media/gtest/TestMP4Demuxer.cpp index 86f584f85bf6..f676c7a97799 100644 --- a/dom/media/gtest/TestMP4Demuxer.cpp +++ b/dom/media/gtest/TestMP4Demuxer.cpp @@ -146,24 +146,22 @@ class MP4DemuxerBinding { virtual ~MP4DemuxerBinding() {} }; -TEST(MP4Demuxer, Seek) -{ +TEST(MP4Demuxer, Seek) { RefPtr binding = new MP4DemuxerBinding(); binding->RunTestAndWait([binding]() { binding->mVideoTrack = binding->mDemuxer->GetTrackDemuxer(TrackInfo::kVideoTrack, 0); binding->CheckTrackSamples(binding->mVideoTrack) - ->Then( - binding->mTaskQueue, __func__, - [binding]() { - binding->CheckTrackKeyFrame(binding->mVideoTrack) - ->Then( - binding->mTaskQueue, __func__, - [binding]() { binding->mTaskQueue->BeginShutdown(); }, - DO_FAIL); - }, - DO_FAIL); + ->Then(binding->mTaskQueue, __func__, + [binding]() { + binding->CheckTrackKeyFrame(binding->mVideoTrack) + ->Then( + binding->mTaskQueue, __func__, + [binding]() { binding->mTaskQueue->BeginShutdown(); }, + DO_FAIL); + }, + DO_FAIL); }); } @@ -189,8 +187,7 @@ static nsCString ToCryptoString(const CryptoSample& aCrypto) { return res; } -TEST(MP4Demuxer, CENCFragVideo) -{ +TEST(MP4Demuxer, CENCFragVideo) { const char* video[] = { "16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000000 " "5,684 5,16980", @@ -321,22 +318,21 @@ TEST(MP4Demuxer, CENCFragVideo) binding->mVideoTrack = binding->mDemuxer->GetTrackDemuxer(TrackInfo::kVideoTrack, 0); binding->CheckTrackSamples(binding->mVideoTrack) - ->Then( - binding->mTaskQueue, __func__, - [binding, video]() { - for (uint32_t i = 0; i < binding->mSamples.Length(); i++) { - nsCString text = ToCryptoString(binding->mSamples[i]->mCrypto); - EXPECT_STREQ(video[i++], text.get()); - } - EXPECT_EQ(ArrayLength(video), binding->mSamples.Length()); - binding->mTaskQueue->BeginShutdown(); - }, - DO_FAIL); + ->Then(binding->mTaskQueue, __func__, + [binding, video]() { + for (uint32_t i = 0; i < binding->mSamples.Length(); i++) { + nsCString text = + ToCryptoString(binding->mSamples[i]->mCrypto); + EXPECT_STREQ(video[i++], text.get()); + } + EXPECT_EQ(ArrayLength(video), binding->mSamples.Length()); + binding->mTaskQueue->BeginShutdown(); + }, + DO_FAIL); }); } -TEST(MP4Demuxer, CENCFragAudio) -{ +TEST(MP4Demuxer, CENCFragAudio) { const char* audio[] = { "16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000000 " "0,281", @@ -535,23 +531,22 @@ TEST(MP4Demuxer, CENCFragAudio) binding->mAudioTrack = binding->mDemuxer->GetTrackDemuxer(TrackInfo::kAudioTrack, 0); binding->CheckTrackSamples(binding->mAudioTrack) - ->Then( - binding->mTaskQueue, __func__, - [binding, audio]() { - EXPECT_TRUE(binding->mSamples.Length() > 1); - for (uint32_t i = 0; i < binding->mSamples.Length(); i++) { - nsCString text = ToCryptoString(binding->mSamples[i]->mCrypto); - EXPECT_STREQ(audio[i++], text.get()); - } - EXPECT_EQ(ArrayLength(audio), binding->mSamples.Length()); - binding->mTaskQueue->BeginShutdown(); - }, - DO_FAIL); + ->Then(binding->mTaskQueue, __func__, + [binding, audio]() { + EXPECT_TRUE(binding->mSamples.Length() > 1); + for (uint32_t i = 0; i < binding->mSamples.Length(); i++) { + nsCString text = + ToCryptoString(binding->mSamples[i]->mCrypto); + EXPECT_STREQ(audio[i++], text.get()); + } + EXPECT_EQ(ArrayLength(audio), binding->mSamples.Length()); + binding->mTaskQueue->BeginShutdown(); + }, + DO_FAIL); }); } -TEST(MP4Demuxer, GetNextKeyframe) -{ +TEST(MP4Demuxer, GetNextKeyframe) { RefPtr binding = new MP4DemuxerBinding("gizmo-frag.mp4"); binding->RunTestAndWait([binding]() { @@ -580,8 +575,7 @@ TEST(MP4Demuxer, GetNextKeyframe) }); } -TEST(MP4Demuxer, ZeroInLastMoov) -{ +TEST(MP4Demuxer, ZeroInLastMoov) { RefPtr binding = new MP4DemuxerBinding("short-zero-in-moov.mp4"); binding->RunTestAndWait([binding]() { @@ -590,8 +584,7 @@ TEST(MP4Demuxer, ZeroInLastMoov) }); } -TEST(MP4Demuxer, ZeroInMoovQuickTime) -{ +TEST(MP4Demuxer, ZeroInMoovQuickTime) { RefPtr binding = new MP4DemuxerBinding("short-zero-inband.mov"); binding->RunTestAndWait([binding]() { @@ -600,8 +593,7 @@ TEST(MP4Demuxer, ZeroInMoovQuickTime) }); } -TEST(MP4Demuxer, IgnoreMinus1Duration) -{ +TEST(MP4Demuxer, IgnoreMinus1Duration) { RefPtr binding = new MP4DemuxerBinding("negative_duration.mp4"); binding->RunTestAndWait([binding]() { diff --git a/dom/media/gtest/TestMediaDataDecoder.cpp b/dom/media/gtest/TestMediaDataDecoder.cpp index f95adeefb738..199d0f77626c 100644 --- a/dom/media/gtest/TestMediaDataDecoder.cpp +++ b/dom/media/gtest/TestMediaDataDecoder.cpp @@ -44,8 +44,7 @@ class BenchmarkRunner { RefPtr mBenchmark; }; -TEST(MediaDataDecoder, H264) -{ +TEST(MediaDataDecoder, H264) { if (!DecoderTraits::IsMP4SupportedType( MediaContainerType(MEDIAMIMETYPE(VIDEO_MP4)), /* DecoderDoctorDiagnostics* */ nullptr)) { @@ -60,8 +59,7 @@ TEST(MediaDataDecoder, H264) } } -TEST(MediaDataDecoder, VP9) -{ +TEST(MediaDataDecoder, VP9) { if (!WebMDecoder::IsSupportedType( MediaContainerType(MEDIAMIMETYPE(VIDEO_WEBM)))) { EXPECT_TRUE(true); diff --git a/dom/media/gtest/TestMediaDataEncoder.cpp b/dom/media/gtest/TestMediaDataEncoder.cpp index 1d5e787ee991..4fcf7e869f89 100644 --- a/dom/media/gtest/TestMediaDataEncoder.cpp +++ b/dom/media/gtest/TestMediaDataEncoder.cpp @@ -85,16 +85,15 @@ void WaitForShutdown(RefPtr aEncoder) { Maybe result; // media::Await() supports exclusive promises only, but ShutdownPromise is // not. - aEncoder->Shutdown()->Then( - AbstractThread::MainThread(), __func__, - [&result](bool rv) { - EXPECT_TRUE(rv); - result = Some(true); - }, - [&result]() { - FAIL() << "Shutdown should never be rejected"; - result = Some(false); - }); + aEncoder->Shutdown()->Then(AbstractThread::MainThread(), __func__, + [&result](bool rv) { + EXPECT_TRUE(rv); + result = Some(true); + }, + [&result]() { + FAIL() << "Shutdown should never be rejected"; + result = Some(false); + }); SpinEventLoopUntil([&result]() { return result; }); } @@ -116,13 +115,12 @@ static bool EnsureInit(RefPtr aEncoder) { } bool succeeded; - media::Await( - GetMediaThreadPool(MediaThreadType::PLAYBACK), aEncoder->Init(), - [&succeeded](TrackInfo::TrackType t) { - EXPECT_EQ(TrackInfo::TrackType::kVideoTrack, t); - succeeded = true; - }, - [&succeeded](MediaResult r) { succeeded = false; }); + media::Await(GetMediaThreadPool(MediaThreadType::PLAYBACK), aEncoder->Init(), + [&succeeded](TrackInfo::TrackType t) { + EXPECT_EQ(TrackInfo::TrackType::kVideoTrack, t); + succeeded = true; + }, + [&succeeded](MediaResult r) { succeeded = false; }); return succeeded; } @@ -151,13 +149,13 @@ static MediaDataEncoder::EncodedData Encode( kImageSize, 0, TimeUnit::FromMicroseconds(i * 30000), TimeUnit::FromMicroseconds(30000), img, (i & 0xF) == 0, TimeUnit::FromMicroseconds(i * 30000)); - media::Await( - GetMediaThreadPool(MediaThreadType::PLAYBACK), aEncoder->Encode(frame), - [&output, &succeeded](MediaDataEncoder::EncodedData encoded) { - output.AppendElements(std::move(encoded)); - succeeded = true; - }, - [&succeeded](MediaResult r) { succeeded = false; }); + media::Await(GetMediaThreadPool(MediaThreadType::PLAYBACK), + aEncoder->Encode(frame), + [&output, &succeeded](MediaDataEncoder::EncodedData encoded) { + output.AppendElements(std::move(encoded)); + succeeded = true; + }, + [&succeeded](MediaResult r) { succeeded = false; }); EXPECT_TRUE(succeeded); if (!succeeded) { return output; @@ -179,13 +177,13 @@ static MediaDataEncoder::EncodedData Encode( } if (pending > 0) { - media::Await( - GetMediaThreadPool(MediaThreadType::PLAYBACK), aEncoder->Drain(), - [&succeeded](MediaDataEncoder::EncodedData encoded) { - EXPECT_EQ(encoded.Length(), 0UL); - succeeded = true; - }, - [&succeeded](MediaResult r) { succeeded = false; }); + media::Await(GetMediaThreadPool(MediaThreadType::PLAYBACK), + aEncoder->Drain(), + [&succeeded](MediaDataEncoder::EncodedData encoded) { + EXPECT_EQ(encoded.Length(), 0UL); + succeeded = true; + }, + [&succeeded](MediaResult r) { succeeded = false; }); EXPECT_TRUE(succeeded); } diff --git a/dom/media/gtest/TestMediaEventSource.cpp b/dom/media/gtest/TestMediaEventSource.cpp index 6d6e51fd4778..607ed84e5d47 100644 --- a/dom/media/gtest/TestMediaEventSource.cpp +++ b/dom/media/gtest/TestMediaEventSource.cpp @@ -16,8 +16,7 @@ using namespace mozilla; /* * Test if listeners receive the event data correctly. */ -TEST(MediaEventSource, SingleListener) -{ +TEST(MediaEventSource, SingleListener) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -40,8 +39,7 @@ TEST(MediaEventSource, SingleListener) listener.Disconnect(); } -TEST(MediaEventSource, MultiListener) -{ +TEST(MediaEventSource, MultiListener) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -71,8 +69,7 @@ TEST(MediaEventSource, MultiListener) /* * Test if disconnecting a listener prevents events from coming. */ -TEST(MediaEventSource, DisconnectAfterNotification) -{ +TEST(MediaEventSource, DisconnectAfterNotification) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -98,8 +95,7 @@ TEST(MediaEventSource, DisconnectAfterNotification) EXPECT_EQ(i, 11); } -TEST(MediaEventSource, DisconnectBeforeNotification) -{ +TEST(MediaEventSource, DisconnectBeforeNotification) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -130,8 +126,7 @@ TEST(MediaEventSource, DisconnectBeforeNotification) * Test we don't hit the assertion when calling Connect() and Disconnect() * repeatedly. */ -TEST(MediaEventSource, DisconnectAndConnect) -{ +TEST(MediaEventSource, DisconnectAndConnect) { RefPtr queue; MediaEventProducerExc source; MediaEventListener listener = source.Connect(queue, []() {}); @@ -143,8 +138,7 @@ TEST(MediaEventSource, DisconnectAndConnect) /* * Test void event type. */ -TEST(MediaEventSource, VoidEventType) -{ +TEST(MediaEventSource, VoidEventType) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -180,8 +174,7 @@ TEST(MediaEventSource, VoidEventType) /* * Test listeners can take various event types (T, T&&, const T& and void). */ -TEST(MediaEventSource, ListenerType1) -{ +TEST(MediaEventSource, ListenerType1) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -208,8 +201,7 @@ TEST(MediaEventSource, ListenerType1) listener3.Disconnect(); } -TEST(MediaEventSource, ListenerType2) -{ +TEST(MediaEventSource, ListenerType2) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -258,8 +250,7 @@ struct SomeEvent { /* * Test we don't have unnecessary copies of the event data. */ -TEST(MediaEventSource, CopyEvent1) -{ +TEST(MediaEventSource, CopyEvent1) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -285,8 +276,7 @@ TEST(MediaEventSource, CopyEvent1) listener2.Disconnect(); } -TEST(MediaEventSource, CopyEvent2) -{ +TEST(MediaEventSource, CopyEvent2) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -314,8 +304,7 @@ TEST(MediaEventSource, CopyEvent2) /* * Test move-only types. */ -TEST(MediaEventSource, MoveOnly) -{ +TEST(MediaEventSource, MoveOnly) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -348,8 +337,7 @@ struct RefCounter { * Test we should copy instead of move in NonExclusive mode * for each listener must get a copy. */ -TEST(MediaEventSource, NoMove) -{ +TEST(MediaEventSource, NoMove) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); @@ -373,8 +361,7 @@ TEST(MediaEventSource, NoMove) /* * Rvalue lambda should be moved instead of copied. */ -TEST(MediaEventSource, MoveLambda) -{ +TEST(MediaEventSource, MoveLambda) { RefPtr queue; MediaEventProducer source; diff --git a/dom/media/gtest/TestMediaMIMETypes.cpp b/dom/media/gtest/TestMediaMIMETypes.cpp index e41be22f317e..33f38d38e229 100644 --- a/dom/media/gtest/TestMediaMIMETypes.cpp +++ b/dom/media/gtest/TestMediaMIMETypes.cpp @@ -9,8 +9,7 @@ using namespace mozilla; -TEST(MediaMIMETypes, DependentMIMEType) -{ +TEST(MediaMIMETypes, DependentMIMEType) { static const struct { const char* mString; DependentMediaMIMEType mDependentMediaMIMEType; @@ -28,8 +27,7 @@ TEST(MediaMIMETypes, DependentMIMEType) } } -TEST(MediaMIMETypes, MakeMediaMIMEType_bad) -{ +TEST(MediaMIMETypes, MakeMediaMIMEType_bad) { static const char* tests[] = {"", " ", "/", "audio", "audio/", "mp4", "/mp4", "a/b"}; @@ -40,8 +38,7 @@ TEST(MediaMIMETypes, MakeMediaMIMEType_bad) } } -TEST(MediaMIMETypes, MediaMIMEType) -{ +TEST(MediaMIMETypes, MediaMIMEType) { static const struct { const char* mTypeString; const char* mAsString; @@ -81,8 +78,7 @@ TEST(MediaMIMETypes, MediaMIMEType) } } -TEST(MediaMIMETypes, MediaCodecs) -{ +TEST(MediaMIMETypes, MediaCodecs) { MediaCodecs empty(""); EXPECT_TRUE(empty.IsEmpty()); EXPECT_TRUE(empty.AsString().EqualsLiteral("")); @@ -156,8 +152,7 @@ TEST(MediaMIMETypes, MediaCodecs) EXPECT_FALSE(one.ContainsAll(two)); } -TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad) -{ +TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad) { static const char* tests[] = {"", " ", "/", "audio", "audio/", "mp4", "/mp4", "a/b"}; @@ -168,8 +163,7 @@ TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad) } } -TEST(MediaMIMETypes, MediaExtendedMIMEType) -{ +TEST(MediaMIMETypes, MediaExtendedMIMEType) { // Some generic tests first. static const struct { const char* mTypeString; diff --git a/dom/media/gtest/TestOpusParser.cpp b/dom/media/gtest/TestOpusParser.cpp index 7dc0303546c4..c1817bddff66 100644 --- a/dom/media/gtest/TestOpusParser.cpp +++ b/dom/media/gtest/TestOpusParser.cpp @@ -7,8 +7,7 @@ #include "OpusParser.h" #include -TEST(OpusParser, Mapping2) -{ +TEST(OpusParser, Mapping2) { uint8_t validChannels[] = {1, 3, 4, 6, 9, 11, 16, 18, 25, 27, 36, 38, 49, 51, 64, 66, 81, 83, 100, 102, 121, 123, 144, 146, 169, 171, 196, 198, 225, 227}; diff --git a/dom/media/gtest/TestRust.cpp b/dom/media/gtest/TestRust.cpp index 059500767fd7..86d0e99b86c4 100644 --- a/dom/media/gtest/TestRust.cpp +++ b/dom/media/gtest/TestRust.cpp @@ -3,8 +3,7 @@ extern "C" uint8_t* test_rust(); -TEST(rust, CallFromCpp) -{ +TEST(rust, CallFromCpp) { auto greeting = test_rust(); EXPECT_STREQ(reinterpret_cast(greeting), "hello from rust."); } diff --git a/dom/media/gtest/TestTimeUnit.cpp b/dom/media/gtest/TestTimeUnit.cpp index 605e0e90c902..a974a111993f 100644 --- a/dom/media/gtest/TestTimeUnit.cpp +++ b/dom/media/gtest/TestTimeUnit.cpp @@ -10,8 +10,7 @@ using namespace mozilla; -TEST(TimeUnit, Rounding) -{ +TEST(TimeUnit, Rounding) { int64_t usecs = 66261715; double seconds = media::TimeUnit::FromMicroseconds(usecs).ToSeconds(); EXPECT_EQ(media::TimeUnit::FromSeconds(seconds).ToMicroseconds(), usecs); diff --git a/dom/media/gtest/TestVPXDecoding.cpp b/dom/media/gtest/TestVPXDecoding.cpp index d58ca24cc712..2c7292cfab0b 100644 --- a/dom/media/gtest/TestVPXDecoding.cpp +++ b/dom/media/gtest/TestVPXDecoding.cpp @@ -69,8 +69,7 @@ static const TestFileData testFiles[] = { {"test_case_1224363.vp8.ivf", VPX_CODEC_CORRUPT_FRAME}, {"test_case_1224369.vp8.ivf", VPX_CODEC_CORRUPT_FRAME}}; -TEST(libvpx, test_cases) -{ +TEST(libvpx, test_cases) { for (size_t test = 0; test < ArrayLength(testFiles); ++test) { nsTArray data; ReadVPXFile(testFiles[test].mFilename, data); diff --git a/dom/media/gtest/TestVideoSegment.cpp b/dom/media/gtest/TestVideoSegment.cpp index 4bc432d01b37..8f8bb9c8dc55 100644 --- a/dom/media/gtest/TestVideoSegment.cpp +++ b/dom/media/gtest/TestVideoSegment.cpp @@ -13,8 +13,7 @@ class Image; } // namespace layer } // namespace mozilla -TEST(VideoSegment, TestAppendFrameForceBlack) -{ +TEST(VideoSegment, TestAppendFrameForceBlack) { RefPtr testImage = nullptr; VideoSegment segment; @@ -29,8 +28,7 @@ TEST(VideoSegment, TestAppendFrameForceBlack) } } -TEST(VideoSegment, TestAppendFrameNotForceBlack) -{ +TEST(VideoSegment, TestAppendFrameNotForceBlack) { RefPtr testImage = nullptr; VideoSegment segment; diff --git a/dom/media/gtest/TestVideoTrackEncoder.cpp b/dom/media/gtest/TestVideoTrackEncoder.cpp index f04110a023aa..757184beaf69 100644 --- a/dom/media/gtest/TestVideoTrackEncoder.cpp +++ b/dom/media/gtest/TestVideoTrackEncoder.cpp @@ -69,8 +69,7 @@ class TestVP8TrackEncoder : public VP8TrackEncoder { }; // Init test -TEST(VP8VideoTrackEncoder, Initialization) -{ +TEST(VP8VideoTrackEncoder, Initialization) { InitParam params[] = { // Failure cases. {false, 0, 0}, // Height/ width should be larger than 1. @@ -91,8 +90,7 @@ TEST(VP8VideoTrackEncoder, Initialization) } // Get MetaData test -TEST(VP8VideoTrackEncoder, FetchMetaData) -{ +TEST(VP8VideoTrackEncoder, FetchMetaData) { InitParam params[] = { // Success cases {true, 640, 480}, // Standard VGA @@ -115,8 +113,7 @@ TEST(VP8VideoTrackEncoder, FetchMetaData) } // Encode test -TEST(VP8VideoTrackEncoder, FrameEncode) -{ +TEST(VP8VideoTrackEncoder, FrameEncode) { TestVP8TrackEncoder encoder; TimeStamp now = TimeStamp::Now(); @@ -148,8 +145,7 @@ TEST(VP8VideoTrackEncoder, FrameEncode) } // Test that encoding a single frame gives useful output. -TEST(VP8VideoTrackEncoder, SingleFrameEncode) -{ +TEST(VP8VideoTrackEncoder, SingleFrameEncode) { TestVP8TrackEncoder encoder; TimeStamp now = TimeStamp::Now(); YUVBufferGenerator generator; @@ -183,8 +179,7 @@ TEST(VP8VideoTrackEncoder, SingleFrameEncode) } // Test that encoding a couple of identical images gives useful output. -TEST(VP8VideoTrackEncoder, SameFrameEncode) -{ +TEST(VP8VideoTrackEncoder, SameFrameEncode) { TestVP8TrackEncoder encoder; TimeStamp now = TimeStamp::Now(); YUVBufferGenerator generator; @@ -219,8 +214,7 @@ TEST(VP8VideoTrackEncoder, SameFrameEncode) } // Test encoding a track that has to skip frames. -TEST(VP8VideoTrackEncoder, SkippedFrames) -{ +TEST(VP8VideoTrackEncoder, SkippedFrames) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -255,8 +249,7 @@ TEST(VP8VideoTrackEncoder, SkippedFrames) } // Test encoding a track with frames subject to rounding errors. -TEST(VP8VideoTrackEncoder, RoundingErrorFramesEncode) -{ +TEST(VP8VideoTrackEncoder, RoundingErrorFramesEncode) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -297,8 +290,7 @@ TEST(VP8VideoTrackEncoder, RoundingErrorFramesEncode) } // Test that we're encoding timestamps rather than durations. -TEST(VP8VideoTrackEncoder, TimestampFrameEncode) -{ +TEST(VP8VideoTrackEncoder, TimestampFrameEncode) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -340,8 +332,7 @@ TEST(VP8VideoTrackEncoder, TimestampFrameEncode) } // Test that we're compensating for drift when encoding. -TEST(VP8VideoTrackEncoder, DriftingFrameEncode) -{ +TEST(VP8VideoTrackEncoder, DriftingFrameEncode) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -389,8 +380,7 @@ TEST(VP8VideoTrackEncoder, DriftingFrameEncode) } // Test that suspending an encoding works. -TEST(VP8VideoTrackEncoder, Suspended) -{ +TEST(VP8VideoTrackEncoder, Suspended) { TestVP8TrackEncoder encoder; TimeStamp now = TimeStamp::Now(); YUVBufferGenerator generator; @@ -451,8 +441,7 @@ TEST(VP8VideoTrackEncoder, Suspended) } // Test that ending a track while the video track encoder is suspended works. -TEST(VP8VideoTrackEncoder, SuspendedUntilEnd) -{ +TEST(VP8VideoTrackEncoder, SuspendedUntilEnd) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -501,8 +490,7 @@ TEST(VP8VideoTrackEncoder, SuspendedUntilEnd) } // Test that ending a track that was always suspended works. -TEST(VP8VideoTrackEncoder, AlwaysSuspended) -{ +TEST(VP8VideoTrackEncoder, AlwaysSuspended) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -533,8 +521,7 @@ TEST(VP8VideoTrackEncoder, AlwaysSuspended) } // Test that encoding a track that is suspended in the beginning works. -TEST(VP8VideoTrackEncoder, SuspendedBeginning) -{ +TEST(VP8VideoTrackEncoder, SuspendedBeginning) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -585,8 +572,7 @@ TEST(VP8VideoTrackEncoder, SuspendedBeginning) // Test that suspending and resuming in the middle of already pushed data // works. -TEST(VP8VideoTrackEncoder, SuspendedOverlap) -{ +TEST(VP8VideoTrackEncoder, SuspendedOverlap) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -634,8 +620,7 @@ TEST(VP8VideoTrackEncoder, SuspendedOverlap) } // Test that ending a track in the middle of already pushed data works. -TEST(VP8VideoTrackEncoder, PrematureEnding) -{ +TEST(VP8VideoTrackEncoder, PrematureEnding) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -665,8 +650,7 @@ TEST(VP8VideoTrackEncoder, PrematureEnding) } // Test that a track that starts at t > 0 works as expected. -TEST(VP8VideoTrackEncoder, DelayedStart) -{ +TEST(VP8VideoTrackEncoder, DelayedStart) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -698,8 +682,7 @@ TEST(VP8VideoTrackEncoder, DelayedStart) // Test that a track that starts at t > 0 works as expected, when // SetStartOffset comes after AppendVideoSegment. -TEST(VP8VideoTrackEncoder, DelayedStartOtherEventOrder) -{ +TEST(VP8VideoTrackEncoder, DelayedStartOtherEventOrder) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -730,8 +713,7 @@ TEST(VP8VideoTrackEncoder, DelayedStartOtherEventOrder) } // Test that a track that starts at t >>> 0 works as expected. -TEST(VP8VideoTrackEncoder, VeryDelayedStart) -{ +TEST(VP8VideoTrackEncoder, VeryDelayedStart) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -763,8 +745,7 @@ TEST(VP8VideoTrackEncoder, VeryDelayedStart) // Test that a video frame that hangs around for a long time gets encoded every // second. -TEST(VP8VideoTrackEncoder, LongFramesReEncoded) -{ +TEST(VP8VideoTrackEncoder, LongFramesReEncoded) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -818,8 +799,7 @@ TEST(VP8VideoTrackEncoder, LongFramesReEncoded) // Test that an encoding with a defined key frame interval encodes keyframes // as expected. Short here means shorter than the default (1s). -TEST(VP8VideoTrackEncoder, ShortKeyFrameInterval) -{ +TEST(VP8VideoTrackEncoder, ShortKeyFrameInterval) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -888,8 +868,7 @@ TEST(VP8VideoTrackEncoder, ShortKeyFrameInterval) // Test that an encoding with a defined key frame interval encodes keyframes // as expected. Long here means longer than the default (1s). -TEST(VP8VideoTrackEncoder, LongKeyFrameInterval) -{ +TEST(VP8VideoTrackEncoder, LongKeyFrameInterval) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -958,8 +937,7 @@ TEST(VP8VideoTrackEncoder, LongKeyFrameInterval) // Test that an encoding with no defined key frame interval encodes keyframes // as expected. Default interval should be 1000ms. -TEST(VP8VideoTrackEncoder, DefaultKeyFrameInterval) -{ +TEST(VP8VideoTrackEncoder, DefaultKeyFrameInterval) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1026,8 +1004,7 @@ TEST(VP8VideoTrackEncoder, DefaultKeyFrameInterval) // Test that an encoding where the key frame interval is updated dynamically // encodes keyframes as expected. -TEST(VP8VideoTrackEncoder, DynamicKeyFrameIntervalChanges) -{ +TEST(VP8VideoTrackEncoder, DynamicKeyFrameIntervalChanges) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1196,8 +1173,7 @@ TEST(VP8VideoTrackEncoder, DynamicKeyFrameIntervalChanges) // Test that an encoding which is disabled on a frame timestamp encodes // frames as expected. -TEST(VP8VideoTrackEncoder, DisableOnFrameTime) -{ +TEST(VP8VideoTrackEncoder, DisableOnFrameTime) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1241,8 +1217,7 @@ TEST(VP8VideoTrackEncoder, DisableOnFrameTime) // Test that an encoding which is disabled between two frame timestamps encodes // frames as expected. -TEST(VP8VideoTrackEncoder, DisableBetweenFrames) -{ +TEST(VP8VideoTrackEncoder, DisableBetweenFrames) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1286,8 +1261,7 @@ TEST(VP8VideoTrackEncoder, DisableBetweenFrames) // Test that an encoding which is enabled on a frame timestamp encodes // frames as expected. -TEST(VP8VideoTrackEncoder, EnableOnFrameTime) -{ +TEST(VP8VideoTrackEncoder, EnableOnFrameTime) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1333,8 +1307,7 @@ TEST(VP8VideoTrackEncoder, EnableOnFrameTime) // Test that an encoding which is enabled between two frame timestamps encodes // frames as expected. -TEST(VP8VideoTrackEncoder, EnableBetweenFrames) -{ +TEST(VP8VideoTrackEncoder, EnableBetweenFrames) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1379,8 +1352,7 @@ TEST(VP8VideoTrackEncoder, EnableBetweenFrames) } // Test that making time go backwards removes any future frames in the encoder. -TEST(VP8VideoTrackEncoder, BackwardsTimeResets) -{ +TEST(VP8VideoTrackEncoder, BackwardsTimeResets) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1452,8 +1424,7 @@ TEST(VP8VideoTrackEncoder, BackwardsTimeResets) // Test that trying to encode a null image removes any future frames in the // encoder. -TEST(VP8VideoTrackEncoder, NullImageResets) -{ +TEST(VP8VideoTrackEncoder, NullImageResets) { TestVP8TrackEncoder encoder; YUVBufferGenerator generator; generator.Init(mozilla::gfx::IntSize(640, 480)); @@ -1521,8 +1492,7 @@ TEST(VP8VideoTrackEncoder, NullImageResets) } // EOS test -TEST(VP8VideoTrackEncoder, EncodeComplete) -{ +TEST(VP8VideoTrackEncoder, EncodeComplete) { TestVP8TrackEncoder encoder; // track end notification. diff --git a/dom/media/gtest/TestVideoUtils.cpp b/dom/media/gtest/TestVideoUtils.cpp index d322d15d6441..f424e4407108 100644 --- a/dom/media/gtest/TestVideoUtils.cpp +++ b/dom/media/gtest/TestVideoUtils.cpp @@ -10,8 +10,7 @@ using namespace mozilla; -TEST(MediaMIMETypes, IsMediaMIMEType) -{ +TEST(MediaMIMETypes, IsMediaMIMEType) { EXPECT_TRUE(IsMediaMIMEType(AUDIO_MP4)); EXPECT_TRUE(IsMediaMIMEType(VIDEO_MP4)); EXPECT_TRUE(IsMediaMIMEType("application/x-mp4")); @@ -26,8 +25,7 @@ TEST(MediaMIMETypes, IsMediaMIMEType) EXPECT_FALSE(IsMediaMIMEType("Video/mp4")); } -TEST(StringListRange, MakeStringListRange) -{ +TEST(StringListRange, MakeStringListRange) { static const struct { const char* mList; const char* mExpectedSkipEmpties; @@ -77,8 +75,7 @@ TEST(StringListRange, MakeStringListRange) } } -TEST(StringListRange, StringListContains) -{ +TEST(StringListRange, StringListContains) { static const struct { const char* mList; const char* mItemToSearch; diff --git a/dom/media/gtest/TestWebMBuffered.cpp b/dom/media/gtest/TestWebMBuffered.cpp index 14f5ae2b2591..31bbf1ebc5f2 100644 --- a/dom/media/gtest/TestWebMBuffered.cpp +++ b/dom/media/gtest/TestWebMBuffered.cpp @@ -19,8 +19,7 @@ static const uint64_t gTimecodes[] = {66000000, 160000000, 166000000, 200000000, 233000000, 320000000}; static const int64_t gEndOffsets[] = {501, 772, 1244, 1380, 1543, 2015}; -TEST(WebMBuffered, BasicTests) -{ +TEST(WebMBuffered, BasicTests) { ReentrantMonitor dummy("dummy"); WebMBufferedParser parser(0); @@ -58,8 +57,7 @@ static void ReadFile(const char* aPath, nsTArray& aBuffer) { ASSERT_EQ(r, 0); } -TEST(WebMBuffered, RealData) -{ +TEST(WebMBuffered, RealData) { ReentrantMonitor dummy("dummy"); WebMBufferedParser parser(0); @@ -80,8 +78,7 @@ TEST(WebMBuffered, RealData) } } -TEST(WebMBuffered, RealDataAppend) -{ +TEST(WebMBuffered, RealDataAppend) { ReentrantMonitor dummy("dummy"); WebMBufferedParser parser(0); nsTArray mapping; diff --git a/dom/media/gtest/TestWebMWriter.cpp b/dom/media/gtest/TestWebMWriter.cpp index 114311022cd0..14bd2750c343 100644 --- a/dom/media/gtest/TestWebMWriter.cpp +++ b/dom/media/gtest/TestWebMWriter.cpp @@ -94,8 +94,7 @@ class TestWebMWriter : public WebMWriter { uint64_t mTimestamp; }; -TEST(WebMWriter, Metadata) -{ +TEST(WebMWriter, Metadata) { TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK | ContainerWriter::CREATE_VIDEO_TRACK); @@ -130,8 +129,7 @@ TEST(WebMWriter, Metadata) EXPECT_TRUE(encodedBuf.Length() > 0); } -TEST(WebMWriter, Cluster) -{ +TEST(WebMWriter, Cluster) { TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK | ContainerWriter::CREATE_VIDEO_TRACK); // Set opus metadata. @@ -172,8 +170,7 @@ TEST(WebMWriter, Cluster) EXPECT_TRUE(writer.HaveValidCluster()); } -TEST(WebMWriter, FLUSH_NEEDED) -{ +TEST(WebMWriter, FLUSH_NEEDED) { TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK | ContainerWriter::CREATE_VIDEO_TRACK); // Set opus metadata. @@ -292,8 +289,7 @@ static int64_t webm_tell(void* aUserData) { return ioData->offset.isValid() ? ioData->offset.value() : -1; } -TEST(WebMWriter, bug970774_aspect_ratio) -{ +TEST(WebMWriter, bug970774_aspect_ratio) { TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK | ContainerWriter::CREATE_VIDEO_TRACK); // Set opus metadata. diff --git a/dom/media/gtest/mp4_demuxer/TestInterval.cpp b/dom/media/gtest/mp4_demuxer/TestInterval.cpp index 2572b1c392f7..824c94f692ba 100644 --- a/dom/media/gtest/mp4_demuxer/TestInterval.cpp +++ b/dom/media/gtest/mp4_demuxer/TestInterval.cpp @@ -8,14 +8,12 @@ using mozilla::MP4Interval; -TEST(MP4Interval, Length) -{ +TEST(MP4Interval, Length) { MP4Interval i(15, 25); EXPECT_EQ(10, i.Length()); } -TEST(MP4Interval, Intersection) -{ +TEST(MP4Interval, Intersection) { MP4Interval i0(10, 20); MP4Interval i1(15, 25); MP4Interval i = i0.Intersection(i1); @@ -23,8 +21,7 @@ TEST(MP4Interval, Intersection) EXPECT_EQ(20, i.end); } -TEST(MP4Interval, Equals) -{ +TEST(MP4Interval, Equals) { MP4Interval i0(10, 20); MP4Interval i1(10, 20); EXPECT_EQ(i0, i1); @@ -36,8 +33,7 @@ TEST(MP4Interval, Equals) EXPECT_NE(i0, i2); } -TEST(MP4Interval, IntersectionVector) -{ +TEST(MP4Interval, IntersectionVector) { nsTArray> i0; i0.AppendElement(MP4Interval(5, 10)); i0.AppendElement(MP4Interval(20, 25)); @@ -67,8 +63,7 @@ TEST(MP4Interval, IntersectionVector) EXPECT_EQ(57, i[3].end); } -TEST(MP4Interval, Normalize) -{ +TEST(MP4Interval, Normalize) { nsTArray> i; i.AppendElement(MP4Interval(20, 30)); i.AppendElement(MP4Interval(1, 8)); diff --git a/dom/media/gtest/mp4_demuxer/TestMP4.cpp b/dom/media/gtest/mp4_demuxer/TestMP4.cpp index c36bc02c5fc7..c8b754971891 100644 --- a/dom/media/gtest/mp4_demuxer/TestMP4.cpp +++ b/dom/media/gtest/mp4_demuxer/TestMP4.cpp @@ -51,8 +51,7 @@ static intptr_t vector_reader(uint8_t* buffer, uintptr_t size, void* userdata) { return length; } -TEST(rust, MP4MetadataEmpty) -{ +TEST(rust, MP4MetadataEmpty) { Mp4parseStatus rv; Mp4parseIo io; @@ -106,8 +105,7 @@ TEST(rust, MP4MetadataEmpty) mp4parse_free(context); } -TEST(rust, MP4Metadata) -{ +TEST(rust, MP4Metadata) { FILE* f = fopen("street.mp4", "rb"); ASSERT_TRUE(f != nullptr); // Read just the moov header to work around the parser diff --git a/dom/media/gtest/mp4_demuxer/TestParser.cpp b/dom/media/gtest/mp4_demuxer/TestParser.cpp index 0e9d14f48912..5ef1ef15061a 100644 --- a/dom/media/gtest/mp4_demuxer/TestParser.cpp +++ b/dom/media/gtest/mp4_demuxer/TestParser.cpp @@ -68,8 +68,7 @@ class TestStream : public ByteStream, size_t mSize; }; -TEST(MP4Metadata, EmptyStream) -{ +TEST(MP4Metadata, EmptyStream) { RefPtr stream = new TestStream(nullptr, 0); MP4Metadata::ResultAndByteBuffer metadataBuffer = @@ -95,8 +94,7 @@ TEST(MP4Metadata, EmptyStream) EXPECT_FALSE(metadata.Crypto().Ref()->valid); } -TEST(MoofParser, EmptyStream) -{ +TEST(MoofParser, EmptyStream) { RefPtr stream = new TestStream(nullptr, 0); MoofParser parser(stream, AsVariant(ParseAllTracks{}), false); @@ -250,8 +248,7 @@ static const TestFileData testFiles[] = { 300, 1, 10032000, false, 0, true, true, 2}, // Uses bad track id 0 }; -TEST(MP4Metadata, test_case_mp4) -{ +TEST(MP4Metadata, test_case_mp4) { const TestFileData* tests = nullptr; size_t length = 0; @@ -406,8 +403,7 @@ TEST(MP4Metadata, test_case_mp4_subsets) { } #endif -TEST(MoofParser, test_case_mp4) -{ +TEST(MoofParser, test_case_mp4) { const TestFileData* tests = nullptr; size_t length = 0; @@ -452,8 +448,7 @@ TEST(MoofParser, test_case_mp4) } } -TEST(MoofParser, test_case_sample_description_entries) -{ +TEST(MoofParser, test_case_sample_description_entries) { const TestFileData* tests = testFiles; size_t length = ArrayLength(testFiles); @@ -500,8 +495,7 @@ TEST(MoofParser, test_case_sample_description_entries) // used id 0 to trigger special handling in the MoofParser to read multiple // track metadata, but since muxers use track id 0 in the wild, we want to // make sure they can't accidentally trigger such handling. -TEST(MoofParser, test_case_track_id_0_does_not_read_multitracks) -{ +TEST(MoofParser, test_case_track_id_0_does_not_read_multitracks) { const char* zeroTrackIdFileName = "test_case_1519617-video-has-track_id-0.mp4"; nsTArray buffer = ReadTestFile(zeroTrackIdFileName); @@ -556,8 +550,7 @@ TEST(MoofParser, test_case_track_id_0_does_not_read_multitracks) // if its crypto member is valid. However, even on files where the pssh isn't // in the init segment, the MoofParser should still read the sinf, as in this // testcase. -TEST(MoofParser, test_case_track_id_0_reads_crypto_metadata) -{ +TEST(MoofParser, test_case_track_id_0_reads_crypto_metadata) { const char* zeroTrackIdFileName = "test_case_1519617-cenc-init-with-track_id-0.mp4"; nsTArray buffer = ReadTestFile(zeroTrackIdFileName); @@ -614,8 +607,7 @@ TEST(MoofParser, test_case_track_id_0_reads_crypto_metadata) // should parse such fragmented media. In this test the metadata contains info // for track ids 1 and 2, but track 2's track fragment headers (traf) have been // over written with free space boxes (free). -TEST(MoofParser, test_case_moofs_missing_trafs) -{ +TEST(MoofParser, test_case_moofs_missing_trafs) { const char* noTrafsForTrack2MoofsFileName = "test_case_1519617-track2-trafs-removed.mp4"; nsTArray buffer = ReadTestFile(noTrafsForTrack2MoofsFileName); @@ -758,8 +750,7 @@ uint8_t media_gtest_video_init_mp4[] = { const uint32_t media_gtest_video_init_mp4_len = 745; -TEST(MP4Metadata, EmptyCTTS) -{ +TEST(MP4Metadata, EmptyCTTS) { RefPtr buffer = new MediaByteBuffer(media_gtest_video_init_mp4_len); buffer->AppendElements(media_gtest_video_init_mp4, @@ -854,7 +845,7 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) { "MEDIA_MP4_PARSE_SAMPLE_DESCRIPTION_ENTRIES_HAVE_MULTIPLE_CODECS", snapshot, &multipleCodecsHistogram); ASSERT_TRUE(multipleCodecsHistogram.isObject()) - << "Multiple codecs histogram should exist!"; + << "Multiple codecs histogram should exist!"; TelemetryTestHelpers::GetProperty(cx.GetJSContext(), "values", multipleCodecsHistogram, &values); @@ -879,7 +870,7 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) { "MEDIA_MP4_PARSE_SAMPLE_DESCRIPTION_ENTRIES_HAVE_MULTIPLE_CRYPTO", snapshot, &multipleCryptoHistogram); ASSERT_TRUE(multipleCryptoHistogram.isObject()) - << "Multiple crypto histogram should exist!"; + << "Multiple crypto histogram should exist!"; TelemetryTestHelpers::GetProperty(cx.GetJSContext(), "values", multipleCryptoHistogram, &values); @@ -902,7 +893,7 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) { cx.GetJSContext(), "MEDIA_MP4_PARSE_NUM_SAMPLE_DESCRIPTION_ENTRIES", snapshot, &numSamplesHistogram); ASSERT_TRUE(numSamplesHistogram.isObject()) - << "Num sample description entries histogram should exist!"; + << "Num sample description entries histogram should exist!"; TelemetryTestHelpers::GetProperty(cx.GetJSContext(), "values", numSamplesHistogram, &values); diff --git a/dom/media/ipc/RemoteDecoderParent.cpp b/dom/media/ipc/RemoteDecoderParent.cpp index d58bd2718032..73bec38e0684 100644 --- a/dom/media/ipc/RemoteDecoderParent.cpp +++ b/dom/media/ipc/RemoteDecoderParent.cpp @@ -41,22 +41,21 @@ void RemoteDecoderParent::Destroy() { mozilla::ipc::IPCResult RemoteDecoderParent::RecvInit() { MOZ_ASSERT(OnManagerThread()); RefPtr self = this; - mDecoder->Init()->Then( - mManagerTaskQueue, __func__, - [self](TrackInfo::TrackType aTrack) { - MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack || - aTrack == TrackInfo::kVideoTrack); - if (self->mDecoder) { - Unused << self->SendInitComplete(aTrack, - self->mDecoder->GetDescriptionName(), - self->mDecoder->NeedsConversion()); - } - }, - [self](MediaResult aReason) { - if (!self->mDestroyed) { - Unused << self->SendInitFailed(aReason); - } - }); + mDecoder->Init()->Then(mManagerTaskQueue, __func__, + [self](TrackInfo::TrackType aTrack) { + MOZ_ASSERT(aTrack == TrackInfo::kAudioTrack || + aTrack == TrackInfo::kVideoTrack); + if (self->mDecoder) { + Unused << self->SendInitComplete( + aTrack, self->mDecoder->GetDescriptionName(), + self->mDecoder->NeedsConversion()); + } + }, + [self](MediaResult aReason) { + if (!self->mDestroyed) { + Unused << self->SendInitFailed(aReason); + } + }); return IPC_OK(); } diff --git a/dom/media/ipc/RemoteMediaDataDecoder.cpp b/dom/media/ipc/RemoteMediaDataDecoder.cpp index 42ee59822f9c..08b91db7c7c0 100644 --- a/dom/media/ipc/RemoteMediaDataDecoder.cpp +++ b/dom/media/ipc/RemoteMediaDataDecoder.cpp @@ -44,19 +44,18 @@ RefPtr RemoteMediaDataDecoder::Init() { RefPtr self = this; return InvokeAsync(mAbstractManagerThread, __func__, [self]() { return self->mChild->Init(); }) - ->Then( - mAbstractManagerThread, __func__, - [self, this](TrackType aTrack) { - mDescription = - mChild->GetDescriptionName() + NS_LITERAL_CSTRING(" (remote)"); - mIsHardwareAccelerated = - mChild->IsHardwareAccelerated(mHardwareAcceleratedReason); - mConversion = mChild->NeedsConversion(); - return InitPromise::CreateAndResolve(aTrack, __func__); - }, - [self](const MediaResult& aError) { - return InitPromise::CreateAndReject(aError, __func__); - }); + ->Then(mAbstractManagerThread, __func__, + [self, this](TrackType aTrack) { + mDescription = mChild->GetDescriptionName() + + NS_LITERAL_CSTRING(" (remote)"); + mIsHardwareAccelerated = + mChild->IsHardwareAccelerated(mHardwareAcceleratedReason); + mConversion = mChild->NeedsConversion(); + return InitPromise::CreateAndResolve(aTrack, __func__); + }, + [self](const MediaResult& aError) { + return InitPromise::CreateAndReject(aError, __func__); + }); } RefPtr RemoteMediaDataDecoder::Decode( diff --git a/dom/media/mediasink/VideoSink.cpp b/dom/media/mediasink/VideoSink.cpp index 9753ae7a49ec..6cc149bcb2de 100644 --- a/dom/media/mediasink/VideoSink.cpp +++ b/dom/media/mediasink/VideoSink.cpp @@ -262,22 +262,21 @@ nsresult VideoSink::Start(const TimeUnit& aStartTime, const MediaInfo& aInfo) { RefPtr p = mAudioSink->OnEnded(TrackInfo::kVideoTrack); if (p) { RefPtr self = this; - p->Then( - mOwnerThread, __func__, - [self]() { - self->mVideoSinkEndRequest.Complete(); - self->TryUpdateRenderedVideoFrames(); - // It is possible the video queue size is 0 and we have no - // frames to render. However, we need to call - // MaybeResolveEndPromise() to ensure mEndPromiseHolder is - // resolved. - self->MaybeResolveEndPromise(); - }, - [self]() { - self->mVideoSinkEndRequest.Complete(); - self->TryUpdateRenderedVideoFrames(); - self->MaybeResolveEndPromise(); - }) + p->Then(mOwnerThread, __func__, + [self]() { + self->mVideoSinkEndRequest.Complete(); + self->TryUpdateRenderedVideoFrames(); + // It is possible the video queue size is 0 and we have no + // frames to render. However, we need to call + // MaybeResolveEndPromise() to ensure mEndPromiseHolder is + // resolved. + self->MaybeResolveEndPromise(); + }, + [self]() { + self->mVideoSinkEndRequest.Complete(); + self->TryUpdateRenderedVideoFrames(); + self->MaybeResolveEndPromise(); + }) ->Track(mVideoSinkEndRequest); } diff --git a/dom/media/mediasource/SourceBuffer.cpp b/dom/media/mediasource/SourceBuffer.cpp index 29ad2b5b502c..9d11d2bed804 100644 --- a/dom/media/mediasource/SourceBuffer.cpp +++ b/dom/media/mediasource/SourceBuffer.cpp @@ -328,13 +328,12 @@ void SourceBuffer::RangeRemoval(double aStart, double aEnd) { RefPtr self = this; mTrackBuffersManager ->RangeRemoval(TimeUnit::FromSeconds(aStart), TimeUnit::FromSeconds(aEnd)) - ->Then( - mAbstractMainThread, __func__, - [self](bool) { - self->mPendingRemoval.Complete(); - self->StopUpdating(); - }, - []() { MOZ_ASSERT(false); }) + ->Then(mAbstractMainThread, __func__, + [self](bool) { + self->mPendingRemoval.Complete(); + self->StopUpdating(); + }, + []() { MOZ_ASSERT(false); }) ->Track(mPendingRemoval); } diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index 9e43af7269e0..b9b049a9f2c1 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -811,20 +811,19 @@ void TrackBuffersManager::SegmentParserLoop() { // run the coded frame processing algorithm. RefPtr self = this; CodedFrameProcessing() - ->Then( - TaskQueueFromTaskQueue(), __func__, - [self](bool aNeedMoreData) { - self->mProcessingRequest.Complete(); - if (aNeedMoreData) { - self->NeedMoreData(); - } else { - self->ScheduleSegmentParserLoop(); - } - }, - [self](const MediaResult& aRejectValue) { - self->mProcessingRequest.Complete(); - self->RejectAppend(aRejectValue, __func__); - }) + ->Then(TaskQueueFromTaskQueue(), __func__, + [self](bool aNeedMoreData) { + self->mProcessingRequest.Complete(); + if (aNeedMoreData) { + self->NeedMoreData(); + } else { + self->ScheduleSegmentParserLoop(); + } + }, + [self](const MediaResult& aRejectValue) { + self->mProcessingRequest.Complete(); + self->RejectAppend(aRejectValue, __func__); + }) ->Track(mProcessingRequest); return; } diff --git a/dom/media/mediasource/gtest/TestContainerParser.cpp b/dom/media/mediasource/gtest/TestContainerParser.cpp index 1e007ce0ee22..b4cde79ded05 100644 --- a/dom/media/mediasource/gtest/TestContainerParser.cpp +++ b/dom/media/mediasource/gtest/TestContainerParser.cpp @@ -12,8 +12,7 @@ using namespace mozilla; -TEST(ContainerParser, MIMETypes) -{ +TEST(ContainerParser, MIMETypes) { const char* containerTypes[] = {"video/webm", "audio/webm", "video/mp4", "audio/mp4", "audio/aac"}; nsAutoPtr parser; @@ -33,8 +32,7 @@ already_AddRefed make_adts_header() { return buffer.forget(); } -TEST(ContainerParser, ADTSHeader) -{ +TEST(ContainerParser, ADTSHeader) { nsAutoPtr parser; parser = ContainerParser::CreateForMIMEType( MediaContainerType(MEDIAMIMETYPE("audio/aac"))); @@ -99,8 +97,7 @@ TEST(ContainerParser, ADTSHeader) EXPECT_EQ(parser->MediaSegmentRange(), MediaByteRange()); } -TEST(ContainerParser, ADTSBlankMedia) -{ +TEST(ContainerParser, ADTSBlankMedia) { nsAutoPtr parser; parser = ContainerParser::CreateForMIMEType( MediaContainerType(MEDIAMIMETYPE("audio/aac"))); diff --git a/dom/media/mediasource/gtest/TestExtractVPXCodecDetails.cpp b/dom/media/mediasource/gtest/TestExtractVPXCodecDetails.cpp index b46a6cc57fcb..27bece99d9a2 100644 --- a/dom/media/mediasource/gtest/TestExtractVPXCodecDetails.cpp +++ b/dom/media/mediasource/gtest/TestExtractVPXCodecDetails.cpp @@ -15,8 +15,7 @@ struct TestData { const bool mExpectedValue; }; -TEST(ExtractVPXCodecDetails, TestDataLength) -{ +TEST(ExtractVPXCodecDetails, TestDataLength) { TestData tests[] = { {u"vp09.00.11.08", true}, // valid case {u"vp09.00.11.08.00", true}, // valid case, have extra optional field @@ -39,8 +38,7 @@ TEST(ExtractVPXCodecDetails, TestDataLength) } } -TEST(ExtractVPXCodecDetails, TestInputData) -{ +TEST(ExtractVPXCodecDetails, TestInputData) { TestData tests[] = { {u"vp09.02..08", false}, // malformed {u"vp9.02.10.08", false}, // invalid 4CC @@ -76,8 +74,7 @@ TEST(ExtractVPXCodecDetails, TestInputData) } } -TEST(ExtractVPXCodecDetails, TestParsingOutput) -{ +TEST(ExtractVPXCodecDetails, TestParsingOutput) { uint8_t profile = 0; uint8_t level = 0; uint8_t bitDepth = 0; diff --git a/dom/media/platforms/AllocationPolicy.cpp b/dom/media/platforms/AllocationPolicy.cpp index afdc2e472522..7e461acf9887 100644 --- a/dom/media/platforms/AllocationPolicy.cpp +++ b/dom/media/platforms/AllocationPolicy.cpp @@ -140,19 +140,18 @@ auto SingleAllocPolicy::Alloc() -> RefPtr { RefPtr p = self->mPendingPromise.Ensure(__func__); GlobalAllocPolicy::Instance(self->mTrack) ->Alloc() - ->Then( - self->mOwnerThread, __func__, - [self, localToken = std::move(localToken)]( - RefPtr aToken) mutable { - self->mTokenRequest.Complete(); - RefPtr combinedToken = new AutoDeallocCombinedToken( - localToken.forget(), aToken.forget()); - self->mPendingPromise.Resolve(combinedToken, __func__); - }, - [self]() { - self->mTokenRequest.Complete(); - self->mPendingPromise.Reject(true, __func__); - }) + ->Then(self->mOwnerThread, __func__, + [self, localToken = std::move(localToken)]( + RefPtr aToken) mutable { + self->mTokenRequest.Complete(); + RefPtr combinedToken = new AutoDeallocCombinedToken( + localToken.forget(), aToken.forget()); + self->mPendingPromise.Resolve(combinedToken, __func__); + }, + [self]() { + self->mTokenRequest.Complete(); + self->mPendingPromise.Reject(true, __func__); + }) ->Track(self->mTokenRequest); return p; }, @@ -213,47 +212,47 @@ AllocationWrapper::CreateDecoder(const CreateDecoderParams& aParams, RefPtr p = (aPolicy ? aPolicy : GlobalAllocPolicy::Instance(aParams.mType)) ->Alloc() - ->Then( - AbstractThread::GetCurrent(), __func__, - [=](RefPtr aToken) { - // result may not always be updated by - // PDMFactory::CreateDecoder either when the creation - // succeeded or failed, as such it must be initialized to a - // fatal error by default. - MediaResult result = - MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - nsPrintfCString("error creating %s decoder", - TrackTypeToStr(type))); - RefPtr pdm = new PDMFactory(); - CreateDecoderParams params{*config, - taskQueue, - diagnostics, - imageContainer, - &result, - knowsCompositor, - crashHelper, - useNullDecoder, - noWrapper, - type, - onWaitingForKeyEvent, - options, - rate}; - RefPtr decoder = pdm->CreateDecoder(params); - if (decoder) { - RefPtr wrapper = - new AllocationWrapper(decoder.forget(), aToken.forget()); - return AllocateDecoderPromise::CreateAndResolve(wrapper, + ->Then(AbstractThread::GetCurrent(), __func__, + [=](RefPtr aToken) { + // result may not always be updated by + // PDMFactory::CreateDecoder either when the creation + // succeeded or failed, as such it must be initialized to a + // fatal error by default. + MediaResult result = + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + nsPrintfCString("error creating %s decoder", + TrackTypeToStr(type))); + RefPtr pdm = new PDMFactory(); + CreateDecoderParams params{*config, + taskQueue, + diagnostics, + imageContainer, + &result, + knowsCompositor, + crashHelper, + useNullDecoder, + noWrapper, + type, + onWaitingForKeyEvent, + options, + rate}; + RefPtr decoder = + pdm->CreateDecoder(params); + if (decoder) { + RefPtr wrapper = new AllocationWrapper( + decoder.forget(), aToken.forget()); + return AllocateDecoderPromise::CreateAndResolve(wrapper, + __func__); + } + return AllocateDecoderPromise::CreateAndReject(result, __func__); - } - return AllocateDecoderPromise::CreateAndReject(result, - __func__); - }, - []() { - return AllocateDecoderPromise::CreateAndReject( - MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, - "Allocation policy expired"), - __func__); - }); + }, + []() { + return AllocateDecoderPromise::CreateAndReject( + MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, + "Allocation policy expired"), + __func__); + }); return p; } diff --git a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp index 8f99cfd968a8..01709e5dae3a 100644 --- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp +++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp @@ -101,13 +101,12 @@ class EMEDecryptor : public MediaDataDecoder, RefPtr p = mDecodePromise.Ensure(__func__); mSamplesWaitingForKey->WaitIfKeyNotUsable(sample) - ->Then( - mTaskQueue, __func__, - [self](const RefPtr& aSample) { - self->mKeyRequest.Complete(); - self->ThrottleDecode(aSample); - }, - [self]() { self->mKeyRequest.Complete(); }) + ->Then(mTaskQueue, __func__, + [self](const RefPtr& aSample) { + self->mKeyRequest.Complete(); + self->ThrottleDecode(aSample); + }, + [self]() { self->mKeyRequest.Complete(); }) ->Track(mKeyRequest); return p; @@ -119,13 +118,12 @@ class EMEDecryptor : public MediaDataDecoder, RefPtr self = this; mThroughputLimiter.Throttle(aSample) - ->Then( - mTaskQueue, __func__, - [self](RefPtr aSample) { - self->mThrottleRequest.Complete(); - self->AttemptDecode(aSample); - }, - [self]() { self->mThrottleRequest.Complete(); }) + ->Then(mTaskQueue, __func__, + [self](RefPtr aSample) { + self->mThrottleRequest.Complete(); + self->AttemptDecode(aSample); + }, + [self]() { self->mThrottleRequest.Complete(); }) ->Track(mThrottleRequest); } @@ -313,25 +311,24 @@ RefPtr EMEMediaDataDecoderProxy::Decode( return InvokeAsync(mThread, __func__, [self, this, sample]() { RefPtr p = mDecodePromise.Ensure(__func__); mSamplesWaitingForKey->WaitIfKeyNotUsable(sample) - ->Then( - mThread, __func__, - [self, this](RefPtr aSample) { - mKeyRequest.Complete(); + ->Then(mThread, __func__, + [self, this](RefPtr aSample) { + mKeyRequest.Complete(); - MediaDataDecoderProxy::Decode(aSample) - ->Then(mThread, __func__, - [self, - this](DecodePromise::ResolveOrRejectValue&& aValue) { - mDecodeRequest.Complete(); - mDecodePromise.ResolveOrReject(std::move(aValue), - __func__); - }) - ->Track(mDecodeRequest); - }, - [self]() { - self->mKeyRequest.Complete(); - MOZ_CRASH("Should never get here"); - }) + MediaDataDecoderProxy::Decode(aSample) + ->Then(mThread, __func__, + [self, this]( + DecodePromise::ResolveOrRejectValue&& aValue) { + mDecodeRequest.Complete(); + mDecodePromise.ResolveOrReject(std::move(aValue), + __func__); + }) + ->Track(mDecodeRequest); + }, + [self]() { + self->mKeyRequest.Complete(); + MOZ_CRASH("Should never get here"); + }) ->Track(mKeyRequest); return p; diff --git a/dom/media/platforms/omx/OmxDataDecoder.cpp b/dom/media/platforms/omx/OmxDataDecoder.cpp index 781addebb217..b8619a714187 100644 --- a/dom/media/platforms/omx/OmxDataDecoder.cpp +++ b/dom/media/platforms/omx/OmxDataDecoder.cpp @@ -139,16 +139,15 @@ RefPtr OmxDataDecoder::Init() { RefPtr p = mInitPromise.Ensure(__func__); mOmxLayer->Init(mTrackInfo.get()) - ->Then( - mOmxTaskQueue, __func__, - [self, this]() { - // Omx state should be OMX_StateIdle. - mOmxState = mOmxLayer->GetState(); - MOZ_ASSERT(mOmxState != OMX_StateIdle); - }, - [self, this]() { - RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - }); + ->Then(mOmxTaskQueue, __func__, + [self, this]() { + // Omx state should be OMX_StateIdle. + mOmxState = mOmxLayer->GetState(); + MOZ_ASSERT(mOmxState != OMX_StateIdle); + }, + [self, this]() { + RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); + }); return p; }); } @@ -212,41 +211,39 @@ RefPtr OmxDataDecoder::DoAsyncShutdown() { // Flush to all ports, so all buffers can be returned from component. RefPtr self = this; mOmxLayer->SendCommand(OMX_CommandFlush, OMX_ALL, nullptr) - ->Then( - mOmxTaskQueue, __func__, - [self]() -> RefPtr { - LOGL("DoAsyncShutdown: flush complete"); - return self->mOmxLayer->SendCommand(OMX_CommandStateSet, - OMX_StateIdle, nullptr); - }, - [self](const OmxCommandFailureHolder& aError) { - self->mOmxLayer->Shutdown(); - return OmxCommandPromise::CreateAndReject(aError, __func__); - }) - ->Then( - mOmxTaskQueue, __func__, - [self]() -> RefPtr { - RefPtr p = self->mOmxLayer->SendCommand( - OMX_CommandStateSet, OMX_StateLoaded, nullptr); + ->Then(mOmxTaskQueue, __func__, + [self]() -> RefPtr { + LOGL("DoAsyncShutdown: flush complete"); + return self->mOmxLayer->SendCommand(OMX_CommandStateSet, + OMX_StateIdle, nullptr); + }, + [self](const OmxCommandFailureHolder& aError) { + self->mOmxLayer->Shutdown(); + return OmxCommandPromise::CreateAndReject(aError, __func__); + }) + ->Then(mOmxTaskQueue, __func__, + [self]() -> RefPtr { + RefPtr p = self->mOmxLayer->SendCommand( + OMX_CommandStateSet, OMX_StateLoaded, nullptr); - // According to spec 3.1.1.2.2.1: - // OMX_StateLoaded needs to be sent before releasing buffers. - // And state transition from OMX_StateIdle to OMX_StateLoaded - // is completed when all of the buffers have been removed - // from the component. - // Here the buffer promises are not resolved due to displaying - // in layer, it needs to wait before the layer returns the - // buffers. - LOGL("DoAsyncShutdown: releasing buffers..."); - self->ReleaseBuffers(OMX_DirInput); - self->ReleaseBuffers(OMX_DirOutput); + // According to spec 3.1.1.2.2.1: + // OMX_StateLoaded needs to be sent before releasing buffers. + // And state transition from OMX_StateIdle to OMX_StateLoaded + // is completed when all of the buffers have been removed + // from the component. + // Here the buffer promises are not resolved due to displaying + // in layer, it needs to wait before the layer returns the + // buffers. + LOGL("DoAsyncShutdown: releasing buffers..."); + self->ReleaseBuffers(OMX_DirInput); + self->ReleaseBuffers(OMX_DirOutput); - return p; - }, - [self](const OmxCommandFailureHolder& aError) { - self->mOmxLayer->Shutdown(); - return OmxCommandPromise::CreateAndReject(aError, __func__); - }) + return p; + }, + [self](const OmxCommandFailureHolder& aError) { + self->mOmxLayer->Shutdown(); + return OmxCommandPromise::CreateAndReject(aError, __func__); + }) ->Then( mOmxTaskQueue, __func__, [self]() -> RefPtr { @@ -266,18 +263,17 @@ RefPtr OmxDataDecoder::DoAsyncShutdown() { self->mMediaDataHelper = nullptr; return ShutdownPromise::CreateAndReject(false, __func__); }) - ->Then( - mTaskQueue, __func__, - [self]() { - self->mOmxTaskQueue->BeginShutdown(); - self->mOmxTaskQueue->AwaitShutdownAndIdle(); - self->mShutdownPromise.Resolve(true, __func__); - }, - [self]() { - self->mOmxTaskQueue->BeginShutdown(); - self->mOmxTaskQueue->AwaitShutdownAndIdle(); - self->mShutdownPromise.Resolve(true, __func__); - }); + ->Then(mTaskQueue, __func__, + [self]() { + self->mOmxTaskQueue->BeginShutdown(); + self->mOmxTaskQueue->AwaitShutdownAndIdle(); + self->mShutdownPromise.Resolve(true, __func__); + }, + [self]() { + self->mOmxTaskQueue->BeginShutdown(); + self->mOmxTaskQueue->AwaitShutdownAndIdle(); + self->mShutdownPromise.Resolve(true, __func__); + }); return mShutdownPromise.Ensure(__func__); } @@ -329,19 +325,18 @@ void OmxDataDecoder::Output(BufferData* aData) { RefPtr self = this; RefPtr buffer = aData; - p->Then( - mOmxTaskQueue, __func__, - [self, buffer]() { - MOZ_RELEASE_ASSERT(buffer->mStatus == - BufferData::BufferStatus::OMX_CLIENT_OUTPUT); - buffer->mStatus = BufferData::BufferStatus::FREE; - self->FillAndEmptyBuffers(); - }, - [buffer]() { - MOZ_RELEASE_ASSERT(buffer->mStatus == - BufferData::BufferStatus::OMX_CLIENT_OUTPUT); - buffer->mStatus = BufferData::BufferStatus::FREE; - }); + p->Then(mOmxTaskQueue, __func__, + [self, buffer]() { + MOZ_RELEASE_ASSERT(buffer->mStatus == + BufferData::BufferStatus::OMX_CLIENT_OUTPUT); + buffer->mStatus = BufferData::BufferStatus::FREE; + self->FillAndEmptyBuffers(); + }, + [buffer]() { + MOZ_RELEASE_ASSERT(buffer->mStatus == + BufferData::BufferStatus::OMX_CLIENT_OUTPUT); + buffer->mStatus = BufferData::BufferStatus::FREE; + }); } else { aData->mStatus = BufferData::BufferStatus::FREE; } @@ -519,16 +514,16 @@ void OmxDataDecoder::OmxStateRunner() { // Send OpenMax state command to OMX_StateIdle. RefPtr self = this; mOmxLayer->SendCommand(OMX_CommandStateSet, OMX_StateIdle, nullptr) - ->Then( - mOmxTaskQueue, __func__, - [self]() { - // Current state should be OMX_StateIdle. - self->mOmxState = self->mOmxLayer->GetState(); - MOZ_ASSERT(self->mOmxState == OMX_StateIdle); - }, - [self]() { - self->RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - }); + ->Then(mOmxTaskQueue, __func__, + [self]() { + // Current state should be OMX_StateIdle. + self->mOmxState = self->mOmxLayer->GetState(); + MOZ_ASSERT(self->mOmxState == OMX_StateIdle); + }, + [self]() { + self->RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); + }); // Allocate input and output buffers. OMX_DIRTYPE types[] = {OMX_DIRTYPE::OMX_DirInput, @@ -543,17 +538,17 @@ void OmxDataDecoder::OmxStateRunner() { } else if (mOmxState == OMX_StateIdle) { RefPtr self = this; mOmxLayer->SendCommand(OMX_CommandStateSet, OMX_StateExecuting, nullptr) - ->Then( - mOmxTaskQueue, __func__, - [self]() { - self->mOmxState = self->mOmxLayer->GetState(); - MOZ_ASSERT(self->mOmxState == OMX_StateExecuting); + ->Then(mOmxTaskQueue, __func__, + [self]() { + self->mOmxState = self->mOmxLayer->GetState(); + MOZ_ASSERT(self->mOmxState == OMX_StateExecuting); - self->ResolveInitPromise(__func__); - }, - [self]() { - self->RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__); - }); + self->ResolveInitPromise(__func__); + }, + [self]() { + self->RejectInitPromise(NS_ERROR_DOM_MEDIA_FATAL_ERR, + __func__); + }); } else if (mOmxState == OMX_StateExecuting) { // Configure codec once it gets OMX_StateExecuting state. FillCodecConfigDataToOmx(); @@ -733,36 +728,35 @@ void OmxDataDecoder::PortSettingsChanged() { LOG("PortSettingsChanged: disable port %lu", def.nPortIndex); mOmxLayer ->SendCommand(OMX_CommandPortDisable, mPortSettingsChanged, nullptr) - ->Then( - mOmxTaskQueue, __func__, - [self, def]() -> RefPtr { - // 3. enable port. - // Send enable port command. - RefPtr p = self->mOmxLayer->SendCommand( - OMX_CommandPortEnable, self->mPortSettingsChanged, nullptr); + ->Then(mOmxTaskQueue, __func__, + [self, def]() -> RefPtr { + // 3. enable port. + // Send enable port command. + RefPtr p = self->mOmxLayer->SendCommand( + OMX_CommandPortEnable, self->mPortSettingsChanged, + nullptr); - // 4. allocate port buffers. - // Allocate new port buffers. - nsresult rv = self->AllocateBuffers(def.eDir); - if (NS_FAILED(rv)) { - self->NotifyError(OMX_ErrorUndefined, __func__); - } + // 4. allocate port buffers. + // Allocate new port buffers. + nsresult rv = self->AllocateBuffers(def.eDir); + if (NS_FAILED(rv)) { + self->NotifyError(OMX_ErrorUndefined, __func__); + } - return p; - }, - [self](const OmxCommandFailureHolder& aError) { - self->NotifyError(OMX_ErrorUndefined, __func__); - return OmxCommandPromise::CreateAndReject(aError, __func__); - }) - ->Then( - mOmxTaskQueue, __func__, - [self]() { - LOGL("PortSettingsChanged: port settings changed complete"); - // finish port setting changed. - self->mPortSettingsChanged = -1; - self->FillAndEmptyBuffers(); - }, - [self]() { self->NotifyError(OMX_ErrorUndefined, __func__); }); + return p; + }, + [self](const OmxCommandFailureHolder& aError) { + self->NotifyError(OMX_ErrorUndefined, __func__); + return OmxCommandPromise::CreateAndReject(aError, __func__); + }) + ->Then(mOmxTaskQueue, __func__, + [self]() { + LOGL("PortSettingsChanged: port settings changed complete"); + // finish port setting changed. + self->mPortSettingsChanged = -1; + self->FillAndEmptyBuffers(); + }, + [self]() { self->NotifyError(OMX_ErrorUndefined, __func__); }); // 2. wait for port buffers return to client and then release these buffers. // diff --git a/dom/media/platforms/omx/OmxPromiseLayer.cpp b/dom/media/platforms/omx/OmxPromiseLayer.cpp index 2a276f8a8995..09da5bdc8551 100644 --- a/dom/media/platforms/omx/OmxPromiseLayer.cpp +++ b/dom/media/platforms/omx/OmxPromiseLayer.cpp @@ -298,9 +298,7 @@ bool OmxPromiseLayer::Event(OMX_EVENTTYPE aEvent, OMX_U32 aData1, } break; } - default: { - return false; - } + default: { return false; } } return true; } diff --git a/dom/media/platforms/wmf/MFTDecoder.h b/dom/media/platforms/wmf/MFTDecoder.h index 1cf431e85c78..34292ace7c77 100644 --- a/dom/media/platforms/wmf/MFTDecoder.h +++ b/dom/media/platforms/wmf/MFTDecoder.h @@ -36,10 +36,9 @@ class MFTDecoder final { // - aOutputType needs at least major and minor types set. // This is used to select the matching output type out // of all the available output types of the MFT. - HRESULT SetMediaTypes( - IMFMediaType* aInputType, IMFMediaType* aOutputType, - std::function&& aCallback = - [](IMFMediaType* aOutput) { return S_OK; }); + HRESULT SetMediaTypes(IMFMediaType* aInputType, IMFMediaType* aOutputType, + std::function&& aCallback = + [](IMFMediaType* aOutput) { return S_OK; }); // Returns the MFT's IMFAttributes object. already_AddRefed GetAttributes(); diff --git a/dom/media/platforms/wrappers/MediaChangeMonitor.cpp b/dom/media/platforms/wrappers/MediaChangeMonitor.cpp index ce7e9e3afba9..e66c81a17c6b 100644 --- a/dom/media/platforms/wrappers/MediaChangeMonitor.cpp +++ b/dom/media/platforms/wrappers/MediaChangeMonitor.cpp @@ -475,36 +475,35 @@ MediaResult MediaChangeMonitor::CreateDecoderAndInit(MediaRawData* aSample) { RefPtr self = this; RefPtr sample = aSample; mDecoder->Init() - ->Then( - mTaskQueue, __func__, - [self, sample, this](const TrackType aTrackType) { - mInitPromiseRequest.Complete(); - mConversionRequired = Some(mDecoder->NeedsConversion()); - mCanRecycleDecoder = Some(CanRecycleDecoder()); + ->Then(mTaskQueue, __func__, + [self, sample, this](const TrackType aTrackType) { + mInitPromiseRequest.Complete(); + mConversionRequired = Some(mDecoder->NeedsConversion()); + mCanRecycleDecoder = Some(CanRecycleDecoder()); - if (!mFlushPromise.IsEmpty()) { - // A Flush is pending, abort the current operation. - mFlushPromise.Resolve(true, __func__); - return; - } + if (!mFlushPromise.IsEmpty()) { + // A Flush is pending, abort the current operation. + mFlushPromise.Resolve(true, __func__); + return; + } - DecodeFirstSample(sample); - }, - [self, this](const MediaResult& aError) { - mInitPromiseRequest.Complete(); + DecodeFirstSample(sample); + }, + [self, this](const MediaResult& aError) { + mInitPromiseRequest.Complete(); - if (!mFlushPromise.IsEmpty()) { - // A Flush is pending, abort the current operation. - mFlushPromise.Reject(aError, __func__); - return; - } + if (!mFlushPromise.IsEmpty()) { + // A Flush is pending, abort the current operation. + mFlushPromise.Reject(aError, __func__); + return; + } - mDecodePromise.Reject( - MediaResult( - NS_ERROR_DOM_MEDIA_FATAL_ERR, - RESULT_DETAIL("Unable to initialize H264 decoder")), - __func__); - }) + mDecodePromise.Reject( + MediaResult( + NS_ERROR_DOM_MEDIA_FATAL_ERR, + RESULT_DETAIL("Unable to initialize H264 decoder")), + __func__); + }) ->Track(mInitPromiseRequest); return NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER; } @@ -545,18 +544,17 @@ void MediaChangeMonitor::DecodeFirstSample(MediaRawData* aSample) { RefPtr self = this; mDecoder->Decode(aSample) - ->Then( - mTaskQueue, __func__, - [self, this](MediaDataDecoder::DecodedData&& aResults) { - mDecodePromiseRequest.Complete(); - mPendingFrames.AppendElements(std::move(aResults)); - mDecodePromise.Resolve(std::move(mPendingFrames), __func__); - mPendingFrames = DecodedData(); - }, - [self, this](const MediaResult& aError) { - mDecodePromiseRequest.Complete(); - mDecodePromise.Reject(aError, __func__); - }) + ->Then(mTaskQueue, __func__, + [self, this](MediaDataDecoder::DecodedData&& aResults) { + mDecodePromiseRequest.Complete(); + mPendingFrames.AppendElements(std::move(aResults)); + mDecodePromise.Resolve(std::move(mPendingFrames), __func__); + mPendingFrames = DecodedData(); + }, + [self, this](const MediaResult& aError) { + mDecodePromiseRequest.Complete(); + mDecodePromise.Reject(aError, __func__); + }) ->Track(mDecodePromiseRequest); } @@ -591,33 +589,32 @@ void MediaChangeMonitor::DrainThenFlushDecoder(MediaRawData* aPendingSample) { RefPtr sample = aPendingSample; RefPtr self = this; mDecoder->Drain() - ->Then( - mTaskQueue, __func__, - [self, sample, this](MediaDataDecoder::DecodedData&& aResults) { - mDrainRequest.Complete(); - if (!mFlushPromise.IsEmpty()) { - // A Flush is pending, abort the current operation. - mFlushPromise.Resolve(true, __func__); - return; - } - if (aResults.Length() > 0) { - mPendingFrames.AppendElements(std::move(aResults)); - DrainThenFlushDecoder(sample); - return; - } - // We've completed the draining operation, we can now flush the - // decoder. - FlushThenShutdownDecoder(sample); - }, - [self, this](const MediaResult& aError) { - mDrainRequest.Complete(); - if (!mFlushPromise.IsEmpty()) { - // A Flush is pending, abort the current operation. - mFlushPromise.Reject(aError, __func__); - return; - } - mDecodePromise.Reject(aError, __func__); - }) + ->Then(mTaskQueue, __func__, + [self, sample, this](MediaDataDecoder::DecodedData&& aResults) { + mDrainRequest.Complete(); + if (!mFlushPromise.IsEmpty()) { + // A Flush is pending, abort the current operation. + mFlushPromise.Resolve(true, __func__); + return; + } + if (aResults.Length() > 0) { + mPendingFrames.AppendElements(std::move(aResults)); + DrainThenFlushDecoder(sample); + return; + } + // We've completed the draining operation, we can now flush the + // decoder. + FlushThenShutdownDecoder(sample); + }, + [self, this](const MediaResult& aError) { + mDrainRequest.Complete(); + if (!mFlushPromise.IsEmpty()) { + // A Flush is pending, abort the current operation. + mFlushPromise.Reject(aError, __func__); + return; + } + mDecodePromise.Reject(aError, __func__); + }) ->Track(mDrainRequest); } @@ -628,53 +625,51 @@ void MediaChangeMonitor::FlushThenShutdownDecoder( RefPtr sample = aPendingSample; RefPtr self = this; mDecoder->Flush() - ->Then( - mTaskQueue, __func__, - [self, sample, this]() { - mFlushRequest.Complete(); + ->Then(mTaskQueue, __func__, + [self, sample, this]() { + mFlushRequest.Complete(); - if (!mFlushPromise.IsEmpty()) { - // A Flush is pending, abort the current operation. - mFlushPromise.Resolve(true, __func__); - return; - } + if (!mFlushPromise.IsEmpty()) { + // A Flush is pending, abort the current operation. + mFlushPromise.Resolve(true, __func__); + return; + } - mShutdownPromise = ShutdownDecoder(); - mShutdownPromise - ->Then( - mTaskQueue, __func__, - [self, sample, this]() { - mShutdownRequest.Complete(); - mShutdownPromise = nullptr; + mShutdownPromise = ShutdownDecoder(); + mShutdownPromise + ->Then(mTaskQueue, __func__, + [self, sample, this]() { + mShutdownRequest.Complete(); + mShutdownPromise = nullptr; - if (!mFlushPromise.IsEmpty()) { - // A Flush is pending, abort the current - // operation. - mFlushPromise.Resolve(true, __func__); - return; - } + if (!mFlushPromise.IsEmpty()) { + // A Flush is pending, abort the current + // operation. + mFlushPromise.Resolve(true, __func__); + return; + } - MediaResult rv = CreateDecoderAndInit(sample); - if (rv == NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER) { - // All good so far, will continue later. - return; - } - MOZ_ASSERT(NS_FAILED(rv)); - mDecodePromise.Reject(rv, __func__); - return; - }, - [] { MOZ_CRASH("Can't reach here'"); }) - ->Track(mShutdownRequest); - }, - [self, this](const MediaResult& aError) { - mFlushRequest.Complete(); - if (!mFlushPromise.IsEmpty()) { - // A Flush is pending, abort the current operation. - mFlushPromise.Reject(aError, __func__); - return; - } - mDecodePromise.Reject(aError, __func__); - }) + MediaResult rv = CreateDecoderAndInit(sample); + if (rv == NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER) { + // All good so far, will continue later. + return; + } + MOZ_ASSERT(NS_FAILED(rv)); + mDecodePromise.Reject(rv, __func__); + return; + }, + [] { MOZ_CRASH("Can't reach here'"); }) + ->Track(mShutdownRequest); + }, + [self, this](const MediaResult& aError) { + mFlushRequest.Complete(); + if (!mFlushPromise.IsEmpty()) { + // A Flush is pending, abort the current operation. + mFlushPromise.Reject(aError, __func__); + return; + } + mDecodePromise.Reject(aError, __func__); + }) ->Track(mFlushRequest); } diff --git a/dom/media/systemservices/MediaUtils.h b/dom/media/systemservices/MediaUtils.h index 3831341ad664..09becaa7ce77 100644 --- a/dom/media/systemservices/MediaUtils.h +++ b/dom/media/systemservices/MediaUtils.h @@ -224,20 +224,19 @@ Await(already_AddRefed aPool, typename MozPromise::ResolveOrRejectValue val; - aPromise->Then( - taskQueue, __func__, - [&](ResolveValueType aResolveValue) { - val.SetResolve(std::move(aResolveValue)); - MonitorAutoLock lock(mon); - done = true; - mon.Notify(); - }, - [&](RejectValueType aRejectValue) { - val.SetReject(std::move(aRejectValue)); - MonitorAutoLock lock(mon); - done = true; - mon.Notify(); - }); + aPromise->Then(taskQueue, __func__, + [&](ResolveValueType aResolveValue) { + val.SetResolve(std::move(aResolveValue)); + MonitorAutoLock lock(mon); + done = true; + mon.Notify(); + }, + [&](RejectValueType aRejectValue) { + val.SetReject(std::move(aRejectValue)); + MonitorAutoLock lock(mon); + done = true; + mon.Notify(); + }); MonitorAutoLock lock(mon); while (!done) { diff --git a/dom/media/webaudio/blink/DenormalDisabler.h b/dom/media/webaudio/blink/DenormalDisabler.h index b7a3ca321c25..51f56bd8af28 100644 --- a/dom/media/webaudio/blink/DenormalDisabler.h +++ b/dom/media/webaudio/blink/DenormalDisabler.h @@ -107,18 +107,18 @@ class DenormalDisabler { inline int getStatusWord() { int result; # if defined(__aarch64__) - asm volatile("mrs %x[result], FPCR" : [ result ] "=r"(result)); + asm volatile("mrs %x[result], FPCR" : [result] "=r"(result)); # else - asm volatile("vmrs %[result], FPSCR" : [ result ] "=r"(result)); + asm volatile("vmrs %[result], FPSCR" : [result] "=r"(result)); # endif return result; } inline void setStatusWord(int a) { # if defined(__aarch64__) - asm volatile("msr FPCR, %x[src]" : : [ src ] "r"(a)); + asm volatile("msr FPCR, %x[src]" : : [src] "r"(a)); # else - asm volatile("vmsr FPSCR, %[src]" : : [ src ] "r"(a)); + asm volatile("vmsr FPSCR, %[src]" : : [src] "r"(a)); # endif } diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp index 7ae95b12d161..311408d93c99 100644 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp @@ -538,9 +538,7 @@ int MediaEngineRemoteVideoSource::DeliverFrame( } break; } - default: { - break; - } + default: { break; } } rtc::Callback0 callback_unused; diff --git a/dom/media/webspeech/recognition/SpeechRecognition.cpp b/dom/media/webspeech/recognition/SpeechRecognition.cpp index 1d106c749a44..186777983ec7 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.cpp +++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp @@ -679,30 +679,29 @@ void SpeechRecognition::Start(const Optional>& aStream, RefPtr self(this); MediaManager::Get() ->GetUserMedia(GetOwner(), constraints, aCallerType) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [this, self](RefPtr&& aStream) { - mStream = std::move(aStream); - mStream->RegisterTrackListener(this); - nsTArray> tracks; - mStream->GetAudioTracks(tracks); - for (const RefPtr& track : tracks) { - if (!track->Ended()) { - NotifyTrackAdded(track); - } - } - }, - [this, self](RefPtr&& error) { - SpeechRecognitionErrorCode errorCode; + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [this, self](RefPtr&& aStream) { + mStream = std::move(aStream); + mStream->RegisterTrackListener(this); + nsTArray> tracks; + mStream->GetAudioTracks(tracks); + for (const RefPtr& track : tracks) { + if (!track->Ended()) { + NotifyTrackAdded(track); + } + } + }, + [this, self](RefPtr&& error) { + SpeechRecognitionErrorCode errorCode; - if (error->mName == MediaMgrError::Name::NotAllowedError) { - errorCode = SpeechRecognitionErrorCode::Not_allowed; - } else { - errorCode = SpeechRecognitionErrorCode::Audio_capture; - } - DispatchError(SpeechRecognition::EVENT_AUDIO_ERROR, errorCode, - error->mMessage); - }); + if (error->mName == MediaMgrError::Name::NotAllowedError) { + errorCode = SpeechRecognitionErrorCode::Not_allowed; + } else { + errorCode = SpeechRecognitionErrorCode::Audio_capture; + } + DispatchError(SpeechRecognition::EVENT_AUDIO_ERROR, errorCode, + error->mMessage); + }); } RefPtr event = new SpeechEvent(this, EVENT_START); diff --git a/dom/payments/PaymentActionResponse.cpp b/dom/payments/PaymentActionResponse.cpp index 86416b1e9198..026c0cffd7cb 100644 --- a/dom/payments/PaymentActionResponse.cpp +++ b/dom/payments/PaymentActionResponse.cpp @@ -268,9 +268,7 @@ PaymentShowActionResponse::Init(const nsAString& aRequestId, } break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } } mData = aData; diff --git a/dom/payments/PaymentMethodChangeEvent.cpp b/dom/payments/PaymentMethodChangeEvent.cpp index 86966905fc02..7fe4d9d123bd 100644 --- a/dom/payments/PaymentMethodChangeEvent.cpp +++ b/dom/payments/PaymentMethodChangeEvent.cpp @@ -143,9 +143,7 @@ void PaymentMethodChangeEvent::GetMethodDetails( aRetVal.set(&value.toObject()); break; } - default: { - break; - } + default: { break; } } } diff --git a/dom/payments/PaymentRequestManager.cpp b/dom/payments/PaymentRequestManager.cpp index 0eacbec3b528..1778591a2150 100644 --- a/dom/payments/PaymentRequestManager.cpp +++ b/dom/payments/PaymentRequestManager.cpp @@ -264,9 +264,7 @@ void ConvertResponseData(const IPCPaymentResponseData& aIPCData, aData = bData; break; } - default: { - break; - } + default: { break; } } } @@ -303,9 +301,7 @@ void ConvertMethodChangeDetails(const IPCMethodChangeDetails& aIPCDetails, aDetails = bDetails; break; } - default: { - break; - } + default: { break; } } } } // end of namespace @@ -685,9 +681,7 @@ nsresult PaymentRequestManager::RespondPayment( NotifyRequestDone(aRequest); break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } return NS_OK; } diff --git a/dom/payments/PaymentRequestService.cpp b/dom/payments/PaymentRequestService.cpp index 4bf4dd163f83..1d5c7bbcf840 100644 --- a/dom/payments/PaymentRequestService.cpp +++ b/dom/payments/PaymentRequestService.cpp @@ -178,9 +178,7 @@ nsresult PaymentRequestService::LaunchUIAction(const nsAString& aRequestId, rv = uiService->ClosePayment(aRequestId); break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -334,9 +332,7 @@ nsresult PaymentRequestService::RequestPayment( aRequestId, IPCPaymentActionRequest::TIPCPaymentUpdateActionRequest); break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } return NS_OK; } @@ -422,9 +418,7 @@ PaymentRequestService::RespondPayment(nsIPaymentActionResponse* aResponse) { mRequestQueue.RemoveElement(request); break; } - default: { - break; - } + default: { break; } } return NS_OK; } diff --git a/dom/payments/ipc/PaymentRequestParent.cpp b/dom/payments/ipc/PaymentRequestParent.cpp index 01a312a1d16e..effe6e96ffc6 100644 --- a/dom/payments/ipc/PaymentRequestParent.cpp +++ b/dom/payments/ipc/PaymentRequestParent.cpp @@ -66,9 +66,7 @@ mozilla::ipc::IPCResult PaymentRequestParent::RecvRequestPayment( mRequestId = request.requestId(); break; } - default: { - return IPC_FAIL(this, "Unknown PaymentRequest action type"); - } + default: { return IPC_FAIL(this, "Unknown PaymentRequest action type"); } } nsCOMPtr service = do_GetService(NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID); @@ -178,9 +176,7 @@ nsresult PaymentRequestParent::RespondPayment( } break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } return NS_OK; } @@ -314,9 +310,7 @@ nsresult PaymentRequestParent::ChangePaymentMethod( ipcChangeDetails = ipcBasicCardDetails; break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } } if (!SendChangePaymentMethod(requestId, methodName, ipcChangeDetails)) { @@ -460,9 +454,7 @@ nsresult PaymentRequestParent::SerializeResponseData( aIPCData = data; break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } return NS_OK; } diff --git a/dom/prio/test/gtest/TestPrioEncoder.cpp b/dom/prio/test/gtest/TestPrioEncoder.cpp index d2714937dd6b..1e90559eaaff 100644 --- a/dom/prio/test/gtest/TestPrioEncoder.cpp +++ b/dom/prio/test/gtest/TestPrioEncoder.cpp @@ -14,8 +14,7 @@ #include "mprio.h" -TEST(PrioEncoder, BadPublicKeys) -{ +TEST(PrioEncoder, BadPublicKeys) { mozilla::dom::AutoJSAPI jsAPI; ASSERT_TRUE(jsAPI.Init(xpc::PrivilegedJunkScope())); JSContext* cx = jsAPI.cx(); @@ -47,8 +46,7 @@ TEST(PrioEncoder, BadPublicKeys) rv = mozilla::ErrorResult(); } -TEST(PrioEncoder, BooleanLimitExceeded) -{ +TEST(PrioEncoder, BooleanLimitExceeded) { mozilla::dom::AutoJSAPI jsAPI; ASSERT_TRUE(jsAPI.Init(xpc::PrivilegedJunkScope())); JSContext* cx = jsAPI.cx(); @@ -83,8 +81,7 @@ TEST(PrioEncoder, BooleanLimitExceeded) rv = mozilla::ErrorResult(); } -TEST(PrioEncoder, VerifyFull) -{ +TEST(PrioEncoder, VerifyFull) { SECStatus prioRv = SECSuccess; PublicKey pkA = nullptr; diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index 02fae0d4fc0c..543461bb18e9 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -5602,9 +5602,7 @@ bool QuotaManager::IsPrincipalInfoValid(const PrincipalInfo& aPrincipalInfo) { return true; } - default: { - break; - } + default: { break; } } // Null and expanded principals are not acceptable. @@ -5645,9 +5643,7 @@ void QuotaManager::GetInfoFromValidatedPrincipalInfo( return; } - default: { - break; - } + default: { break; } } MOZ_CRASH("Should never get here!"); @@ -8241,9 +8237,7 @@ bool PrincipalVerifier::IsPrincipalInfoValid( return true; } - default: { - break; - } + default: { break; } } // Null and expanded principals are not acceptable. diff --git a/dom/quota/test/gtest/TestQuotaManager.cpp b/dom/quota/test/gtest/TestQuotaManager.cpp index 948da37cbf62..9f1cf274be95 100644 --- a/dom/quota/test/gtest/TestQuotaManager.cpp +++ b/dom/quota/test/gtest/TestQuotaManager.cpp @@ -27,8 +27,7 @@ void CheckOriginScopeMatchesOrigin(const OriginScope& aOriginScope, } // namespace -TEST(QuotaManager, OriginScope) -{ +TEST(QuotaManager, OriginScope) { OriginScope originScope; // Sanity checks. diff --git a/dom/reporting/tests/gtest/TestReportToParser.cpp b/dom/reporting/tests/gtest/TestReportToParser.cpp index 0bce790a5e6b..195f2653e17f 100644 --- a/dom/reporting/tests/gtest/TestReportToParser.cpp +++ b/dom/reporting/tests/gtest/TestReportToParser.cpp @@ -12,8 +12,7 @@ using namespace mozilla; using namespace mozilla::dom; -TEST(ReportToParser, Basic) -{ +TEST(ReportToParser, Basic) { nsCOMPtr uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), "https://example.com"); diff --git a/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp b/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp index 857792496084..2efbbd5ca9bb 100644 --- a/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp +++ b/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp @@ -32,8 +32,7 @@ void CheckParser(const nsAString& aInput, bool aExpectedResults, parsedFeatures.SwapElements(aParsedFeatures); } -TEST(FeaturePolicyParser, Basic) -{ +TEST(FeaturePolicyParser, Basic) { nsCOMPtr selfPrincipal = mozilla::BasePrincipal::CreateCodebasePrincipal(URL_SELF); nsCOMPtr exampleComPrincipal = diff --git a/dom/security/test/gtest/TestCSPParser.cpp b/dom/security/test/gtest/TestCSPParser.cpp index f9cf4404ddcb..a6d4884cbbef 100644 --- a/dom/security/test/gtest/TestCSPParser.cpp +++ b/dom/security/test/gtest/TestCSPParser.cpp @@ -176,8 +176,7 @@ nsresult runTestSuite(const PolicyTest* aPolicies, uint32_t aPolicyCount, // ============================= TestDirectives ======================== -TEST(CSPParser, Directives) -{ +TEST(CSPParser, Directives) { static const PolicyTest policies[] = { // clang-format off { "connect-src xn--mnchen-3ya.de", @@ -229,8 +228,7 @@ TEST(CSPParser, Directives) // ============================= TestKeywords ======================== -TEST(CSPParser, Keywords) -{ +TEST(CSPParser, Keywords) { static const PolicyTest policies[] = { // clang-format off { "script-src 'self'", @@ -254,8 +252,7 @@ TEST(CSPParser, Keywords) // =================== TestIgnoreUpperLowerCasePolicies ============== -TEST(CSPParser, IgnoreUpperLowerCasePolicies) -{ +TEST(CSPParser, IgnoreUpperLowerCasePolicies) { static const PolicyTest policies[] = { // clang-format off { "script-src 'SELF'", @@ -297,8 +294,7 @@ TEST(CSPParser, IgnoreUpperLowerCasePolicies) // ========================= TestPaths =============================== -TEST(CSPParser, Paths) -{ +TEST(CSPParser, Paths) { static const PolicyTest policies[] = { // clang-format off { "script-src http://www.example.com", @@ -396,8 +392,7 @@ TEST(CSPParser, Paths) // ======================== TestSimplePolicies ======================= -TEST(CSPParser, SimplePolicies) -{ +TEST(CSPParser, SimplePolicies) { static const PolicyTest policies[] = { // clang-format off { "default-src *", @@ -473,8 +468,7 @@ TEST(CSPParser, SimplePolicies) // =================== TestPoliciesWithInvalidSrc ==================== -TEST(CSPParser, PoliciesWithInvalidSrc) -{ +TEST(CSPParser, PoliciesWithInvalidSrc) { static const PolicyTest policies[] = { // clang-format off { "script-src 'self'; SCRIPT-SRC http://www.example.com", @@ -567,8 +561,7 @@ TEST(CSPParser, PoliciesWithInvalidSrc) // ============================= TestBadPolicies ======================= -TEST(CSPParser, BadPolicies) -{ +TEST(CSPParser, BadPolicies) { static const PolicyTest policies[] = { // clang-format off { "script-sr 'self", "" }, @@ -590,8 +583,7 @@ TEST(CSPParser, BadPolicies) // ======================= TestGoodGeneratedPolicies ================= -TEST(CSPParser, GoodGeneratedPolicies) -{ +TEST(CSPParser, GoodGeneratedPolicies) { static const PolicyTest policies[] = { // clang-format off { "default-src 'self'; img-src *", @@ -819,8 +811,7 @@ TEST(CSPParser, GoodGeneratedPolicies) // ==================== TestBadGeneratedPolicies ==================== -TEST(CSPParser, BadGeneratedPolicies) -{ +TEST(CSPParser, BadGeneratedPolicies) { static const PolicyTest policies[] = { // clang-format off { "foo.*.bar", ""}, @@ -846,8 +837,7 @@ TEST(CSPParser, BadGeneratedPolicies) // ============ TestGoodGeneratedPoliciesForPathHandling ============= -TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) -{ +TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) { // Once bug 808292 (Implement path-level host-source matching to CSP) // lands we have to update the expected output to include the parsed path @@ -970,8 +960,7 @@ TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) // ============== TestBadGeneratedPoliciesForPathHandling ============ -TEST(CSPParser, BadGeneratedPoliciesForPathHandling) -{ +TEST(CSPParser, BadGeneratedPoliciesForPathHandling) { static const PolicyTest policies[] = { // clang-format off { "img-src test1.example.com:88path-1/", @@ -1000,8 +989,7 @@ TEST(CSPParser, BadGeneratedPoliciesForPathHandling) // Use a policy, eliminate one character at a time, // and feed it as input to the parser. -TEST(CSPParser, ShorteningPolicies) -{ +TEST(CSPParser, ShorteningPolicies) { char pol[] = "default-src http://www.sub1.sub2.example.com:88/path1/path2/ " "'unsafe-inline' 'none'"; @@ -1028,8 +1016,7 @@ TEST(CSPParser, ShorteningPolicies) #if RUN_OFFLINE_TESTS -TEST(CSPParser, FuzzyPolicies) -{ +TEST(CSPParser, FuzzyPolicies) { // init srand with 0 so we get same results srand(0); @@ -1061,8 +1048,7 @@ TEST(CSPParser, FuzzyPolicies) #if RUN_OFFLINE_TESTS -TEST(CSPParser, FuzzyPoliciesIncDir) -{ +TEST(CSPParser, FuzzyPoliciesIncDir) { // init srand with 0 so we get same results srand(0); @@ -1100,8 +1086,7 @@ TEST(CSPParser, FuzzyPoliciesIncDir) #if RUN_OFFLINE_TESTS -TEST(CSPParser, FuzzyPoliciesIncDirLimASCII) -{ +TEST(CSPParser, FuzzyPoliciesIncDirLimASCII) { char input[] = "1234567890" "abcdefghijklmnopqrstuvwxyz" diff --git a/dom/security/test/gtest/TestSecureContext.cpp b/dom/security/test/gtest/TestSecureContext.cpp index 7c252b2dc5d0..d8b217b341de 100644 --- a/dom/security/test/gtest/TestSecureContext.cpp +++ b/dom/security/test/gtest/TestSecureContext.cpp @@ -26,8 +26,7 @@ struct TestExpectations { // ============================= TestDirectives ======================== -TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal) -{ +TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal) { // boolean isOriginPotentiallyTrustworthy(in nsIPrincipal aPrincipal); static const TestExpectations uris[] = { @@ -69,8 +68,7 @@ TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal) } } -TEST(SecureContext, IsOriginPotentiallyTrustworthyWithSystemPrincipal) -{ +TEST(SecureContext, IsOriginPotentiallyTrustworthyWithSystemPrincipal) { RefPtr ssManager = nsScriptSecurityManager::GetScriptSecurityManager(); ASSERT_TRUE(!!ssManager); @@ -86,8 +84,7 @@ TEST(SecureContext, IsOriginPotentiallyTrustworthyWithSystemPrincipal) ASSERT_TRUE(isPotentiallyTrustworthy); } -TEST(SecureContext, IsOriginPotentiallyTrustworthyWithNullPrincipal) -{ +TEST(SecureContext, IsOriginPotentiallyTrustworthyWithNullPrincipal) { RefPtr ssManager = nsScriptSecurityManager::GetScriptSecurityManager(); ASSERT_TRUE(!!ssManager); diff --git a/dom/serviceworkers/ServiceWorkerContainerImpl.cpp b/dom/serviceworkers/ServiceWorkerContainerImpl.cpp index aa9dd87ce6bc..c09f497dc48e 100644 --- a/dom/serviceworkers/ServiceWorkerContainerImpl.cpp +++ b/dom/serviceworkers/ServiceWorkerContainerImpl.cpp @@ -54,18 +54,17 @@ void ServiceWorkerContainerImpl::Register( global); swm->Register(aClientInfo, aScopeURL, aScriptURL, aUpdateViaCache) - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), - holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { - holder->Complete(); - successCB(aDescriptor); - }, - [failureCB = std::move(aFailureCB), - holder](const CopyableErrorResult& aResult) { - holder->Complete(); - failureCB(CopyableErrorResult(aResult)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), + holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { + holder->Complete(); + successCB(aDescriptor); + }, + [failureCB = std::move(aFailureCB), + holder](const CopyableErrorResult& aResult) { + holder->Complete(); + failureCB(CopyableErrorResult(aResult)); + }) ->Track(*holder); } @@ -92,18 +91,17 @@ void ServiceWorkerContainerImpl::GetRegistration( global); swm->GetRegistration(aClientInfo, aURL) - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), - holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { - holder->Complete(); - successCB(aDescriptor); - }, - [failureCB = std::move(aFailureCB), - holder](const CopyableErrorResult& aResult) { - holder->Complete(); - failureCB(CopyableErrorResult(aResult)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), + holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { + holder->Complete(); + successCB(aDescriptor); + }, + [failureCB = std::move(aFailureCB), + holder](const CopyableErrorResult& aResult) { + holder->Complete(); + failureCB(CopyableErrorResult(aResult)); + }) ->Track(*holder); } @@ -129,18 +127,17 @@ void ServiceWorkerContainerImpl::GetRegistrations( DOMMozPromiseRequestHolder>(global); swm->GetRegistrations(aClientInfo) - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), - holder](const nsTArray& aList) { - holder->Complete(); - successCB(aList); - }, - [failureCB = std::move(aFailureCB), - holder](const CopyableErrorResult& aResult) { - holder->Complete(); - failureCB(CopyableErrorResult(aResult)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), holder]( + const nsTArray& aList) { + holder->Complete(); + successCB(aList); + }, + [failureCB = std::move(aFailureCB), + holder](const CopyableErrorResult& aResult) { + holder->Complete(); + failureCB(CopyableErrorResult(aResult)); + }) ->Track(*holder); } @@ -167,18 +164,17 @@ void ServiceWorkerContainerImpl::GetReady( global); swm->WhenReady(aClientInfo) - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), - holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { - holder->Complete(); - successCB(aDescriptor); - }, - [failureCB = std::move(aFailureCB), - holder](const CopyableErrorResult& aResult) { - holder->Complete(); - failureCB(CopyableErrorResult(aResult)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), + holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { + holder->Complete(); + successCB(aDescriptor); + }, + [failureCB = std::move(aFailureCB), + holder](const CopyableErrorResult& aResult) { + holder->Complete(); + failureCB(CopyableErrorResult(aResult)); + }) ->Track(*holder); } diff --git a/dom/serviceworkers/ServiceWorkerContainerParent.cpp b/dom/serviceworkers/ServiceWorkerContainerParent.cpp index 2000ee218755..336b31bf0595 100644 --- a/dom/serviceworkers/ServiceWorkerContainerParent.cpp +++ b/dom/serviceworkers/ServiceWorkerContainerParent.cpp @@ -79,19 +79,18 @@ IPCResult ServiceWorkerContainerParent::RecvGetRegistrations( } mProxy->GetRegistrations(ClientInfo(aClientInfo)) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [aResolver]( - const nsTArray& aList) { - IPCServiceWorkerRegistrationDescriptorList ipcList; - for (auto& desc : aList) { - ipcList.values().AppendElement(desc.ToIPC()); - } - aResolver(std::move(ipcList)); - }, - [aResolver](const CopyableErrorResult& aResult) { - aResolver(aResult); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [aResolver]( + const nsTArray& aList) { + IPCServiceWorkerRegistrationDescriptorList ipcList; + for (auto& desc : aList) { + ipcList.values().AppendElement(desc.ToIPC()); + } + aResolver(std::move(ipcList)); + }, + [aResolver](const CopyableErrorResult& aResult) { + aResolver(aResult); + }); return IPC_OK(); } diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp index 0d3be76e1f9f..38051a0581ff 100644 --- a/dom/serviceworkers/ServiceWorkerManager.cpp +++ b/dom/serviceworkers/ServiceWorkerManager.cpp @@ -2452,15 +2452,14 @@ void ServiceWorkerManager::UpdateClientControllers( // If we fail to control the client, then automatically remove it // from our list of controlled clients. - p->Then( - SystemGroup::EventTargetFor(TaskCategory::Other), __func__, - [](bool) { - // do nothing on success - }, - [self, clientInfo = handle->Info()](nsresult aRv) { - // failed to control, forget about this client - self->StopControllingClient(clientInfo); - }); + p->Then(SystemGroup::EventTargetFor(TaskCategory::Other), __func__, + [](bool) { + // do nothing on success + }, + [self, clientInfo = handle->Info()](nsresult aRv) { + // failed to control, forget about this client + self->StopControllingClient(clientInfo); + }); } } diff --git a/dom/serviceworkers/ServiceWorkerRegistrationImpl.cpp b/dom/serviceworkers/ServiceWorkerRegistrationImpl.cpp index fdf4fb7bb434..ae402caf35de 100644 --- a/dom/serviceworkers/ServiceWorkerRegistrationImpl.cpp +++ b/dom/serviceworkers/ServiceWorkerRegistrationImpl.cpp @@ -504,18 +504,17 @@ void ServiceWorkerRegistrationMainThread::Update( global); cb->Promise() - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), - holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { - holder->Complete(); - successCB(aDescriptor); - }, - [failureCB = std::move(aFailureCB), - holder](const CopyableErrorResult& aRv) { - holder->Complete(); - failureCB(CopyableErrorResult(aRv)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), + holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { + holder->Complete(); + successCB(aDescriptor); + }, + [failureCB = std::move(aFailureCB), + holder](const CopyableErrorResult& aRv) { + holder->Complete(); + failureCB(CopyableErrorResult(aRv)); + }) ->Track(*holder); } @@ -556,16 +555,15 @@ void ServiceWorkerRegistrationMainThread::Unregister( auto holder = MakeRefPtr>(global); cb->Promise() - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), holder](bool aResult) { - holder->Complete(); - successCB(aResult); - }, - [failureCB = std::move(aFailureCB), holder](nsresult aRv) { - holder->Complete(); - failureCB(CopyableErrorResult(aRv)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), holder](bool aResult) { + holder->Complete(); + successCB(aResult); + }, + [failureCB = std::move(aFailureCB), holder](nsresult aRv) { + holder->Complete(); + failureCB(CopyableErrorResult(aRv)); + }) ->Track(*holder); } @@ -771,18 +769,17 @@ void ServiceWorkerRegistrationWorkerThread::Update( global); promise - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), - holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { - holder->Complete(); - successCB(aDescriptor); - }, - [failureCB = std::move(aFailureCB), - holder](const CopyableErrorResult& aRv) { - holder->Complete(); - failureCB(CopyableErrorResult(aRv)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), + holder](const ServiceWorkerRegistrationDescriptor& aDescriptor) { + holder->Complete(); + successCB(aDescriptor); + }, + [failureCB = std::move(aFailureCB), + holder](const CopyableErrorResult& aRv) { + holder->Complete(); + failureCB(CopyableErrorResult(aRv)); + }) ->Track(*holder); RefPtr r = new SWRUpdateRunnable( @@ -827,16 +824,15 @@ void ServiceWorkerRegistrationWorkerThread::Unregister( auto holder = MakeRefPtr>(global); promise - ->Then( - global->EventTargetFor(TaskCategory::Other), __func__, - [successCB = std::move(aSuccessCB), holder](bool aResult) { - holder->Complete(); - successCB(aResult); - }, - [failureCB = std::move(aFailureCB), holder](nsresult aRv) { - holder->Complete(); - failureCB(CopyableErrorResult(aRv)); - }) + ->Then(global->EventTargetFor(TaskCategory::Other), __func__, + [successCB = std::move(aSuccessCB), holder](bool aResult) { + holder->Complete(); + successCB(aResult); + }, + [failureCB = std::move(aFailureCB), holder](nsresult aRv) { + holder->Complete(); + failureCB(CopyableErrorResult(aRv)); + }) ->Track(*holder); RefPtr r = diff --git a/dom/serviceworkers/test/gtest/TestReadWrite.cpp b/dom/serviceworkers/test/gtest/TestReadWrite.cpp index 19b8930458b2..a29c55abf2ea 100644 --- a/dom/serviceworkers/test/gtest/TestReadWrite.cpp +++ b/dom/serviceworkers/test/gtest/TestReadWrite.cpp @@ -81,11 +81,9 @@ bool CreateFile(const nsACString& aData) { return true; } -TEST(ServiceWorkerRegistrar, TestNoFile) -{ +TEST(ServiceWorkerRegistrar, TestNoFile) { nsCOMPtr file = GetFile(); - ASSERT_TRUE(file) - << "GetFile must return a nsIFIle"; + ASSERT_TRUE(file) << "GetFile must return a nsIFIle"; bool exists; nsresult rv = file->Exists(&exists); @@ -106,10 +104,8 @@ TEST(ServiceWorkerRegistrar, TestNoFile) << "No data should be found in an empty file"; } -TEST(ServiceWorkerRegistrar, TestEmptyFile) -{ - ASSERT_TRUE(CreateFile(EmptyCString())) - << "CreateFile should not fail"; +TEST(ServiceWorkerRegistrar, TestEmptyFile) { + ASSERT_TRUE(CreateFile(EmptyCString())) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -121,11 +117,10 @@ TEST(ServiceWorkerRegistrar, TestEmptyFile) << "No data should be found in an empty file"; } -TEST(ServiceWorkerRegistrar, TestRightVersionFile) -{ +TEST(ServiceWorkerRegistrar, TestRightVersionFile) { ASSERT_TRUE( CreateFile(NS_LITERAL_CSTRING(SERVICEWORKERREGISTRAR_VERSION "\n"))) - << "CreateFile should not fail"; + << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -138,11 +133,10 @@ TEST(ServiceWorkerRegistrar, TestRightVersionFile) << "No data should be found in an empty file"; } -TEST(ServiceWorkerRegistrar, TestWrongVersionFile) -{ +TEST(ServiceWorkerRegistrar, TestWrongVersionFile) { ASSERT_TRUE( CreateFile(NS_LITERAL_CSTRING(SERVICEWORKERREGISTRAR_VERSION "bla\n"))) - << "CreateFile should not fail"; + << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -155,8 +149,7 @@ TEST(ServiceWorkerRegistrar, TestWrongVersionFile) << "No data should be found in an empty file"; } -TEST(ServiceWorkerRegistrar, TestReadData) -{ +TEST(ServiceWorkerRegistrar, TestReadData) { nsAutoCString buffer(SERVICEWORKERREGISTRAR_VERSION "\n"); buffer.AppendLiteral("^appId=123&inBrowser=1\n"); @@ -189,8 +182,7 @@ TEST(ServiceWorkerRegistrar, TestReadData) buffer.AppendLiteral("\n"); buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -241,10 +233,9 @@ TEST(ServiceWorkerRegistrar, TestReadData) ASSERT_EQ((int64_t)ts, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestDeleteData) -{ +TEST(ServiceWorkerRegistrar, TestDeleteData) { ASSERT_TRUE(CreateFile(NS_LITERAL_CSTRING("Foobar"))) - << "CreateFile should not fail"; + << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -259,8 +250,7 @@ TEST(ServiceWorkerRegistrar, TestDeleteData) ASSERT_FALSE(exists) << "The file should not exist after a DeleteData()."; } -TEST(ServiceWorkerRegistrar, TestWriteData) -{ +TEST(ServiceWorkerRegistrar, TestWriteData) { { RefPtr swr = new ServiceWorkerRegistrarTest; @@ -342,8 +332,7 @@ TEST(ServiceWorkerRegistrar, TestWriteData) } } -TEST(ServiceWorkerRegistrar, TestVersion2Migration) -{ +TEST(ServiceWorkerRegistrar, TestVersion2Migration) { nsAutoCString buffer( "2" "\n"); @@ -360,8 +349,7 @@ TEST(ServiceWorkerRegistrar, TestVersion2Migration) "1\nactiveCache 1\nwaitingCache 1\n"); buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -414,8 +402,7 @@ TEST(ServiceWorkerRegistrar, TestVersion2Migration) ASSERT_EQ((int64_t)0, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestVersion3Migration) -{ +TEST(ServiceWorkerRegistrar, TestVersion3Migration) { nsAutoCString buffer( "3" "\n"); @@ -430,8 +417,7 @@ TEST(ServiceWorkerRegistrar, TestVersion3Migration) "spec 1\nhttps://scope_1.org\ncurrentWorkerURL 1\ncacheName 1\n"); buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -482,8 +468,7 @@ TEST(ServiceWorkerRegistrar, TestVersion3Migration) ASSERT_EQ((int64_t)0, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestVersion4Migration) -{ +TEST(ServiceWorkerRegistrar, TestVersion4Migration) { nsAutoCString buffer( "4" "\n"); @@ -498,8 +483,7 @@ TEST(ServiceWorkerRegistrar, TestVersion4Migration) "https://scope_1.org\ncurrentWorkerURL 1\ncacheName 1\n"); buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -552,8 +536,7 @@ TEST(ServiceWorkerRegistrar, TestVersion4Migration) ASSERT_EQ((int64_t)0, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestVersion5Migration) -{ +TEST(ServiceWorkerRegistrar, TestVersion5Migration) { nsAutoCString buffer( "5" "\n"); @@ -570,8 +553,7 @@ TEST(ServiceWorkerRegistrar, TestVersion5Migration) buffer.AppendLiteral("cacheName 1\n"); buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -622,8 +604,7 @@ TEST(ServiceWorkerRegistrar, TestVersion5Migration) ASSERT_EQ((int64_t)0, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestVersion6Migration) -{ +TEST(ServiceWorkerRegistrar, TestVersion6Migration) { nsAutoCString buffer( "6" "\n"); @@ -644,8 +625,7 @@ TEST(ServiceWorkerRegistrar, TestVersion6Migration) buffer.AppendLiteral("\n"); buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -696,8 +676,7 @@ TEST(ServiceWorkerRegistrar, TestVersion6Migration) ASSERT_EQ((int64_t)0, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestVersion7Migration) -{ +TEST(ServiceWorkerRegistrar, TestVersion7Migration) { nsAutoCString buffer( "7" "\n"); @@ -731,8 +710,7 @@ TEST(ServiceWorkerRegistrar, TestVersion7Migration) buffer.AppendLiteral("\n"); buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -783,8 +761,7 @@ TEST(ServiceWorkerRegistrar, TestVersion7Migration) ASSERT_EQ((int64_t)ts, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestDedupeRead) -{ +TEST(ServiceWorkerRegistrar, TestDedupeRead) { nsAutoCString buffer( "3" "\n"); @@ -816,8 +793,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeRead) "spec 3\nhttps://scope_1.org\ncurrentWorkerURL 1\ncacheName 1\n"); buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - ASSERT_TRUE(CreateFile(buffer)) - << "CreateFile should not fail"; + ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail"; RefPtr swr = new ServiceWorkerRegistrarTest; @@ -868,8 +844,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeRead) ASSERT_EQ((int64_t)0, data[1].lastUpdateTime()); } -TEST(ServiceWorkerRegistrar, TestDedupeWrite) -{ +TEST(ServiceWorkerRegistrar, TestDedupeWrite) { { RefPtr swr = new ServiceWorkerRegistrarTest; diff --git a/dom/webauthn/U2FTokenManager.cpp b/dom/webauthn/U2FTokenManager.cpp index 5b9bd2322cc1..4a62a028f514 100644 --- a/dom/webauthn/U2FTokenManager.cpp +++ b/dom/webauthn/U2FTokenManager.cpp @@ -333,23 +333,22 @@ void U2FTokenManager::DoRegister(const WebAuthnMakeCredentialInfo& aInfo, mozilla::TimeStamp startTime = mozilla::TimeStamp::Now(); mTokenManagerImpl->Register(aInfo, aForceNoneAttestation) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [tid, startTime](WebAuthnMakeCredentialResult&& aResult) { - U2FTokenManager* mgr = U2FTokenManager::Get(); - mgr->MaybeConfirmRegister(tid, aResult); - Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, - NS_LITERAL_STRING("U2FRegisterFinish"), 1); - Telemetry::AccumulateTimeDelta( - Telemetry::WEBAUTHN_CREATE_CREDENTIAL_MS, startTime); - }, - [tid](nsresult rv) { - MOZ_ASSERT(NS_FAILED(rv)); - U2FTokenManager* mgr = U2FTokenManager::Get(); - mgr->MaybeAbortRegister(tid, rv); - Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, - NS_LITERAL_STRING("U2FRegisterAbort"), 1); - }) + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [tid, startTime](WebAuthnMakeCredentialResult&& aResult) { + U2FTokenManager* mgr = U2FTokenManager::Get(); + mgr->MaybeConfirmRegister(tid, aResult); + Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, + NS_LITERAL_STRING("U2FRegisterFinish"), 1); + Telemetry::AccumulateTimeDelta( + Telemetry::WEBAUTHN_CREATE_CREDENTIAL_MS, startTime); + }, + [tid](nsresult rv) { + MOZ_ASSERT(NS_FAILED(rv)); + U2FTokenManager* mgr = U2FTokenManager::Get(); + mgr->MaybeAbortRegister(tid, rv); + Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, + NS_LITERAL_STRING("U2FRegisterAbort"), 1); + }) ->Track(mRegisterPromise); } @@ -392,23 +391,22 @@ void U2FTokenManager::Sign(PWebAuthnTransactionParent* aTransactionParent, mozilla::TimeStamp startTime = mozilla::TimeStamp::Now(); mTokenManagerImpl->Sign(aTransactionInfo) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [tid, startTime](WebAuthnGetAssertionResult&& aResult) { - U2FTokenManager* mgr = U2FTokenManager::Get(); - mgr->MaybeConfirmSign(tid, aResult); - Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, - NS_LITERAL_STRING("U2FSignFinish"), 1); - Telemetry::AccumulateTimeDelta(Telemetry::WEBAUTHN_GET_ASSERTION_MS, - startTime); - }, - [tid](nsresult rv) { - MOZ_ASSERT(NS_FAILED(rv)); - U2FTokenManager* mgr = U2FTokenManager::Get(); - mgr->MaybeAbortSign(tid, rv); - Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, - NS_LITERAL_STRING("U2FSignAbort"), 1); - }) + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [tid, startTime](WebAuthnGetAssertionResult&& aResult) { + U2FTokenManager* mgr = U2FTokenManager::Get(); + mgr->MaybeConfirmSign(tid, aResult); + Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, + NS_LITERAL_STRING("U2FSignFinish"), 1); + Telemetry::AccumulateTimeDelta( + Telemetry::WEBAUTHN_GET_ASSERTION_MS, startTime); + }, + [tid](nsresult rv) { + MOZ_ASSERT(NS_FAILED(rv)); + U2FTokenManager* mgr = U2FTokenManager::Get(); + mgr->MaybeAbortSign(tid, rv); + Telemetry::ScalarAdd(Telemetry::ScalarID::SECURITY_WEBAUTHN_USED, + NS_LITERAL_STRING("U2FSignAbort"), 1); + }) ->Track(mSignPromise); } diff --git a/dom/workers/WorkerDebugger.cpp b/dom/workers/WorkerDebugger.cpp index 2f5c91fdebbf..48ef2c212b08 100644 --- a/dom/workers/WorkerDebugger.cpp +++ b/dom/workers/WorkerDebugger.cpp @@ -517,19 +517,18 @@ RefPtr WorkerDebugger::ReportPerformanceInfo() { SystemGroup::AbstractMainThreadFor(TaskCategory::Performance); return CollectMemoryInfo(top, mainThread) - ->Then( - mainThread, __func__, - [workerRef, url, pid, perfId, windowID, duration, isTopLevel, - items](const PerformanceMemoryInfo& aMemoryInfo) { - return PerformanceInfoPromise::CreateAndResolve( - PerformanceInfo(url, pid, windowID, duration, perfId, true, - isTopLevel, aMemoryInfo, items), - __func__); - }, - [workerRef]() { - return PerformanceInfoPromise::CreateAndReject(NS_ERROR_FAILURE, - __func__); - }); + ->Then(mainThread, __func__, + [workerRef, url, pid, perfId, windowID, duration, isTopLevel, + items](const PerformanceMemoryInfo& aMemoryInfo) { + return PerformanceInfoPromise::CreateAndResolve( + PerformanceInfo(url, pid, windowID, duration, perfId, true, + isTopLevel, aMemoryInfo, items), + __func__); + }, + [workerRef]() { + return PerformanceInfoPromise::CreateAndReject(NS_ERROR_FAILURE, + __func__); + }); } } // namespace dom diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp index d49fb2c38a6c..686d0e7ac5cb 100644 --- a/dom/xhr/XMLHttpRequestMainThread.cpp +++ b/dom/xhr/XMLHttpRequestMainThread.cpp @@ -1491,8 +1491,8 @@ nsresult XMLHttpRequestMainThread::StreamReaderFunc( xmlHttpRequest->MaybeCreateBlobStorage(); rv = xmlHttpRequest->mBlobStorage->Append(fromRawSegment, count); } else if (xmlHttpRequest->mResponseType == - XMLHttpRequestResponseType::Arraybuffer && - !xmlHttpRequest->mIsMappedArrayBuffer) { + XMLHttpRequestResponseType::Arraybuffer && + !xmlHttpRequest->mIsMappedArrayBuffer) { // get the initial capacity to something reasonable to avoid a bunch of // reallocs right at the start if (xmlHttpRequest->mArrayBufferBuilder.capacity() == 0) diff --git a/dom/xslt/xml/txXMLUtils.cpp b/dom/xslt/xml/txXMLUtils.cpp index 0688939ccb25..209f42f39a14 100644 --- a/dom/xslt/xml/txXMLUtils.cpp +++ b/dom/xslt/xml/txXMLUtils.cpp @@ -130,9 +130,7 @@ void XMLUtils::normalizePIValue(nsAString& piValue) { } break; } - default: { - break; - } + default: { break; } } piValue.Append(ch); prevCh = ch; diff --git a/dom/xslt/xpath/XPathResult.cpp b/dom/xslt/xpath/XPathResult.cpp index f7d821d553d0..2012b5036d6a 100644 --- a/dom/xslt/xpath/XPathResult.cpp +++ b/dom/xslt/xpath/XPathResult.cpp @@ -165,9 +165,7 @@ nsresult XPathResult::SetExprResult(txAExprResult* aExprResult, mResult->stringValue(mStringResult); break; } - default: { - MOZ_ASSERT(isNode() || isIterator() || isSnapshot()); - } + default: { MOZ_ASSERT(isNode() || isIterator() || isSnapshot()); } } if (aExprResult->getResultType() == txAExprResult::NODESET) { diff --git a/dom/xslt/xpath/txCoreFunctionCall.cpp b/dom/xslt/xpath/txCoreFunctionCall.cpp index 1097da6083bb..ad88f6f07406 100644 --- a/dom/xslt/xpath/txCoreFunctionCall.cpp +++ b/dom/xslt/xpath/txCoreFunctionCall.cpp @@ -187,9 +187,7 @@ nsresult txCoreFunctionCall::evaluate(txIEvalContext* aContext, return NS_OK; } - default: { - MOZ_CRASH("Unexpected mType?!"); - } + default: { MOZ_CRASH("Unexpected mType?!"); } } MOZ_CRASH("Inner mType switch should have returned!"); } diff --git a/dom/xslt/xpath/txRelationalExpr.cpp b/dom/xslt/xpath/txRelationalExpr.cpp index df6da87ca8df..d65535765f01 100644 --- a/dom/xslt/xpath/txRelationalExpr.cpp +++ b/dom/xslt/xpath/txRelationalExpr.cpp @@ -122,9 +122,7 @@ bool RelationalExpr::compareResults(txIEvalContext* aContext, case GREATER_OR_EQUAL: { return (leftDbl >= rightDbl); } - default: { - MOZ_ASSERT_UNREACHABLE("We should have caught all cases"); - } + default: { MOZ_ASSERT_UNREACHABLE("We should have caught all cases"); } } return false; diff --git a/dom/xslt/xpath/txResultRecycler.cpp b/dom/xslt/xpath/txResultRecycler.cpp index c0c0edc21aab..2ad62038274b 100644 --- a/dom/xslt/xpath/txResultRecycler.cpp +++ b/dom/xslt/xpath/txResultRecycler.cpp @@ -56,9 +56,7 @@ void txResultRecycler::recycle(txAExprResult* aResult) { } return; } - default: { - delete aResult; - } + default: { delete aResult; } } } diff --git a/dom/xslt/xslt/txBufferingHandler.cpp b/dom/xslt/xslt/txBufferingHandler.cpp index 9d8b34ddeb70..82d2c4ca8bb6 100644 --- a/dom/xslt/xslt/txBufferingHandler.cpp +++ b/dom/xslt/xslt/txBufferingHandler.cpp @@ -354,9 +354,7 @@ static nsresult flushTransaction(txOutputTransaction* aTransaction, return aHandler->startElement( transaction->mPrefix, transaction->mLocalName, transaction->mNsID); } - default: { - MOZ_ASSERT_UNREACHABLE("Unexpected transaction type"); - } + default: { MOZ_ASSERT_UNREACHABLE("Unexpected transaction type"); } } return NS_ERROR_UNEXPECTED; diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index 80552ed01068..779e8efe2594 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -808,9 +808,7 @@ nsresult txMozillaXSLTProcessor::SetParameter(const nsAString& aNamespaceURI, break; } - default: { - return NS_ERROR_FAILURE; - } + default: { return NS_ERROR_FAILURE; } } int32_t nsId = kNameSpaceID_Unknown; diff --git a/editor/spellchecker/EditorSpellCheck.cpp b/editor/spellchecker/EditorSpellCheck.cpp index ad808524f216..dea1ff823ee0 100644 --- a/editor/spellchecker/EditorSpellCheck.cpp +++ b/editor/spellchecker/EditorSpellCheck.cpp @@ -806,33 +806,32 @@ nsresult EditorSpellCheck::DictionaryFetched(DictionaryFetcher* aFetcher) { RefPtr self = this; RefPtr fetcher = aFetcher; mSpellChecker->SetCurrentDictionaryFromList(tryDictList) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [self, fetcher]() { + ->Then(GetMainThreadSerialEventTarget(), __func__, + [self, fetcher]() { #ifdef DEBUG_DICT - printf("***** Assigned from content preferences |%s|\n", - NS_ConvertUTF16toUTF8(dictName).get()); + printf("***** Assigned from content preferences |%s|\n", + NS_ConvertUTF16toUTF8(dictName).get()); #endif - // We take an early exit here, so let's not forget to clear - // the word list. - self->DeleteSuggestedWordList(); + // We take an early exit here, so let's not forget to clear + // the word list. + self->DeleteSuggestedWordList(); - self->EndUpdateDictionary(); - if (fetcher->mCallback) { - fetcher->mCallback->EditorSpellCheckDone(); - } - }, - [self, fetcher](nsresult aError) { - if (aError == NS_ERROR_ABORT) { - return; - } - // May be dictionary was uninstalled ? - // Clear the content preference and continue. - ClearCurrentDictionary(self->mEditor); + self->EndUpdateDictionary(); + if (fetcher->mCallback) { + fetcher->mCallback->EditorSpellCheckDone(); + } + }, + [self, fetcher](nsresult aError) { + if (aError == NS_ERROR_ABORT) { + return; + } + // May be dictionary was uninstalled ? + // Clear the content preference and continue. + ClearCurrentDictionary(self->mEditor); - // Priority 2 or later will handled by the following - self->SetFallbackDictionary(fetcher); - }); + // Priority 2 or later will handled by the following + self->SetFallbackDictionary(fetcher); + }); return NS_OK; } } diff --git a/editor/txmgr/tests/TestTXMgr.cpp b/editor/txmgr/tests/TestTXMgr.cpp index 8c4add2d6009..a5b9c0dea65e 100644 --- a/editor/txmgr/tests/TestTXMgr.cpp +++ b/editor/txmgr/tests/TestTXMgr.cpp @@ -1179,8 +1179,7 @@ void quick_test(TestTransactionFactory *factory) { EXPECT_TRUE(NS_SUCCEEDED(rv)); } -TEST(TestTXMgr, SimpleTest) -{ +TEST(TestTXMgr, SimpleTest) { /******************************************************************* * * Initialize globals for test. @@ -1202,8 +1201,7 @@ TEST(TestTXMgr, SimpleTest) quick_test(&factory); } -TEST(TestTXMgr, AggregationTest) -{ +TEST(TestTXMgr, AggregationTest) { /******************************************************************* * * Initialize globals for test. @@ -1808,8 +1806,7 @@ void quick_batch_test(TestTransactionFactory *factory) { EXPECT_TRUE(NS_SUCCEEDED(rv)); } -TEST(TestTXMgr, SimpleBatchTest) -{ +TEST(TestTXMgr, SimpleBatchTest) { /******************************************************************* * * Initialize globals for test. @@ -1830,8 +1827,7 @@ TEST(TestTXMgr, SimpleBatchTest) quick_batch_test(&factory); } -TEST(TestTXMgr, AggregationBatchTest) -{ +TEST(TestTXMgr, AggregationBatchTest) { /******************************************************************* * * Initialize globals for test. @@ -1923,8 +1919,7 @@ void stress_test(TestTransactionFactory *factory, int32_t iterations) { EXPECT_TRUE(NS_SUCCEEDED(rv)); } -TEST(TestTXMgr, SimpleStressTest) -{ +TEST(TestTXMgr, SimpleStressTest) { /******************************************************************* * * Initialize globals for test. @@ -1954,8 +1949,7 @@ TEST(TestTXMgr, SimpleStressTest) stress_test(&factory, iterations); } -TEST(TestTXMgr, AggregationStressTest) -{ +TEST(TestTXMgr, AggregationStressTest) { /******************************************************************* * * Initialize globals for test. @@ -1985,8 +1979,7 @@ TEST(TestTXMgr, AggregationStressTest) stress_test(&factory, iterations); } -TEST(TestTXMgr, AggregationBatchStressTest) -{ +TEST(TestTXMgr, AggregationBatchStressTest) { /******************************************************************* * * Initialize globals for test. diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index e07cabbabd4c..123b6ac9d26f 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -3430,13 +3430,12 @@ nsPermissionManager::WhenPermissionsAvailable(nsIPrincipal* aPrincipal, RefPtr runnable = aRunnable; GenericPromise::All(thread, promises) - ->Then( - thread, __func__, [runnable]() { runnable->Run(); }, - []() { - NS_WARNING( - "nsPermissionManager permission promise rejected. We're " - "probably shutting down."); - }); + ->Then(thread, __func__, [runnable]() { runnable->Run(); }, + []() { + NS_WARNING( + "nsPermissionManager permission promise rejected. We're " + "probably shutting down."); + }); return NS_OK; } diff --git a/gfx/2d/BlurLS3.cpp b/gfx/2d/BlurLS3.cpp index 18e28a99e471..85c6e26e7dbc 100644 --- a/gfx/2d/BlurLS3.cpp +++ b/gfx/2d/BlurLS3.cpp @@ -32,8 +32,8 @@ __m128i loadUnaligned128(__m128i *p) { "gsldlc1 %[vl], 0x7(%[p]) \n\t" "gsldrc1 %[vl], 0x0(%[p]) \n\t" ".set pop \n\t" - : [ vh ] "=f"(v.h), [ vl ] "=f"(v.l) - : [ p ] "r"(p) + : [vh] "=f"(v.h), [vl] "=f"(v.l) + : [p] "r"(p) : "memory"); return v; @@ -56,8 +56,8 @@ __m128i Divide(__m128i aValues, __m128i aDivisor) { "mthc1 %[tmp], %[maskl] \n\t" "mov.d %[maskh], %[maskl] \n\t" ".set pop \n\t" - : [ rah ] "=f"(ra.h), [ ral ] "=f"(ra.l), [ maskh ] "=f"(mask.h), - [ maskl ] "=f"(mask.l), [ tmp ] "=&r"(tmp)); + : [rah] "=f"(ra.h), [ral] "=f"(ra.l), [maskh] "=f"(mask.h), + [maskl] "=f"(mask.l), [tmp] "=&r"(tmp)); asm volatile( ".set push \n\t" @@ -69,12 +69,12 @@ __m128i Divide(__m128i aValues, __m128i aDivisor) { // the result is rounded. _mm_paddd(t1, t1, ra) _mm_psrld(t1, t1, srl32) _mm_paddd(t2, t2, ra) _mm_and(t2, t2, mask) _mm_or(p4321, t1, t2) ".set pop \n\t" - : [ p4321h ] "=&f"(p4321.h), [ p4321l ] "=&f"(p4321.l), - [ t1h ] "=&f"(t1.h), [ t1l ] "=&f"(t1.l), [ t2h ] "=&f"(t2.h), - [ t2l ] "=&f"(t2.l), [ srl32 ] "=&f"(srl32), [ tmp ] "=&r"(tmp) - : [ rah ] "f"(ra.h), [ ral ] "f"(ra.l), [ maskh ] "f"(mask.h), - [ maskl ] "f"(mask.l), [ avh ] "f"(aValues.h), [ avl ] "f"(aValues.l), - [ adh ] "f"(aDivisor.h), [ adl ] "f"(aDivisor.l)); + : [p4321h] "=&f"(p4321.h), [p4321l] "=&f"(p4321.l), [t1h] "=&f"(t1.h), + [t1l] "=&f"(t1.l), [t2h] "=&f"(t2.h), [t2l] "=&f"(t2.l), + [srl32] "=&f"(srl32), [tmp] "=&r"(tmp) + : [rah] "f"(ra.h), [ral] "f"(ra.l), [maskh] "f"(mask.h), + [maskl] "f"(mask.l), [avh] "f"(aValues.h), [avl] "f"(aValues.l), + [adh] "f"(aDivisor.h), [adl] "f"(aDivisor.l)); return p4321; } @@ -89,11 +89,11 @@ __m128i BlurFourPixels(const __m128i &aTopLeft, const __m128i &aTopRight, ".set push \n\t" ".set arch=loongson3a \n\t" _mm_psubw(val, abr, atr) _mm_psubw(val, val, abl) _mm_paddw(val, val, atl) ".set pop \n\t" - : [ valh ] "=&f"(values.h), [ vall ] "=&f"(values.l) - : [ abrh ] "f"(aBottomRight.h), [ abrl ] "f"(aBottomRight.l), - [ atrh ] "f"(aTopRight.h), [ atrl ] "f"(aTopRight.l), - [ ablh ] "f"(aBottomLeft.h), [ abll ] "f"(aBottomLeft.l), - [ atlh ] "f"(aTopLeft.h), [ atll ] "f"(aTopLeft.l)); + : [valh] "=&f"(values.h), [vall] "=&f"(values.l) + : [abrh] "f"(aBottomRight.h), [abrl] "f"(aBottomRight.l), + [atrh] "f"(aTopRight.h), [atrl] "f"(aTopRight.l), + [ablh] "f"(aBottomLeft.h), [abll] "f"(aBottomLeft.l), + [atlh] "f"(aTopLeft.h), [atll] "f"(aTopLeft.l)); return Divide(values, aDivisor); } @@ -203,8 +203,8 @@ void GenerateIntegralImage_LS3(int32_t aLeftInflation, int32_t aRightInflation, "mtc1 %[tmp], %[see] \n\t" "li %[tmp], 0x44 \n\t" "mtc1 %[tmp], %[s44] \n\t" _mm_xor(zero, zero, zero) ".set pop \n\t" - : [ tmp ] "=&r"(tmp), [ s44 ] "=f"(s44), [ see ] "=f"(see), - [ zeroh ] "=f"(zero.h), [ zerol ] "=f"(zero.l)); + : [tmp] "=&r"(tmp), [s44] "=f"(s44), [see] "=f"(see), + [zeroh] "=f"(zero.h), [zerol] "=f"(zero.l)); for (int y = aTopInflation + 1; y < (aSize.height + aTopInflation); y++) { __m128i currentRowSum; uint32_t *intRow = aIntegralImage + (y * stride32bit); @@ -215,7 +215,7 @@ void GenerateIntegralImage_LS3(int32_t aLeftInflation, int32_t aRightInflation, asm volatile( ".set push \n\t" ".set arch=loongson3a \n\t" _mm_xor(cr, cr, cr) ".set pop \n\t" - : [ crh ] "=f"(currentRowSum.h), [ crl ] "=f"(currentRowSum.l)); + : [crh] "=f"(currentRowSum.h), [crl] "=f"(currentRowSum.l)); for (int x = 0; x < aLeftInflation; x += 4) { __m128i sumPixels, t; asm volatile( @@ -227,8 +227,8 @@ void GenerateIntegralImage_LS3(int32_t aLeftInflation, int32_t aRightInflation, "pshufh %[sph], %[spl], %[s44] \n\t" "pshufh %[spl], %[spl], %[s44] \n\t" ".set pop \n\t" - : [ sph ] "=&f"(sumPixels.h), [ spl ] "=&f"(sumPixels.l) - : [ pix ] "r"(pixel), [ s44 ] "f"(s44)); + : [sph] "=&f"(sumPixels.h), [spl] "=&f"(sumPixels.l) + : [pix] "r"(pixel), [s44] "f"(s44)); sumPixels = AccumulatePixelSums(sumPixels); asm volatile ( ".set push \n\t" @@ -264,10 +264,10 @@ void GenerateIntegralImage_LS3(int32_t aLeftInflation, int32_t aRightInflation, "punpcklwd %[spl], %[spl], %[spl] \n\t" "mov.d %[sph], %[spl] \n\t" _mm_punpcklbh(sp, sp, zero) _mm_punpcklhw(sp, sp, zero) ".set pop \n\t" - : [ sph ] "=&f"(sumPixels.h), [ spl ] "=&f"(sumPixels.l), - [ crh ] "+f"(currentRowSum.h), [ crl ] "+f"(currentRowSum.l) - : [ pix ] "r"(pixels), [ see ] "f"(see), [ zeroh ] "f"(zero.h), - [ zerol ] "f"(zero.l)); + : [sph] "=&f"(sumPixels.h), [spl] "=&f"(sumPixels.l), + [crh] "+f"(currentRowSum.h), [crl] "+f"(currentRowSum.l) + : [pix] "r"(pixels), [see] "f"(see), [zeroh] "f"(zero.h), + [zerol] "f"(zero.l)); sumPixels = AccumulatePixelSums(sumPixels); asm volatile ( ".set push \n\t" @@ -305,8 +305,8 @@ void GenerateIntegralImage_LS3(int32_t aLeftInflation, int32_t aRightInflation, "punpcklwd %[crl], %[crl], %[crl] \n\t" "mov.d %[crh], %[crl] \n\t" ".set pop \n\t" - : [ crh ] "=f"(currentRowSum.h), [ crl ] "=f"(currentRowSum.l) - : [ cr ] "r"(intCurrentRowSum)); + : [crh] "=f"(currentRowSum.h), [crl] "=f"(currentRowSum.l) + : [cr] "r"(intCurrentRowSum)); break; } intCurrentRowSum += pixel; @@ -319,8 +319,8 @@ void GenerateIntegralImage_LS3(int32_t aLeftInflation, int32_t aRightInflation, "pshufh %[crl], %[crh], %[see] \n\t" "pshufh %[crh], %[crh], %[see] \n\t" ".set pop \n\t" - : [ crh ] "+f"(currentRowSum.h), [ crl ] "+f"(currentRowSum.l) - : [ see ] "f"(see)); + : [crh] "+f"(currentRowSum.h), [crl] "+f"(currentRowSum.l) + : [see] "f"(see)); } for (; x < integralImageSize.width; x += 4) { __m128i sumPixels, t; @@ -331,8 +331,8 @@ void GenerateIntegralImage_LS3(int32_t aLeftInflation, int32_t aRightInflation, "punpcklwd %[spl], %[spl], %[spl] \n\t" "mov.d %[sph], %[spl] \n\t" ".set pop \n\t" - : [ sph ] "=f"(sumPixels.h), [ spl ] "=f"(sumPixels.l) - : [ pix ] "r"(pixel)); + : [sph] "=f"(sumPixels.h), [spl] "=f"(sumPixels.l) + : [pix] "r"(pixel)); sumPixels = AccumulatePixelSums(sumPixels); asm volatile ( ".set push \n\t" @@ -432,9 +432,9 @@ void AlphaBoxBlur::BoxBlur_LS3(uint8_t *aData, int32_t aLeftLobe, "mtc1 %[rec], %[divl] \n\t" "punpcklwd %[divl], %[divl], %[divl] \n\t" "mov.d %[divh], %[divl] \n\t" _mm_xor(zero, zero, zero) ".set pop \n\t" - : [ divh ] "=f"(divisor.h), [ divl ] "=f"(divisor.l), - [ zeroh ] "=f"(zero.h), [ zerol ] "=f"(zero.l) - : [ rec ] "r"(reciprocal)); + : [divh] "=f"(divisor.h), [divl] "=f"(divisor.l), [zeroh] "=f"(zero.h), + [zerol] "=f"(zero.l) + : [rec] "r"(reciprocal)); // This points to the start of the rectangle within the IntegralImage that // overlaps the surface being blurred. diff --git a/gfx/2d/unittest/TestCairo.cpp b/gfx/2d/unittest/TestCairo.cpp index 1f9530c55b5e..7cd5a384b9c2 100644 --- a/gfx/2d/unittest/TestCairo.cpp +++ b/gfx/2d/unittest/TestCairo.cpp @@ -27,8 +27,7 @@ static void TryCircle(double centerX, double centerY, double radius) { cairo_destroy(cairo); } -TEST(Cairo, Simple) -{ +TEST(Cairo, Simple) { TryCircle(0.0, 0.0, 14.0); TryCircle(0.0, 1.0, 22.4); TryCircle(1.0, 0.0, 1422.4); @@ -36,8 +35,7 @@ TEST(Cairo, Simple) TryCircle(-10.0, 1.0, -2); } -TEST(Cairo, Bug825721) -{ +TEST(Cairo, Bug825721) { // OK: TryCircle(0.0, 0.0, 8761126469220696064.0); TryCircle(0.0, 1.0, 8761126469220696064.0); @@ -52,8 +50,7 @@ TEST(Cairo, Bug825721) TryCircle(0.0, 1.0, 5761126469220696064.0); } -TEST(Cairo, Bug1063486) -{ +TEST(Cairo, Bug1063486) { double x1, y1, x2, y2; const double epsilon = .01; diff --git a/gfx/gl/GLReadTexImageHelper.cpp b/gfx/gl/GLReadTexImageHelper.cpp index 3ef5ac4faa6b..12ff1db5a906 100644 --- a/gfx/gl/GLReadTexImageHelper.cpp +++ b/gfx/gl/GLReadTexImageHelper.cpp @@ -328,9 +328,7 @@ void ReadPixelsIntoDataSurface(GLContext* gl, DataSourceSurface* dest) { readFormatGFX = SurfaceFormat::R5G6B5_UINT16; break; } - default: { - MOZ_CRASH("GFX: Bad read format, read format."); - } + default: { MOZ_CRASH("GFX: Bad read format, read format."); } } switch (readType) { @@ -349,9 +347,7 @@ void ReadPixelsIntoDataSurface(GLContext* gl, DataSourceSurface* dest) { readAlignment = 2; break; } - default: { - MOZ_CRASH("GFX: Bad read type, read type."); - } + default: { MOZ_CRASH("GFX: Bad read type, read type."); } } int32_t stride = dest->GetSize().width * BytesPerPixel(readFormatGFX); diff --git a/gfx/layers/ScrollableLayerGuid.h b/gfx/layers/ScrollableLayerGuid.h index 497786bce1db..15204b1eb94a 100644 --- a/gfx/layers/ScrollableLayerGuid.h +++ b/gfx/layers/ScrollableLayerGuid.h @@ -108,9 +108,7 @@ template gfx::Log& operator<<(gfx::Log& log, const ScrollableLayerGuid& aGuid) { return log << nsPrintfCString("(0x%" PRIx64 ", %u, %" PRIu64 ")", - uint64_t(aGuid.mLayersId), aGuid.mPresShellId, - aGuid.mScrollId) - .get(); + uint64_t(aGuid.mLayersId), aGuid.mPresShellId, aGuid.mScrollId).get(); } } // namespace layers diff --git a/gfx/layers/TreeTraversal.h b/gfx/layers/TreeTraversal.h index d05a19b0f523..7a362130ee2a 100644 --- a/gfx/layers/TreeTraversal.h +++ b/gfx/layers/TreeTraversal.h @@ -185,8 +185,7 @@ template auto ForEachNodePostOrder(Node aRoot, const PostAction& aPostAction) -> typename EnableIf::value, void>::Type { - ForEachNode( - aRoot, [](Node aNode) {}, aPostAction); + ForEachNode(aRoot, [](Node aNode) {}, aPostAction); } /* diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index 8536d95f84b7..7691860eaace 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -740,9 +740,7 @@ static bool IsCompatibleTextureSource(TextureSource* aTexture, return aTexture->GetFormat() == rgb.format() && aTexture->GetSize() == rgb.size(); } - default: { - return false; - } + default: { return false; } } } diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index 4a0175f8b6d6..c5fa9b2fef21 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -728,9 +728,7 @@ already_AddRefed CreateTextureHostD3D11( aFlags, aDesc.get_SurfaceDescriptorDXGIYCbCr()); break; } - default: { - MOZ_ASSERT_UNREACHABLE("Unsupported SurfaceDescriptor type"); - } + default: { MOZ_ASSERT_UNREACHABLE("Unsupported SurfaceDescriptor type"); } } return result.forget(); } @@ -1046,9 +1044,7 @@ void DXGITextureHostD3D11::PushResourceUpdates( (aResources.*method)(aImageKeys[1], descriptor1, aExtID, bufferType, 1); break; } - default: { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - } + default: { MOZ_ASSERT_UNREACHABLE("unexpected to be called"); } } } @@ -1083,9 +1079,7 @@ void DXGITextureHostD3D11::PushDisplayItems( aFilter); break; } - default: { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - } + default: { MOZ_ASSERT_UNREACHABLE("unexpected to be called"); } } } diff --git a/gfx/layers/ipc/CompositableTransactionParent.cpp b/gfx/layers/ipc/CompositableTransactionParent.cpp index 709831e238e3..eb9fdcb736cb 100644 --- a/gfx/layers/ipc/CompositableTransactionParent.cpp +++ b/gfx/layers/ipc/CompositableTransactionParent.cpp @@ -230,9 +230,7 @@ bool CompositableParentManager::ReceiveCompositableUpdate( } break; } - default: { - MOZ_ASSERT(false, "bad type"); - } + default: { MOZ_ASSERT(false, "bad type"); } } return true; @@ -249,9 +247,7 @@ void CompositableParentManager::DestroyActor(const OpDestroy& aOp) { ReleaseCompositable(aOp.get_CompositableHandle()); break; } - default: { - MOZ_ASSERT(false, "unsupported type"); - } + default: { MOZ_ASSERT(false, "unsupported type"); } } } diff --git a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp index 1c0a49973d32..adc27dd143ec 100644 --- a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp +++ b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp @@ -204,7 +204,9 @@ LayersBackend LayerManagerMLGPU::GetBackendType() { void LayerManagerMLGPU::SetRoot(Layer* aLayer) { mRoot = aLayer; } -bool LayerManagerMLGPU::BeginTransaction(const nsCString& aURL) { return true; } +bool LayerManagerMLGPU::BeginTransaction(const nsCString& aURL) { + return true; +} void LayerManagerMLGPU::BeginTransactionWithDrawTarget( gfx::DrawTarget* aTarget, const gfx::IntRect& aRect) { diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp index 341b55858db7..fe46dcdcf96f 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp @@ -193,9 +193,7 @@ void MacIOSurfaceTextureHostOGL::PushResourceUpdates( (aResources.*method)(aImageKeys[1], descriptor1, aExtID, bufferType, 1); break; } - default: { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - } + default: { MOZ_ASSERT_UNREACHABLE("unexpected to be called"); } } } @@ -235,9 +233,7 @@ void MacIOSurfaceTextureHostOGL::PushDisplayItems( aFilter); break; } - default: { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - } + default: { MOZ_ASSERT_UNREACHABLE("unexpected to be called"); } } } diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 2cf375fd4720..19384e928b33 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -655,9 +655,7 @@ void SurfaceTextureHost::PushResourceUpdates( (aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0); break; } - default: { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - } + default: { MOZ_ASSERT_UNREACHABLE("unexpected to be called"); } } } @@ -675,9 +673,7 @@ void SurfaceTextureHost::PushDisplayItems( !(mFlags & TextureFlags::NON_PREMULTIPLIED)); break; } - default: { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - } + default: { MOZ_ASSERT_UNREACHABLE("unexpected to be called"); } } } diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index 657320d6ea2d..0d3f5da0d1b6 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -245,9 +245,7 @@ static bool IsContainerLayerItem(nsDisplayItem* aItem) { case DisplayItemType::TYPE_PERSPECTIVE: { return true; } - default: { - return false; - } + default: { return false; } } } diff --git a/gfx/src/FilterSupport.cpp b/gfx/src/FilterSupport.cpp index f4fdd0e001ba..e7f51379c089 100644 --- a/gfx/src/FilterSupport.cpp +++ b/gfx/src/FilterSupport.cpp @@ -486,9 +486,7 @@ bool ComputeColorMatrix(const ColorMatrixAttributes& aMatrixAttributes, break; } - default: { - return false; - } + default: { return false; } } return !ArrayEqual(aOutMatrix, identityMatrix, 20); diff --git a/gfx/tests/gtest/PolygonTestUtils.cpp b/gfx/tests/gtest/PolygonTestUtils.cpp index 9e399eb03918..ca92c7b5fa1a 100644 --- a/gfx/tests/gtest/PolygonTestUtils.cpp +++ b/gfx/tests/gtest/PolygonTestUtils.cpp @@ -84,8 +84,7 @@ bool operator==(const MozPolygon& lhs, const MozPolygon& rhs) { } // namespace gfx } // namespace mozilla -TEST(PolygonTestUtils, TestSanity) -{ +TEST(PolygonTestUtils, TestSanity) { EXPECT_TRUE(FuzzyEquals(Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(0.0f, 0.0f, 0.0f, 1.0f))); diff --git a/gfx/tests/gtest/TestArena.cpp b/gfx/tests/gtest/TestArena.cpp index 1939163f3de5..df93ae21bcf5 100644 --- a/gfx/tests/gtest/TestArena.cpp +++ b/gfx/tests/gtest/TestArena.cpp @@ -156,14 +156,12 @@ static void TestArenaLimit(IterableArena::ArenaType aType, using namespace test_arena; -TEST(Moz2D, FixedArena) -{ +TEST(Moz2D, FixedArena) { TestArenaAlloc(IterableArena::FIXED_SIZE); TestArenaLimit(IterableArena::FIXED_SIZE, true); } -TEST(Moz2D, GrowableArena) -{ +TEST(Moz2D, GrowableArena) { TestArenaAlloc(IterableArena::GROWABLE); TestArenaLimit(IterableArena::GROWABLE, false); diff --git a/gfx/tests/gtest/TestArrayView.cpp b/gfx/tests/gtest/TestArrayView.cpp index 209f28684585..11755d15c5a2 100644 --- a/gfx/tests/gtest/TestArrayView.cpp +++ b/gfx/tests/gtest/TestArrayView.cpp @@ -11,8 +11,7 @@ using namespace mozilla::gfx; -TEST(Gfx, ArrayView) -{ +TEST(Gfx, ArrayView) { nsTArray p = {5, 6}; ArrayView pv(p); ASSERT_EQ(pv[1], 6); diff --git a/gfx/tests/gtest/TestBSPTree.cpp b/gfx/tests/gtest/TestBSPTree.cpp index b5c6cda5dd95..e76874feacf0 100644 --- a/gfx/tests/gtest/TestBSPTree.cpp +++ b/gfx/tests/gtest/TestBSPTree.cpp @@ -38,8 +38,7 @@ static void RunTest(std::deque aPolygons, } // namespace -TEST(BSPTree, SameNode) -{ +TEST(BSPTree, SameNode) { const std::deque polygons{ MozPolygon{ Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(1.0f, 0.0f, 0.0f, 1.0f), @@ -51,8 +50,7 @@ TEST(BSPTree, SameNode) ::RunTest(polygons, polygons); } -TEST(BSPTree, OneChild) -{ +TEST(BSPTree, OneChild) { const MozPolygon p1{ Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(1.0f, 0.0f, 0.0f, 1.0f), Point4D(1.0f, 1.0f, 0.0f, 1.0f), Point4D(0.0f, 1.0f, 0.0f, 1.0f)}; @@ -65,8 +63,7 @@ TEST(BSPTree, OneChild) ::RunTest({p2, p1}, {p1, p2}); } -TEST(BSPTree, SharedEdge1) -{ +TEST(BSPTree, SharedEdge1) { MozPolygon p1{ Point4D(1.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f)}; @@ -78,8 +75,7 @@ TEST(BSPTree, SharedEdge1) ::RunTest({p1, p2}, {p1, p2}); } -TEST(BSPTree, SharedEdge2) -{ +TEST(BSPTree, SharedEdge2) { MozPolygon p1{ Point4D(1.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f)}; @@ -91,8 +87,7 @@ TEST(BSPTree, SharedEdge2) ::RunTest({p1, p2}, {p2, p1}); } -TEST(BSPTree, SplitSharedEdge) -{ +TEST(BSPTree, SplitSharedEdge) { MozPolygon p1{ Point4D(1.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f)}; @@ -115,8 +110,7 @@ TEST(BSPTree, SplitSharedEdge) ::RunTest({p1, p2}, expected); } -TEST(BSPTree, SplitSimple1) -{ +TEST(BSPTree, SplitSimple1) { MozPolygon p1{ Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(1.0f, 0.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f)}; @@ -137,8 +131,7 @@ TEST(BSPTree, SplitSimple1) ::RunTest({p1, p2}, expected); } -TEST(BSPTree, SplitSimple2) -{ +TEST(BSPTree, SplitSimple2) { const std::deque polygons{ MozPolygon{Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f), Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f), @@ -165,8 +158,7 @@ TEST(BSPTree, SplitSimple2) ::RunTest(polygons, expected); } -TEST(BSPTree, NoSplit1) -{ +TEST(BSPTree, NoSplit1) { const std::deque polygons{ MozPolygon{Point4D(0.00000f, 10.00000f, 0.00000f, 1.0f), Point4D(0.00000f, 0.00000f, 0.00000f, 1.0f), @@ -197,8 +189,7 @@ TEST(BSPTree, NoSplit1) ::RunTest(polygons, expected); } -TEST(BSPTree, NoSplit2) -{ +TEST(BSPTree, NoSplit2) { const std::deque polygons{ MozPolygon{Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f), Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f), @@ -221,8 +212,7 @@ TEST(BSPTree, NoSplit2) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate0degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate0degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f), Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f), @@ -245,8 +235,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate0degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate20degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate20degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f), Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f), @@ -269,8 +258,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate20degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate40degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate40degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f), Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f), @@ -293,8 +281,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate40degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate60degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate60degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f), Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f), @@ -321,8 +308,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate60degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate80degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate80degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f), Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f), @@ -345,8 +331,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate80degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate100degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate100degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f), Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f), @@ -373,8 +358,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate100degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate120degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate120degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f), Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f), @@ -397,8 +381,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate120degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate140degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate140degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f), Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f), @@ -421,8 +404,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate140degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate160degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate160degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f), Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f), @@ -445,8 +427,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate160degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate180degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate180degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f), Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f), @@ -469,8 +450,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate180degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate200degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate200degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f), Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f), @@ -493,8 +473,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate200degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate220degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate220degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f), Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f), @@ -517,8 +496,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate220degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate240degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate240degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f), Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f), @@ -545,8 +523,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate240degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate260degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate260degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f), Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f), @@ -569,8 +546,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate260degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate280degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate280degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f), Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f), @@ -597,8 +573,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate280degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate300degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate300degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f), Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f), @@ -621,8 +596,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate300degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate320degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate320degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f), Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f), @@ -645,8 +619,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate320degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate340degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate340degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f), Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f), @@ -669,8 +642,7 @@ TEST(BSPTree, TwoPlaneIntersectRotate340degrees) ::RunTest(polygons, expected); } -TEST(BSPTree, TwoPlaneIntersectRotate360degrees) -{ +TEST(BSPTree, TwoPlaneIntersectRotate360degrees) { const std::deque polygons{ MozPolygon{Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f), Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f), diff --git a/gfx/tests/gtest/TestBufferRotation.cpp b/gfx/tests/gtest/TestBufferRotation.cpp index d5570054115a..0e4e86abd513 100644 --- a/gfx/tests/gtest/TestBufferRotation.cpp +++ b/gfx/tests/gtest/TestBufferRotation.cpp @@ -43,8 +43,7 @@ static bool CheckBuffer(unsigned char* buffer, int bytesPerPixel, int width, return true; } -TEST(Gfx, BufferUnrotateHorizontal) -{ +TEST(Gfx, BufferUnrotateHorizontal) { const int NUM_OF_TESTS = 8; int bytesPerPixelList[2] = {2, 4}; int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99}; @@ -70,8 +69,7 @@ TEST(Gfx, BufferUnrotateHorizontal) } } -TEST(Gfx, BufferUnrotateVertical) -{ +TEST(Gfx, BufferUnrotateVertical) { const int NUM_OF_TESTS = 8; int bytesPerPixelList[2] = {2, 4}; int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99}; @@ -97,8 +95,7 @@ TEST(Gfx, BufferUnrotateVertical) } } -TEST(Gfx, BufferUnrotateBoth) -{ +TEST(Gfx, BufferUnrotateBoth) { const int NUM_OF_TESTS = 16; int bytesPerPixelList[2] = {2, 4}; int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99, @@ -128,8 +125,7 @@ TEST(Gfx, BufferUnrotateBoth) } } -TEST(Gfx, BufferUnrotateUneven) -{ +TEST(Gfx, BufferUnrotateUneven) { const int NUM_OF_TESTS = 16; int bytesPerPixelList[2] = {2, 4}; int width[NUM_OF_TESTS] = {10, 100, 99, 39, 100, 40, 99, 39, diff --git a/gfx/tests/gtest/TestColorNames.cpp b/gfx/tests/gtest/TestColorNames.cpp index 71206f1d91d9..dda60fce00cf 100644 --- a/gfx/tests/gtest/TestColorNames.cpp +++ b/gfx/tests/gtest/TestColorNames.cpp @@ -44,16 +44,18 @@ static void RunColorTests() { // Check that color lookup by name gets the right rgb value ASSERT_TRUE(NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tagName), &rgb)) - << "can't find '" << tagName.get() << "'"; + << "can't find '" << tagName.get() << "'"; ASSERT_TRUE((rgb == kColors[index])) - << "failed at index " << index << " out of " << ArrayLength(kColorNames); + << "failed at index " << index << " out of " + << ArrayLength(kColorNames); // fiddle with the case to make sure we can still find it tagName.SetCharAt(tagName.CharAt(0) - 32, 0); ASSERT_TRUE(NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tagName), &rgb)) - << "can't find '" << tagName.get() << "'"; + << "can't find '" << tagName.get() << "'"; ASSERT_TRUE((rgb == kColors[index])) - << "failed at index " << index << " out of " << ArrayLength(kColorNames); + << "failed at index " << index << " out of " + << ArrayLength(kColorNames); // Check that parsing an RGB value in hex gets the right values uint8_t r = NS_GET_R(rgb); @@ -69,7 +71,7 @@ static void RunColorTests() { nscolor hexrgb; ASSERT_TRUE(NS_HexToRGBA(NS_ConvertASCIItoUTF16(cbuf), nsHexColorType::AllowAlpha, &hexrgb)) - << "hex conversion to color of '" << cbuf << "'"; + << "hex conversion to color of '" << cbuf << "'"; ASSERT_TRUE(hexrgb == rgb); } } @@ -84,8 +86,6 @@ static void RunJunkColorTests() { } } -TEST(Gfx, ColorNames) -{ RunColorTests(); } +TEST(Gfx, ColorNames) { RunColorTests(); } -TEST(Gfx, JunkColorNames) -{ RunJunkColorTests(); } +TEST(Gfx, JunkColorNames) { RunJunkColorTests(); } diff --git a/gfx/tests/gtest/TestCompositor.cpp b/gfx/tests/gtest/TestCompositor.cpp index 167630ec555a..6a57b31e0ca6 100644 --- a/gfx/tests/gtest/TestCompositor.cpp +++ b/gfx/tests/gtest/TestCompositor.cpp @@ -161,11 +161,11 @@ static bool CompositeAndCompare(RefPtr layerManager, return true; } -TEST(Gfx, CompositorConstruct) -{ auto layerManagers = GetLayerManagers(GetPlatformBackends()); } +TEST(Gfx, CompositorConstruct) { + auto layerManagers = GetLayerManagers(GetPlatformBackends()); +} -TEST(Gfx, CompositorSimpleTree) -{ +TEST(Gfx, CompositorSimpleTree) { auto layerManagers = GetLayerManagers(GetPlatformBackends()); for (size_t i = 0; i < layerManagers.size(); i++) { RefPtr layerManager = layerManagers[i].mLayerManager; diff --git a/gfx/tests/gtest/TestGfxPrefs.cpp b/gfx/tests/gtest/TestGfxPrefs.cpp index 124e23df7dd5..2c5442d4992d 100644 --- a/gfx/tests/gtest/TestGfxPrefs.cpp +++ b/gfx/tests/gtest/TestGfxPrefs.cpp @@ -16,14 +16,12 @@ // a particular value to make sure we receive the correct // result through this API. -TEST(GfxPrefs, Singleton) -{ +TEST(GfxPrefs, Singleton) { gfxPrefs::GetSingleton(); ASSERT_TRUE(gfxPrefs::SingletonExists()); } -TEST(GfxPrefs, LiveValues) -{ +TEST(GfxPrefs, LiveValues) { gfxPrefs::GetSingleton(); ASSERT_TRUE(gfxPrefs::SingletonExists()); @@ -37,8 +35,7 @@ TEST(GfxPrefs, LiveValues) ASSERT_TRUE(gfxPrefs::MSAALevel() == 2); } -TEST(GfxPrefs, OnceValues) -{ +TEST(GfxPrefs, OnceValues) { gfxPrefs::GetSingleton(); ASSERT_TRUE(gfxPrefs::SingletonExists()); @@ -55,8 +52,7 @@ TEST(GfxPrefs, OnceValues) ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f); } -TEST(GfxPrefs, Set) -{ +TEST(GfxPrefs, Set) { gfxPrefs::GetSingleton(); ASSERT_TRUE(gfxPrefs::SingletonExists()); @@ -84,8 +80,7 @@ TEST(GfxPrefs, Set) // Randomly test the function we use in nsExceptionHandler.cpp here: extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength); -TEST(GfxPrefs, StringUtility) -{ +TEST(GfxPrefs, StringUtility) { char testBuffer[64]; double testVal[] = { 13.4, diff --git a/gfx/tests/gtest/TestGfxWidgets.cpp b/gfx/tests/gtest/TestGfxWidgets.cpp index 90bfce863a89..142d4c81a7ff 100644 --- a/gfx/tests/gtest/TestGfxWidgets.cpp +++ b/gfx/tests/gtest/TestGfxWidgets.cpp @@ -10,8 +10,7 @@ using namespace mozilla::widget; -TEST(GfxWidgets, Split) -{ +TEST(GfxWidgets, Split) { char aStr[8], bStr[8], cStr[8], dStr[8]; ASSERT_TRUE(SplitDriverVersion("33.4.3.22", aStr, bStr, cStr, dStr)); @@ -76,8 +75,7 @@ TEST(GfxWidgets, Split) atoi(dStr) == 0); } -TEST(GfxWidgets, Versioning) -{ +TEST(GfxWidgets, Versioning) { ASSERT_TRUE(mozilla::Version("0") < mozilla::Version("41.0a1")); ASSERT_TRUE(mozilla::Version("39.0.5b7") < mozilla::Version("41.0a1")); ASSERT_TRUE(mozilla::Version("18.0.5b7") < mozilla::Version("18.2")); diff --git a/gfx/tests/gtest/TestJobScheduler.cpp b/gfx/tests/gtest/TestJobScheduler.cpp index 435d3c298ebe..65183005de2a 100644 --- a/gfx/tests/gtest/TestJobScheduler.cpp +++ b/gfx/tests/gtest/TestJobScheduler.cpp @@ -198,8 +198,7 @@ static void TestSchedulerChain(uint32_t aNumThreads, uint32_t aNumCmdBuffers) { } // namespace test_scheduler #if !defined(MOZ_CODE_COVERAGE) || !defined(XP_WIN) -TEST(Moz2D, JobScheduler_Shutdown) -{ +TEST(Moz2D, JobScheduler_Shutdown) { srand(time(nullptr)); for (uint32_t threads = 1; threads < 16; ++threads) { for (uint32_t i = 1; i < 1000; ++i) { @@ -210,8 +209,7 @@ TEST(Moz2D, JobScheduler_Shutdown) } #endif -TEST(Moz2D, JobScheduler_Join) -{ +TEST(Moz2D, JobScheduler_Join) { srand(time(nullptr)); for (uint32_t threads = 1; threads < 8; ++threads) { for (uint32_t queues = 1; queues < threads; ++queues) { @@ -224,8 +222,7 @@ TEST(Moz2D, JobScheduler_Join) } } -TEST(Moz2D, JobScheduler_Chain) -{ +TEST(Moz2D, JobScheduler_Chain) { srand(time(nullptr)); for (uint32_t threads = 1; threads < 8; ++threads) { for (uint32_t queues = 1; queues < threads; ++queues) { diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp index cebd5a96221c..4f1298b94c04 100644 --- a/gfx/tests/gtest/TestLayers.cpp +++ b/gfx/tests/gtest/TestLayers.cpp @@ -85,11 +85,9 @@ class TestUserData : public LayerUserData { virtual ~TestUserData() { Die(); } }; -TEST(Layers, LayerConstructor) -{ TestContainerLayer layer(nullptr); } +TEST(Layers, LayerConstructor) { TestContainerLayer layer(nullptr); } -TEST(Layers, Defaults) -{ +TEST(Layers, Defaults) { TestContainerLayer layer(nullptr); ASSERT_EQ(1.0, layer.GetOpacity()); ASSERT_EQ(1.0f, layer.GetPostXScale()); @@ -101,8 +99,7 @@ TEST(Layers, Defaults) ASSERT_EQ(nullptr, layer.GetLastChild()); } -TEST(Layers, Transform) -{ +TEST(Layers, Transform) { TestContainerLayer layer(nullptr); Matrix4x4 identity; @@ -111,16 +108,14 @@ TEST(Layers, Transform) ASSERT_EQ(identity, layer.GetTransform()); } -TEST(Layers, Type) -{ +TEST(Layers, Type) { TestContainerLayer layer(nullptr); ASSERT_EQ(nullptr, layer.AsPaintedLayer()); ASSERT_EQ(nullptr, layer.AsRefLayer()); ASSERT_EQ(nullptr, layer.AsColorLayer()); } -TEST(Layers, UserData) -{ +TEST(Layers, UserData) { UniquePtr layerPtr(new TestContainerLayer(nullptr)); TestContainerLayer& layer = *layerPtr; @@ -240,8 +235,7 @@ already_AddRefed CreateLayerTree(const char* aLayerTreeDescription, return rootLayer.forget(); } -TEST(Layers, LayerTree) -{ +TEST(Layers, LayerTree) { const char* layerTreeSyntax = "c(c(tt))"; nsIntRegion layerVisibleRegion[] = { nsIntRegion(IntRect(0, 0, 100, 100)), @@ -295,8 +289,7 @@ static void ValidateTreePointers(nsTArray >& aLayers) { } } -TEST(Layers, RepositionChild) -{ +TEST(Layers, RepositionChild) { const char* layerTreeSyntax = "c(ttt)"; nsTArray > layers; diff --git a/gfx/tests/gtest/TestMoz2D.cpp b/gfx/tests/gtest/TestMoz2D.cpp index 50854cdc98eb..3550b47f56fb 100644 --- a/gfx/tests/gtest/TestMoz2D.cpp +++ b/gfx/tests/gtest/TestMoz2D.cpp @@ -10,8 +10,7 @@ #include "TestScaling.h" #include "TestBugs.h" -TEST(Moz2D, Bugs) -{ +TEST(Moz2D, Bugs) { TestBugs* test = new TestBugs(); int failures = 0; test->RunTests(&failures); @@ -20,8 +19,7 @@ TEST(Moz2D, Bugs) ASSERT_EQ(failures, 0); } -TEST(Moz2D, Point) -{ +TEST(Moz2D, Point) { TestBase* test = new TestPoint(); int failures = 0; test->RunTests(&failures); @@ -30,8 +28,7 @@ TEST(Moz2D, Point) ASSERT_EQ(failures, 0); } -TEST(Moz2D, Scaling) -{ +TEST(Moz2D, Scaling) { TestBase* test = new TestScaling(); int failures = 0; test->RunTests(&failures); diff --git a/gfx/tests/gtest/TestPolygon.cpp b/gfx/tests/gtest/TestPolygon.cpp index 168f7b46d9a7..09f40b204925 100644 --- a/gfx/tests/gtest/TestPolygon.cpp +++ b/gfx/tests/gtest/TestPolygon.cpp @@ -16,8 +16,7 @@ using namespace mozilla::gfx; typedef mozilla::gfx::Polygon MozPolygon; -TEST(MozPolygon, TriangulateRectangle) -{ +TEST(MozPolygon, TriangulateRectangle) { const MozPolygon p{ Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 0.0f, 1.0f, 1.0f)}; @@ -30,8 +29,7 @@ TEST(MozPolygon, TriangulateRectangle) AssertArrayEQ(triangles, expected); } -TEST(MozPolygon, TriangulatePentagon) -{ +TEST(MozPolygon, TriangulatePentagon) { const MozPolygon p{ Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(0.5f, 1.5f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f), @@ -52,8 +50,7 @@ static void TestClipRect(const MozPolygon& aPolygon, EXPECT_TRUE(res == aExpected); } -TEST(MozPolygon, ClipRectangle) -{ +TEST(MozPolygon, ClipRectangle) { MozPolygon polygon{ Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(0.0f, 1.0f, 0.0f, 1.0f), Point4D(1.0f, 1.0f, 0.0f, 1.0f), Point4D(1.0f, 0.0f, 0.0f, 1.0f)}; @@ -75,8 +72,7 @@ TEST(MozPolygon, ClipRectangle) TestClipRect(polygon, expected, Rect(0.2f, 0.2f, 0.6f, 0.6f)); } -TEST(MozPolygon, ClipTriangle) -{ +TEST(MozPolygon, ClipTriangle) { MozPolygon clipped, expected; const MozPolygon polygon{Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(0.0f, 1.0f, 0.0f, 1.0f), diff --git a/gfx/tests/gtest/TestQcms.cpp b/gfx/tests/gtest/TestQcms.cpp index 871a2f7c4635..3ed7415cb39f 100644 --- a/gfx/tests/gtest/TestQcms.cpp +++ b/gfx/tests/gtest/TestQcms.cpp @@ -29,8 +29,7 @@ static unsigned char* createAllGB() { return buff; } -TEST(GfxQcms, Identity) -{ +TEST(GfxQcms, Identity) { // XXX: This means that we can't have qcms v2 unit test // without changing the qcms API. qcms_enable_iccv4(); @@ -61,8 +60,7 @@ TEST(GfxQcms, Identity) free(data_out); } -TEST(GfxQcms, LutInverseCrash) -{ +TEST(GfxQcms, LutInverseCrash) { uint16_t lutTable1[] = { 0x0000, 0x0000, 0x0000, 0x8000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, @@ -105,8 +103,7 @@ TEST(GfxQcms, LutInverseCrash) (int)mozilla::ArrayLength(lutTable2)); } -TEST(GfxQcms, LutInverse) -{ +TEST(GfxQcms, LutInverse) { // mimic sRGB_v4_ICC mBA Output // // XXXX @@ -147,8 +144,7 @@ TEST(GfxQcms, LutInverse) EXPECT_LT(value, 201 * 256); } -TEST(GfxQcms, LutInverseNonMonotonic) -{ +TEST(GfxQcms, LutInverseNonMonotonic) { // Make sure we behave sanely for non monotic functions // X X X // X X X diff --git a/gfx/tests/gtest/TestRect.cpp b/gfx/tests/gtest/TestRect.cpp index f3884577e156..05e07c7b409a 100644 --- a/gfx/tests/gtest/TestRect.cpp +++ b/gfx/tests/gtest/TestRect.cpp @@ -552,8 +552,7 @@ static void TestIntersectionLogical(nscoord x1, nscoord y1, nscoord w1, isNonEmpty); } -TEST(Gfx, Logical) -{ +TEST(Gfx, Logical) { TestIntersectionLogical(578, 0, 2650, 1152, 1036, 0, 2312, 1, 1036, 0, 2192, 1, true); TestIntersectionLogical(0, 0, 1000, 1000, 500, 500, 1000, 1000, 500, 500, 500, @@ -564,8 +563,7 @@ TEST(Gfx, Logical) false); } -TEST(Gfx, nsRect) -{ +TEST(Gfx, nsRect) { TestConstructors(); TestEqualityOperator(); TestContainment(); @@ -577,8 +575,7 @@ TEST(Gfx, nsRect) TestSwap(); } -TEST(Gfx, nsIntRect) -{ +TEST(Gfx, nsIntRect) { TestConstructors(); TestEqualityOperator(); TestContainment(); @@ -590,8 +587,7 @@ TEST(Gfx, nsIntRect) TestSwap(); } -TEST(Gfx, gfxRect) -{ +TEST(Gfx, gfxRect) { TestConstructors(); // Skip TestEqualityOperator(); as gfxRect::operator== is private TestContainment(); @@ -624,8 +620,7 @@ static void TestMoveInsideAndClamp(IntRect aSrc, IntRect aTarget, << absExpected << " AbsActual " << absResult; } -TEST(Gfx, MoveInsideAndClamp) -{ +TEST(Gfx, MoveInsideAndClamp) { TestMoveInsideAndClamp(IntRect(0, 0, 10, 10), IntRect(1, -1, 10, 10), IntRect(1, -1, 10, 10)); TestMoveInsideAndClamp(IntRect(0, 0, 10, 10), IntRect(-1, -1, 12, 5), diff --git a/gfx/tests/gtest/TestRegion.cpp b/gfx/tests/gtest/TestRegion.cpp index 631831ac0fc2..056768c3bd4e 100644 --- a/gfx/tests/gtest/TestRegion.cpp +++ b/gfx/tests/gtest/TestRegion.cpp @@ -114,8 +114,7 @@ class TestLargestRegion { } }; -TEST(Gfx, RegionSingleRect) -{ +TEST(Gfx, RegionSingleRect) { TestLargestRegion::TestSingleRect(nsRect(0, 52, 720, 480)); TestLargestRegion::TestSingleRect(nsRect(-20, 40, 50, 20)); TestLargestRegion::TestSingleRect(nsRect(-20, 40, 10, 8)); @@ -123,20 +122,19 @@ TEST(Gfx, RegionSingleRect) TestLargestRegion::TestSingleRect(nsRect(-10, -10, 20, 20)); } -TEST(Gfx, RegionNonRectangular) -{ TestLargestRegion::TestNonRectangular(); } +TEST(Gfx, RegionNonRectangular) { TestLargestRegion::TestNonRectangular(); } -TEST(Gfx, RegionTwoRectTest) -{ TestLargestRegion::TwoRectTest(); } +TEST(Gfx, RegionTwoRectTest) { TestLargestRegion::TwoRectTest(); } -TEST(Gfx, RegionContainsSpecifiedRect) -{ TestLargestRegion::TestContainsSpecifiedRect(); } +TEST(Gfx, RegionContainsSpecifiedRect) { + TestLargestRegion::TestContainsSpecifiedRect(); +} -TEST(Gfx, RegionTestContainsSpecifiedOverflowingRect) -{ TestLargestRegion::TestContainsSpecifiedOverflowingRect(); } +TEST(Gfx, RegionTestContainsSpecifiedOverflowingRect) { + TestLargestRegion::TestContainsSpecifiedOverflowingRect(); +} -TEST(Gfx, RegionScaleToInside) -{ +TEST(Gfx, RegionScaleToInside) { { // no rectangles nsRegion r; @@ -178,8 +176,7 @@ TEST(Gfx, RegionScaleToInside) } } -TEST(Gfx, RegionIsEqual) -{ +TEST(Gfx, RegionIsEqual) { { nsRegion r(nsRect(0, 0, 50, 50)); EXPECT_FALSE(nsRegion().IsEqual(r)); @@ -218,8 +215,7 @@ TEST(Gfx, RegionIsEqual) } } -TEST(Gfx, RegionOrWith) -{ +TEST(Gfx, RegionOrWith) { PR_Sleep(PR_SecondsToInterval(10)); { nsRegion r(nsRect(11840, 11840, 4640, -10880)); @@ -337,8 +333,7 @@ TEST(Gfx, RegionOrWith) #endif } -TEST(Gfx, RegionSubWith) -{ +TEST(Gfx, RegionSubWith) { { nsRegion r1(nsRect(0, 0, 100, 50)); r1.OrWith(nsRect(50, 50, 50, 50)); @@ -593,8 +588,7 @@ TEST(Gfx, RegionSubWith) } #endif } -TEST(Gfx, RegionSub) -{ +TEST(Gfx, RegionSub) { { nsRegion r1(nsRect(0, 0, 100, 50)); r1.OrWith(nsRect(50, 50, 50, 50)); @@ -790,8 +784,7 @@ TEST(Gfx, RegionSub) #endif } -TEST(Gfx, RegionAndWith) -{ +TEST(Gfx, RegionAndWith) { { nsRegion r(nsRect(20, 0, 20, 20)); r.OrWith(nsRect(0, 20, 40, 20)); @@ -872,8 +865,7 @@ TEST(Gfx, RegionAndWith) #endif } -TEST(Gfx, RegionAnd) -{ +TEST(Gfx, RegionAnd) { { nsRegion r(nsRect(20, 0, 20, 20)); r.OrWith(nsRect(0, 20, 40, 20)); @@ -971,8 +963,7 @@ TEST(Gfx, RegionAnd) #endif } -TEST(Gfx, RegionSimplify) -{ +TEST(Gfx, RegionSimplify) { { // ensure simplify works on a single rect nsRegion r(nsRect(0, 100, 200, 100)); @@ -1074,8 +1065,7 @@ TEST(Gfx, RegionSimplify) } } -TEST(Gfx, RegionContains) -{ +TEST(Gfx, RegionContains) { { // ensure Contains works on a simple region nsRegion r(nsRect(0, 0, 100, 100)); @@ -1245,8 +1235,7 @@ static void TestVisit(nsRegion &r) { res.compare(ref); } -TEST(Gfx, RegionVisitEdges) -{ +TEST(Gfx, RegionVisitEdges) { { // visit edges nsRegion r(nsRect(20, 20, 100, 100)); r.Or(r, nsRect(20, 120, 200, 100)); @@ -1351,8 +1340,7 @@ TEST(Gfx, RegionVisitEdges) // The TiledRegion tests use nsIntRect / IntRegion because nsRect doesn't have // InflateToMultiple which is required by TiledRegion. -TEST(Gfx, TiledRegionNoSimplification2Rects) -{ +TEST(Gfx, TiledRegionNoSimplification2Rects) { // Add two rectangles, both rectangles are completely inside // different tiles. nsIntRegion region; @@ -1367,8 +1355,7 @@ TEST(Gfx, TiledRegionNoSimplification2Rects) EXPECT_TRUE(region.IsEqual(tiledRegion.GetRegion())); } -TEST(Gfx, TiledRegionNoSimplification1Region) -{ +TEST(Gfx, TiledRegionNoSimplification1Region) { // Add two rectangles, both rectangles are completely inside // different tiles. nsIntRegion region; @@ -1382,8 +1369,7 @@ TEST(Gfx, TiledRegionNoSimplification1Region) EXPECT_TRUE(region.IsEqual(tiledRegion.GetRegion())); } -TEST(Gfx, TiledRegionWithSimplification3Rects) -{ +TEST(Gfx, TiledRegionWithSimplification3Rects) { // Add three rectangles. The first two rectangles are completely inside // different tiles, but the third rectangle intersects both tiles. TiledIntRegion tiledRegion; @@ -1396,8 +1382,7 @@ TEST(Gfx, TiledRegionWithSimplification3Rects) EXPECT_TRUE(tiledRegion.GetRegion().IsEqual(nsIntRect(50, 50, 300, 50))); } -TEST(Gfx, TiledRegionWithSimplification1Region) -{ +TEST(Gfx, TiledRegionWithSimplification1Region) { // Add three rectangles. The first two rectangles are completely inside // different tiles, but the third rectangle intersects both tiles. nsIntRegion region; @@ -1413,8 +1398,7 @@ TEST(Gfx, TiledRegionWithSimplification1Region) EXPECT_TRUE(tiledRegion.GetRegion().IsEqual(nsIntRect(50, 50, 300, 50))); } -TEST(Gfx, TiledRegionContains) -{ +TEST(Gfx, TiledRegionContains) { // Add three rectangles. The first two rectangles are completely inside // different tiles, but the third rectangle intersects both tiles. TiledIntRegion tiledRegion; @@ -1429,8 +1413,7 @@ TEST(Gfx, TiledRegionContains) EXPECT_FALSE(tiledRegion.Contains(nsIntRect(50, 50, 301, 50))); } -TEST(Gfx, TiledRegionIntersects) -{ +TEST(Gfx, TiledRegionIntersects) { // Add three rectangles. The first two rectangles are completely inside // different tiles, but the third rectangle intersects both tiles. TiledIntRegion tiledRegion; @@ -1446,8 +1429,7 @@ TEST(Gfx, TiledRegionIntersects) EXPECT_FALSE(tiledRegion.Intersects(nsIntRect(0, 0, 50, 500))); } -TEST(Gfx, TiledRegionBoundaryConditions1) -{ +TEST(Gfx, TiledRegionBoundaryConditions1) { TiledIntRegion tiledRegion; // This one works fine tiledRegion.Add(nsIntRegion(nsIntRect(INT_MIN, INT_MIN, 1, 1))); @@ -1462,8 +1444,7 @@ TEST(Gfx, TiledRegionBoundaryConditions1) EXPECT_FALSE(tiledRegion.Contains(nsIntRect(0, 0, 1, 1))); } -TEST(Gfx, TiledRegionBoundaryConditions2) -{ +TEST(Gfx, TiledRegionBoundaryConditions2) { TiledIntRegion tiledRegion; // This one works fine tiledRegion.Add(nsIntRegion(nsIntRect(INT_MAX - 1, INT_MIN, 1, 1))); @@ -1476,8 +1457,7 @@ TEST(Gfx, TiledRegionBoundaryConditions2) EXPECT_FALSE(tiledRegion.Contains(nsIntRect(0, 0, 1, 1))); } -TEST(Gfx, TiledRegionBigRects) -{ +TEST(Gfx, TiledRegionBigRects) { TiledIntRegion tiledRegion; // Super wide region, forces simplification into bounds mode tiledRegion.Add(nsIntRegion(nsIntRect(INT_MIN, INT_MIN, INT_MAX, 100))); @@ -1494,8 +1474,7 @@ TEST(Gfx, TiledRegionBigRects) EXPECT_FALSE(tiledRegion.Contains(nsIntRect(-2, INT_MIN + 201, 1, 1))); } -TEST(Gfx, TiledRegionBoundaryOverflow) -{ +TEST(Gfx, TiledRegionBoundaryOverflow) { TiledIntRegion tiledRegion; tiledRegion.Add(nsIntRegion(nsIntRect(100, 100, 1, 1))); EXPECT_TRUE(tiledRegion.Contains(nsIntRect(100, 100, 1, 1))); @@ -1516,8 +1495,7 @@ TEST(Gfx, TiledRegionBoundaryOverflow) EXPECT_FALSE(tiledRegion.Contains(nsIntRect(0, 0, 1, 1))); } -TEST(Gfx, TiledRegionNegativeRect) -{ +TEST(Gfx, TiledRegionNegativeRect) { TiledIntRegion tiledRegion; // The next region is invalid, so it gets ignored tiledRegion.Add(nsIntRegion(nsIntRect(0, 0, -500, -500))); diff --git a/gfx/tests/gtest/TestSkipChars.cpp b/gfx/tests/gtest/TestSkipChars.cpp index 8f3177761904..ec2372d96b4e 100644 --- a/gfx/tests/gtest/TestSkipChars.cpp +++ b/gfx/tests/gtest/TestSkipChars.cpp @@ -148,8 +148,7 @@ static bool TestIterator() { return true; } -TEST(Gfx, gfxSkipChars) -{ +TEST(Gfx, gfxSkipChars) { TestConstructor(); TestLength(); TestIterator(); diff --git a/gfx/tests/gtest/TestSwizzle.cpp b/gfx/tests/gtest/TestSwizzle.cpp index de26c558d0b8..dafffec3c9e6 100644 --- a/gfx/tests/gtest/TestSwizzle.cpp +++ b/gfx/tests/gtest/TestSwizzle.cpp @@ -11,8 +11,7 @@ using namespace mozilla; using namespace mozilla::gfx; -TEST(Moz2D, PremultiplyData) -{ +TEST(Moz2D, PremultiplyData) { const uint8_t in_bgra[5 * 4] = { 255, 255, 0, 255, // verify 255 alpha leaves RGB unchanged 0, 0, 255, 255, @@ -45,8 +44,7 @@ TEST(Moz2D, PremultiplyData) EXPECT_TRUE(ArrayEqual(out, check_argb)); } -TEST(Moz2D, UnpremultiplyData) -{ +TEST(Moz2D, UnpremultiplyData) { const uint8_t in_bgra[5 * 4] = { 255, 255, 0, 255, // verify 255 alpha leaves RGB unchanged 0, 0, 255, 255, 0, 0, 0, 0, // verify 0 alpha leaves RGB at 0 @@ -79,8 +77,7 @@ TEST(Moz2D, UnpremultiplyData) EXPECT_TRUE(ArrayEqual(out, check_argb)); } -TEST(Moz2D, SwizzleData) -{ +TEST(Moz2D, SwizzleData) { const uint8_t in_bgra[5 * 4] = { 253, 254, 0, 255, 0, 0, 255, 255, 0, 0, 0, 0, 1, 2, 3, 64, 127, 0, 9, 128, diff --git a/gfx/tests/gtest/TestTextureCompatibility.cpp b/gfx/tests/gtest/TestTextureCompatibility.cpp index ba152dfe8488..149ca0b91eaf 100644 --- a/gfx/tests/gtest/TestTextureCompatibility.cpp +++ b/gfx/tests/gtest/TestTextureCompatibility.cpp @@ -107,8 +107,7 @@ static void CheckCompatibilityWithBasicCompositor( } } -TEST(Gfx, TestTextureCompatibility) -{ +TEST(Gfx, TestTextureCompatibility) { nsTArray backendHints; RefPtr deallocator = new TestSurfaceAllocator(); diff --git a/gfx/tests/gtest/TestTextures.cpp b/gfx/tests/gtest/TestTextures.cpp index c4e744d3d71f..f9238237c09d 100644 --- a/gfx/tests/gtest/TestTextures.cpp +++ b/gfx/tests/gtest/TestTextures.cpp @@ -213,8 +213,7 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) { } // namespace layers } // namespace mozilla -TEST(Layers, TextureSerialization) -{ +TEST(Layers, TextureSerialization) { // the test is run on all the following image formats gfxImageFormat formats[3] = { SurfaceFormat::A8R8G8B8_UINT32, @@ -243,8 +242,7 @@ TEST(Layers, TextureSerialization) } } -TEST(Layers, TextureYCbCrSerialization) -{ +TEST(Layers, TextureYCbCrSerialization) { RefPtr ySurface = new gfxImageSurface(IntSize(400, 300), SurfaceFormat::A8); RefPtr cbSurface = diff --git a/gfx/tests/gtest/TestTreeTraversal.cpp b/gfx/tests/gtest/TestTreeTraversal.cpp index 96f2f5c47ecb..652e5494ca0d 100644 --- a/gfx/tests/gtest/TestTreeTraversal.cpp +++ b/gfx/tests/gtest/TestTreeTraversal.cpp @@ -238,8 +238,7 @@ typedef TestNodeReverse ForEachTestNodeReverse; typedef TestNodeForward SearchTestNodeForward; typedef TestNodeForward ForEachTestNodeForward; -TEST(TreeTraversal, DepthFirstSearchNull) -{ +TEST(TreeTraversal, DepthFirstSearchNull) { RefPtr nullNode; RefPtr result = DepthFirstSearch( @@ -250,8 +249,7 @@ TEST(TreeTraversal, DepthFirstSearchNull) << "Null root did not return null search result."; } -TEST(TreeTraversal, DepthFirstSearchValueExists) -{ +TEST(TreeTraversal, DepthFirstSearchValueExists) { int visitCount = 0; size_t expectedNeedleTraversalRank = 7; RefPtr needleNode; @@ -299,8 +297,7 @@ TEST(TreeTraversal, DepthFirstSearchValueExists) "happened)."; } -TEST(TreeTraversal, DepthFirstSearchValueExistsReverse) -{ +TEST(TreeTraversal, DepthFirstSearchValueExistsReverse) { int visitCount = 0; size_t expectedNeedleTraversalRank = 7; RefPtr needleNode; @@ -348,8 +345,7 @@ TEST(TreeTraversal, DepthFirstSearchValueExistsReverse) "happened)."; } -TEST(TreeTraversal, DepthFirstSearchRootIsNeedle) -{ +TEST(TreeTraversal, DepthFirstSearchRootIsNeedle) { RefPtr root = new SearchTestNodeReverse(SearchNodeType::Needle, 0); RefPtr childNode1 = @@ -375,8 +371,7 @@ TEST(TreeTraversal, DepthFirstSearchRootIsNeedle) << "Search starting at needle continued past needle."; } -TEST(TreeTraversal, DepthFirstSearchValueDoesNotExist) -{ +TEST(TreeTraversal, DepthFirstSearchValueDoesNotExist) { int visitCount = 0; std::vector> nodeList; nodeList.reserve(10); @@ -413,8 +408,7 @@ TEST(TreeTraversal, DepthFirstSearchValueDoesNotExist) << "Search found something that should not exist."; } -TEST(TreeTraversal, DepthFirstSearchValueDoesNotExistReverse) -{ +TEST(TreeTraversal, DepthFirstSearchValueDoesNotExistReverse) { int visitCount = 0; std::vector> nodeList; nodeList.reserve(10); @@ -451,8 +445,7 @@ TEST(TreeTraversal, DepthFirstSearchValueDoesNotExistReverse) << "Search found something that should not exist."; } -TEST(TreeTraversal, DepthFirstSearchPostOrderNull) -{ +TEST(TreeTraversal, DepthFirstSearchPostOrderNull) { RefPtr nullNode; RefPtr result = DepthFirstSearchPostOrder( @@ -463,8 +456,7 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderNull) << "Null root did not return null search result."; } -TEST(TreeTraversal, DepthFirstSearchPostOrderValueExists) -{ +TEST(TreeTraversal, DepthFirstSearchPostOrderValueExists) { int visitCount = 0; size_t expectedNeedleTraversalRank = 7; RefPtr needleNode; @@ -511,8 +503,7 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueExists) "happened)."; } -TEST(TreeTraversal, DepthFirstSearchPostOrderValueExistsReverse) -{ +TEST(TreeTraversal, DepthFirstSearchPostOrderValueExistsReverse) { int visitCount = 0; size_t expectedNeedleTraversalRank = 7; RefPtr needleNode; @@ -559,8 +550,7 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueExistsReverse) "happened)."; } -TEST(TreeTraversal, DepthFirstSearchPostOrderRootIsNeedle) -{ +TEST(TreeTraversal, DepthFirstSearchPostOrderRootIsNeedle) { RefPtr root = new SearchTestNodeReverse(SearchNodeType::Needle, 0); RefPtr childNode1 = @@ -586,8 +576,7 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderRootIsNeedle) << "Search starting at needle continued past needle."; } -TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExist) -{ +TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExist) { int visitCount = 0; std::vector> nodeList; nodeList.reserve(10); @@ -624,8 +613,7 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExist) << "Search found something that should not exist."; } -TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExistReverse) -{ +TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExistReverse) { int visitCount = 0; std::vector> nodeList; nodeList.reserve(10); @@ -662,8 +650,7 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExistReverse) << "Search found something that should not exist."; } -TEST(TreeTraversal, BreadthFirstSearchNull) -{ +TEST(TreeTraversal, BreadthFirstSearchNull) { RefPtr nullNode; RefPtr result = BreadthFirstSearch( @@ -674,8 +661,7 @@ TEST(TreeTraversal, BreadthFirstSearchNull) << "Null root did not return null search result."; } -TEST(TreeTraversal, BreadthFirstSearchRootIsNeedle) -{ +TEST(TreeTraversal, BreadthFirstSearchRootIsNeedle) { RefPtr root = new SearchTestNodeReverse(SearchNodeType::Needle, 0); RefPtr childNode1 = @@ -701,8 +687,7 @@ TEST(TreeTraversal, BreadthFirstSearchRootIsNeedle) << "Search starting at needle continued past needle."; } -TEST(TreeTraversal, BreadthFirstSearchValueExists) -{ +TEST(TreeTraversal, BreadthFirstSearchValueExists) { int visitCount = 0; size_t expectedNeedleTraversalRank = 7; RefPtr needleNode; @@ -750,8 +735,7 @@ TEST(TreeTraversal, BreadthFirstSearchValueExists) "happened)."; } -TEST(TreeTraversal, BreadthFirstSearchValueExistsReverse) -{ +TEST(TreeTraversal, BreadthFirstSearchValueExistsReverse) { int visitCount = 0; size_t expectedNeedleTraversalRank = 7; RefPtr needleNode; @@ -799,8 +783,7 @@ TEST(TreeTraversal, BreadthFirstSearchValueExistsReverse) "happened)."; } -TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExist) -{ +TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExist) { int visitCount = 0; std::vector> nodeList; nodeList.reserve(10); @@ -837,8 +820,7 @@ TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExist) << "Search found something that should not exist."; } -TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExistReverse) -{ +TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExistReverse) { int visitCount = 0; std::vector> nodeList; nodeList.reserve(10); @@ -875,16 +857,14 @@ TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExistReverse) << "Search found something that should not exist."; } -TEST(TreeTraversal, ForEachNodeNullStillRuns) -{ +TEST(TreeTraversal, ForEachNodeNullStillRuns) { RefPtr nullNode; ForEachNode( nullNode.get(), [](ForEachTestNodeReverse* aNode) { return TraversalFlag::Continue; }); } -TEST(TreeTraversal, ForEachNodeAllEligible) -{ +TEST(TreeTraversal, ForEachNodeAllEligible) { std::vector> nodeList; int visitCount = 0; nodeList.reserve(10); @@ -920,8 +900,7 @@ TEST(TreeTraversal, ForEachNodeAllEligible) } } -TEST(TreeTraversal, ForEachNodeAllEligibleReverse) -{ +TEST(TreeTraversal, ForEachNodeAllEligibleReverse) { std::vector> nodeList; int visitCount = 0; nodeList.reserve(10); @@ -957,8 +936,7 @@ TEST(TreeTraversal, ForEachNodeAllEligibleReverse) } } -TEST(TreeTraversal, ForEachNodeSomeIneligibleNodes) -{ +TEST(TreeTraversal, ForEachNodeSomeIneligibleNodes) { std::vector> expectedVisitedNodeList; std::vector> expectedSkippedNodeList; int visitCount = 0; @@ -1012,8 +990,7 @@ TEST(TreeTraversal, ForEachNodeSomeIneligibleNodes) } } -TEST(TreeTraversal, ForEachNodeSomeIneligibleNodesReverse) -{ +TEST(TreeTraversal, ForEachNodeSomeIneligibleNodesReverse) { std::vector> expectedVisitedNodeList; std::vector> expectedSkippedNodeList; int visitCount = 0; @@ -1067,8 +1044,7 @@ TEST(TreeTraversal, ForEachNodeSomeIneligibleNodesReverse) } } -TEST(TreeTraversal, ForEachNodeIneligibleRoot) -{ +TEST(TreeTraversal, ForEachNodeIneligibleRoot) { int visitCount = 0; RefPtr root = @@ -1097,8 +1073,7 @@ TEST(TreeTraversal, ForEachNodeIneligibleRoot) << "Ineligible child was still hit."; } -TEST(TreeTraversal, ForEachNodeLeavesIneligible) -{ +TEST(TreeTraversal, ForEachNodeLeavesIneligible) { std::vector> nodeList; nodeList.reserve(10); int visitCount = 0; @@ -1138,8 +1113,7 @@ TEST(TreeTraversal, ForEachNodeLeavesIneligible) } } -TEST(TreeTraversal, ForEachNodeLeavesIneligibleReverse) -{ +TEST(TreeTraversal, ForEachNodeLeavesIneligibleReverse) { std::vector> nodeList; nodeList.reserve(10); int visitCount = 0; @@ -1179,8 +1153,7 @@ TEST(TreeTraversal, ForEachNodeLeavesIneligibleReverse) } } -TEST(TreeTraversal, ForEachNodeLambdaReturnsVoid) -{ +TEST(TreeTraversal, ForEachNodeLambdaReturnsVoid) { std::vector> nodeList; nodeList.reserve(10); int visitCount = 0; diff --git a/gfx/tests/gtest/gfxSurfaceRefCountTest.cpp b/gfx/tests/gtest/gfxSurfaceRefCountTest.cpp index c7106070b7d4..4caca66854d1 100644 --- a/gfx/tests/gtest/gfxSurfaceRefCountTest.cpp +++ b/gfx/tests/gtest/gfxSurfaceRefCountTest.cpp @@ -141,8 +141,7 @@ static int TestExistingSurface() { return failures; } -TEST(Gfx, SurfaceRefCount) -{ +TEST(Gfx, SurfaceRefCount) { int fail; fail = TestNewSurface(); diff --git a/gfx/thebes/gfxFontUtils.h b/gfx/thebes/gfxFontUtils.h index f35015dcccce..3f8e7c934572 100644 --- a/gfx/thebes/gfxFontUtils.h +++ b/gfx/thebes/gfxFontUtils.h @@ -412,9 +412,7 @@ class SharedBitSet { SharedBitSet() = delete; explicit SharedBitSet(const gfxSparseBitSet& aBitset) - : mBlockIndexCount( - mozilla::AssertedCast(aBitset.mBlockIndex.Length())), - mBlockCount(0) { + : mBlockIndexCount(mozilla::AssertedCast(aBitset.mBlockIndex.Length())), mBlockCount(0) { uint16_t* blockIndex = reinterpret_cast(this + 1); Block* blocks = reinterpret_cast(blockIndex + mBlockIndexCount); for (uint16_t i = 0; i < mBlockIndexCount; i++) { diff --git a/gfx/thebes/gfxTypes.h b/gfx/thebes/gfxTypes.h index 71829716f589..8d625e243a3e 100644 --- a/gfx/thebes/gfxTypes.h +++ b/gfx/thebes/gfxTypes.h @@ -13,7 +13,7 @@ typedef struct _cairo_surface cairo_surface_t; typedef struct _cairo_user_data_key cairo_user_data_key_t; -typedef void (*thebes_destroy_func_t)(void* data); +typedef void (*thebes_destroy_func_t)(void *data); /** * Currently needs to be 'double' for Cairo compatibility. Could diff --git a/gfx/vr/VRDisplayClient.cpp b/gfx/vr/VRDisplayClient.cpp index 1e7f77425c83..028f76abca0d 100644 --- a/gfx/vr/VRDisplayClient.cpp +++ b/gfx/vr/VRDisplayClient.cpp @@ -158,10 +158,10 @@ void VRDisplayClient::FireGamepadEvents() { // axis count. So, we need to check if they are more than zero. if ((lastState.controllerName[0] == '\0' || !existing) && (state.numButtons > 0 || state.numAxes > 0)) { - dom::GamepadAdded info(NS_ConvertUTF8toUTF16(state.controllerName), - dom::GamepadMappingType::_empty, state.hand, - mDisplayInfo.mDisplayID, state.numButtons, - state.numAxes, state.numHaptics); + dom::GamepadAdded info( + NS_ConvertUTF8toUTF16(state.controllerName), + dom::GamepadMappingType::_empty, state.hand, mDisplayInfo.mDisplayID, + state.numButtons, state.numAxes, state.numHaptics); dom::GamepadChangeEventBody body(info); dom::GamepadChangeEvent event(gamepadId, dom::GamepadServiceType::VR, body); diff --git a/gfx/vr/ipc/VRChild.cpp b/gfx/vr/ipc/VRChild.cpp index 1b5227f2fce0..aaf00a6045a5 100644 --- a/gfx/vr/ipc/VRChild.cpp +++ b/gfx/vr/ipc/VRChild.cpp @@ -67,7 +67,9 @@ class OpenVRControllerManifestManager { StaticRefPtr sOpenVRControllerManifestManager; -VRChild::VRChild(VRProcessParent* aHost) : mHost(aHost), mVRReady(false) { +VRChild::VRChild(VRProcessParent* aHost) + : mHost(aHost), + mVRReady(false) { MOZ_ASSERT(XRE_IsParentProcess()); } @@ -198,9 +200,9 @@ mozilla::ipc::IPCResult VRChild::RecvInitCrashReporter( } bool VRChild::SendRequestMemoryReport(const uint32_t& aGeneration, - const bool& aAnonymize, - const bool& aMinimizeMemoryUsage, - const Maybe& aDMDFile) { + const bool& aAnonymize, + const bool& aMinimizeMemoryUsage, + const Maybe& aDMDFile) { mMemoryReportRequest = MakeUnique(aGeneration); Unused << PVRChild::SendRequestMemoryReport(aGeneration, aAnonymize, aMinimizeMemoryUsage, aDMDFile); diff --git a/image/test/gtest/TestADAM7InterpolatingFilter.cpp b/image/test/gtest/TestADAM7InterpolatingFilter.cpp index b243977dd9e6..0327da7561a2 100644 --- a/image/test/gtest/TestADAM7InterpolatingFilter.cpp +++ b/image/test/gtest/TestADAM7InterpolatingFilter.cpp @@ -430,41 +430,51 @@ void CheckADAM7InterpolatingWritePixels(const IntSize& aSize) { }); } -TEST(ImageADAM7InterpolatingFilter, WritePixels100_100) -{ CheckADAM7InterpolatingWritePixels(IntSize(100, 100)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels100_100) { + CheckADAM7InterpolatingWritePixels(IntSize(100, 100)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels99_99) -{ CheckADAM7InterpolatingWritePixels(IntSize(99, 99)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels99_99) { + CheckADAM7InterpolatingWritePixels(IntSize(99, 99)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels66_33) -{ CheckADAM7InterpolatingWritePixels(IntSize(66, 33)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels66_33) { + CheckADAM7InterpolatingWritePixels(IntSize(66, 33)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels33_66) -{ CheckADAM7InterpolatingWritePixels(IntSize(33, 66)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels33_66) { + CheckADAM7InterpolatingWritePixels(IntSize(33, 66)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels15_15) -{ CheckADAM7InterpolatingWritePixels(IntSize(15, 15)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels15_15) { + CheckADAM7InterpolatingWritePixels(IntSize(15, 15)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels9_9) -{ CheckADAM7InterpolatingWritePixels(IntSize(9, 9)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels9_9) { + CheckADAM7InterpolatingWritePixels(IntSize(9, 9)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels8_8) -{ CheckADAM7InterpolatingWritePixels(IntSize(8, 8)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels8_8) { + CheckADAM7InterpolatingWritePixels(IntSize(8, 8)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels7_7) -{ CheckADAM7InterpolatingWritePixels(IntSize(7, 7)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels7_7) { + CheckADAM7InterpolatingWritePixels(IntSize(7, 7)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels3_3) -{ CheckADAM7InterpolatingWritePixels(IntSize(3, 3)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels3_3) { + CheckADAM7InterpolatingWritePixels(IntSize(3, 3)); +} -TEST(ImageADAM7InterpolatingFilter, WritePixels1_1) -{ CheckADAM7InterpolatingWritePixels(IntSize(1, 1)); } +TEST(ImageADAM7InterpolatingFilter, WritePixels1_1) { + CheckADAM7InterpolatingWritePixels(IntSize(1, 1)); +} -TEST(ImageADAM7InterpolatingFilter, TrivialInterpolation48_48) -{ CheckInterpolation(IntSize(48, 48), {BGRAColor::Green()}); } +TEST(ImageADAM7InterpolatingFilter, TrivialInterpolation48_48) { + CheckInterpolation(IntSize(48, 48), {BGRAColor::Green()}); +} -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput33_17) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput33_17) { // We check interpolation using irregular patterns to make sure that the // interpolation will look different for different passes. CheckInterpolation( @@ -482,8 +492,7 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput33_17) BGRAColor::Red(), BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput32_16) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput32_16) { CheckInterpolation( IntSize(32, 16), {BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(), @@ -499,8 +508,7 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput32_16) BGRAColor::Red(), BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput31_15) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput31_15) { CheckInterpolation( IntSize(31, 15), {BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(), @@ -516,8 +524,7 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput31_15) BGRAColor::Red(), BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput17_33) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput17_33) { CheckInterpolation(IntSize(17, 33), {BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(), BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(), @@ -527,8 +534,7 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput17_33) BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput16_32) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput16_32) { CheckInterpolation(IntSize(16, 32), {BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(), BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(), @@ -538,8 +544,7 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput16_32) BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput15_31) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput15_31) { CheckInterpolation(IntSize(15, 31), {BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(), BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(), @@ -549,47 +554,42 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput15_31) BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput9_9) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput9_9) { CheckInterpolation(IntSize(9, 9), {BGRAColor::Blue(), BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(), BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Red(), BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput8_8) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput8_8) { CheckInterpolation(IntSize(8, 8), {BGRAColor::Blue(), BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(), BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Red(), BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput7_7) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput7_7) { CheckInterpolation(IntSize(7, 7), {BGRAColor::Blue(), BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(), BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Red(), BGRAColor::Blue()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput3_3) -{ +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput3_3) { CheckInterpolation(IntSize(3, 3), {BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Blue(), BGRAColor::Red()}); } -TEST(ImageADAM7InterpolatingFilter, InterpolationOutput1_1) -{ CheckInterpolation(IntSize(1, 1), {BGRAColor::Blue()}); } +TEST(ImageADAM7InterpolatingFilter, InterpolationOutput1_1) { + CheckInterpolation(IntSize(1, 1), {BGRAColor::Blue()}); +} -TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsFor0_0) -{ +TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsFor0_0) { // A 0x0 input size is invalid, so configuration should fail. AssertConfiguringADAM7InterpolatingFilterFails(IntSize(0, 0)); } -TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsForMinus1_Minus1) -{ +TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsForMinus1_Minus1) { // A negative input size is invalid, so configuration should fail. AssertConfiguringADAM7InterpolatingFilterFails(IntSize(-1, -1)); } diff --git a/image/test/gtest/TestBlendAnimationFilter.cpp b/image/test/gtest/TestBlendAnimationFilter.cpp index 3106a38664a7..b7ae3b5877a1 100644 --- a/image/test/gtest/TestBlendAnimationFilter.cpp +++ b/image/test/gtest/TestBlendAnimationFilter.cpp @@ -71,15 +71,13 @@ void AssertConfiguringBlendAnimationFilterFails(const IntRect& aFrameRect, AssertConfiguringPipelineFails(decoder, blendAnim, surfaceSink); } -TEST(ImageBlendAnimationFilter, BlendFailsForNegativeFrameRect) -{ +TEST(ImageBlendAnimationFilter, BlendFailsForNegativeFrameRect) { // A negative frame rect size is disallowed. AssertConfiguringBlendAnimationFilterFails( IntRect(IntPoint(0, 0), IntSize(-1, -1)), IntSize(100, 100)); } -TEST(ImageBlendAnimationFilter, WriteFullFirstFrame) -{ +TEST(ImageBlendAnimationFilter, WriteFullFirstFrame) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); @@ -94,8 +92,7 @@ TEST(ImageBlendAnimationFilter, WriteFullFirstFrame) EXPECT_EQ(IntRect(0, 0, 100, 100), frame0->GetDirtyRect()); } -TEST(ImageBlendAnimationFilter, WritePartialFirstFrame) -{ +TEST(ImageBlendAnimationFilter, WritePartialFirstFrame) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); @@ -167,14 +164,15 @@ static void TestWithBlendAnimationFilterClear(BlendMethod aBlendMethod) { EXPECT_TRUE(RowsAreSolidColor(surface, 70, 30, BGRAColor::Green())); } -TEST(ImageBlendAnimationFilter, ClearWithOver) -{ TestWithBlendAnimationFilterClear(BlendMethod::OVER); } +TEST(ImageBlendAnimationFilter, ClearWithOver) { + TestWithBlendAnimationFilterClear(BlendMethod::OVER); +} -TEST(ImageBlendAnimationFilter, ClearWithSource) -{ TestWithBlendAnimationFilterClear(BlendMethod::SOURCE); } +TEST(ImageBlendAnimationFilter, ClearWithSource) { + TestWithBlendAnimationFilterClear(BlendMethod::SOURCE); +} -TEST(ImageBlendAnimationFilter, KeepWithSource) -{ +TEST(ImageBlendAnimationFilter, KeepWithSource) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); @@ -210,8 +208,7 @@ TEST(ImageBlendAnimationFilter, KeepWithSource) EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, BGRAColor::Green())); } -TEST(ImageBlendAnimationFilter, KeepWithOver) -{ +TEST(ImageBlendAnimationFilter, KeepWithOver) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); @@ -253,8 +250,7 @@ TEST(ImageBlendAnimationFilter, KeepWithOver) EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0)); } -TEST(ImageBlendAnimationFilter, RestorePreviousWithOver) -{ +TEST(ImageBlendAnimationFilter, RestorePreviousWithOver) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); @@ -309,8 +305,7 @@ TEST(ImageBlendAnimationFilter, RestorePreviousWithOver) EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0)); } -TEST(ImageBlendAnimationFilter, RestorePreviousWithSource) -{ +TEST(ImageBlendAnimationFilter, RestorePreviousWithSource) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); @@ -361,8 +356,7 @@ TEST(ImageBlendAnimationFilter, RestorePreviousWithSource) EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0)); } -TEST(ImageBlendAnimationFilter, RestorePreviousClearWithSource) -{ +TEST(ImageBlendAnimationFilter, RestorePreviousClearWithSource) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); @@ -427,8 +421,7 @@ TEST(ImageBlendAnimationFilter, RestorePreviousClearWithSource) EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0)); } -TEST(ImageBlendAnimationFilter, PartialOverlapFrameRect) -{ +TEST(ImageBlendAnimationFilter, PartialOverlapFrameRect) { RefPtr decoder = CreateTrivialBlendingDecoder(); ASSERT_TRUE(decoder != nullptr); diff --git a/image/test/gtest/TestCopyOnWrite.cpp b/image/test/gtest/TestCopyOnWrite.cpp index d5ad3e4f6b5f..69682c48539f 100644 --- a/image/test/gtest/TestCopyOnWrite.cpp +++ b/image/test/gtest/TestCopyOnWrite.cpp @@ -41,8 +41,7 @@ struct Value { int32_t mSerial; }; -TEST(ImageCopyOnWrite, Read) -{ +TEST(ImageCopyOnWrite, Read) { ValueStats stats; { @@ -75,8 +74,7 @@ TEST(ImageCopyOnWrite, Read) EXPECT_EQ(1, stats.mFrees); } -TEST(ImageCopyOnWrite, RecursiveRead) -{ +TEST(ImageCopyOnWrite, RecursiveRead) { ValueStats stats; { @@ -123,8 +121,7 @@ TEST(ImageCopyOnWrite, RecursiveRead) EXPECT_EQ(1, stats.mFrees); } -TEST(ImageCopyOnWrite, Write) -{ +TEST(ImageCopyOnWrite, Write) { ValueStats stats; { @@ -158,8 +155,7 @@ TEST(ImageCopyOnWrite, Write) EXPECT_EQ(1, stats.mFrees); } -TEST(ImageCopyOnWrite, WriteRecursive) -{ +TEST(ImageCopyOnWrite, WriteRecursive) { ValueStats stats; { diff --git a/image/test/gtest/TestDownscalingFilter.cpp b/image/test/gtest/TestDownscalingFilter.cpp index 8fa7ceadcae7..b95772ab5c1e 100644 --- a/image/test/gtest/TestDownscalingFilter.cpp +++ b/image/test/gtest/TestDownscalingFilter.cpp @@ -40,8 +40,7 @@ void AssertConfiguringDownscalingFilterFails(const IntSize& aInputSize, SurfaceConfig{decoder, aOutputSize, SurfaceFormat::B8G8R8A8, false}); } -TEST(ImageDownscalingFilter, WritePixels100_100to99_99) -{ +TEST(ImageDownscalingFilter, WritePixels100_100to99_99) { WithDownscalingFilter(IntSize(100, 100), IntSize(99, 99), [](Decoder* aDecoder, SurfaceFilter* aFilter) { CheckWritePixels( @@ -50,8 +49,7 @@ TEST(ImageDownscalingFilter, WritePixels100_100to99_99) }); } -TEST(ImageDownscalingFilter, WritePixels100_100to33_33) -{ +TEST(ImageDownscalingFilter, WritePixels100_100to33_33) { WithDownscalingFilter(IntSize(100, 100), IntSize(33, 33), [](Decoder* aDecoder, SurfaceFilter* aFilter) { CheckWritePixels( @@ -60,8 +58,7 @@ TEST(ImageDownscalingFilter, WritePixels100_100to33_33) }); } -TEST(ImageDownscalingFilter, WritePixels100_100to1_1) -{ +TEST(ImageDownscalingFilter, WritePixels100_100to1_1) { WithDownscalingFilter(IntSize(100, 100), IntSize(1, 1), [](Decoder* aDecoder, SurfaceFilter* aFilter) { CheckWritePixels( @@ -70,8 +67,7 @@ TEST(ImageDownscalingFilter, WritePixels100_100to1_1) }); } -TEST(ImageDownscalingFilter, WritePixels100_100to33_99) -{ +TEST(ImageDownscalingFilter, WritePixels100_100to33_99) { WithDownscalingFilter(IntSize(100, 100), IntSize(33, 99), [](Decoder* aDecoder, SurfaceFilter* aFilter) { CheckWritePixels( @@ -80,8 +76,7 @@ TEST(ImageDownscalingFilter, WritePixels100_100to33_99) }); } -TEST(ImageDownscalingFilter, WritePixels100_100to99_33) -{ +TEST(ImageDownscalingFilter, WritePixels100_100to99_33) { WithDownscalingFilter(IntSize(100, 100), IntSize(99, 33), [](Decoder* aDecoder, SurfaceFilter* aFilter) { CheckWritePixels( @@ -90,8 +85,7 @@ TEST(ImageDownscalingFilter, WritePixels100_100to99_33) }); } -TEST(ImageDownscalingFilter, WritePixels100_100to99_1) -{ +TEST(ImageDownscalingFilter, WritePixels100_100to99_1) { WithDownscalingFilter(IntSize(100, 100), IntSize(99, 1), [](Decoder* aDecoder, SurfaceFilter* aFilter) { CheckWritePixels( @@ -100,8 +94,7 @@ TEST(ImageDownscalingFilter, WritePixels100_100to99_1) }); } -TEST(ImageDownscalingFilter, WritePixels100_100to1_99) -{ +TEST(ImageDownscalingFilter, WritePixels100_100to1_99) { WithDownscalingFilter(IntSize(100, 100), IntSize(1, 99), [](Decoder* aDecoder, SurfaceFilter* aFilter) { CheckWritePixels( @@ -110,44 +103,37 @@ TEST(ImageDownscalingFilter, WritePixels100_100to1_99) }); } -TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to101_101) -{ +TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to101_101) { // Upscaling is disallowed. AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(101, 101)); } -TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to100_100) -{ +TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to100_100) { // "Scaling" to the same size is disallowed. AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(100, 100)); } -TEST(ImageDownscalingFilter, DownscalingFailsFor0_0toMinus1_Minus1) -{ +TEST(ImageDownscalingFilter, DownscalingFailsFor0_0toMinus1_Minus1) { // A 0x0 input size is disallowed. AssertConfiguringDownscalingFilterFails(IntSize(0, 0), IntSize(-1, -1)); } -TEST(ImageDownscalingFilter, DownscalingFailsForMinus1_Minus1toMinus2_Minus2) -{ +TEST(ImageDownscalingFilter, DownscalingFailsForMinus1_Minus1toMinus2_Minus2) { // A negative input size is disallowed. AssertConfiguringDownscalingFilterFails(IntSize(-1, -1), IntSize(-2, -2)); } -TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to0_0) -{ +TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to0_0) { // A 0x0 output size is disallowed. AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(0, 0)); } -TEST(ImageDownscalingFilter, DownscalingFailsFor100_100toMinus1_Minus1) -{ +TEST(ImageDownscalingFilter, DownscalingFailsFor100_100toMinus1_Minus1) { // A negative output size is disallowed. AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(-1, -1)); } -TEST(ImageDownscalingFilter, WritePixelsOutput100_100to20_20) -{ +TEST(ImageDownscalingFilter, WritePixelsOutput100_100to20_20) { WithDownscalingFilter( IntSize(100, 100), IntSize(20, 20), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -188,8 +174,7 @@ TEST(ImageDownscalingFilter, WritePixelsOutput100_100to20_20) }); } -TEST(ImageDownscalingFilter, WritePixelsOutput100_100to10_20) -{ +TEST(ImageDownscalingFilter, WritePixelsOutput100_100to10_20) { WithDownscalingFilter( IntSize(100, 100), IntSize(10, 20), [](Decoder* aDecoder, SurfaceFilter* aFilter) { diff --git a/image/test/gtest/TestDownscalingFilterNoSkia.cpp b/image/test/gtest/TestDownscalingFilterNoSkia.cpp index c2e19d3cd852..5d784734bd64 100644 --- a/image/test/gtest/TestDownscalingFilterNoSkia.cpp +++ b/image/test/gtest/TestDownscalingFilterNoSkia.cpp @@ -43,8 +43,7 @@ using namespace mozilla; using namespace mozilla::gfx; using namespace mozilla::image; -TEST(ImageDownscalingFilter, NoSkia) -{ +TEST(ImageDownscalingFilter, NoSkia) { RefPtr decoder = CreateTrivialDecoder(); ASSERT_TRUE(bool(decoder)); diff --git a/image/test/gtest/TestRemoveFrameRectFilter.cpp b/image/test/gtest/TestRemoveFrameRectFilter.cpp index acbf54ebac2b..0081d2c85cce 100644 --- a/image/test/gtest/TestRemoveFrameRectFilter.cpp +++ b/image/test/gtest/TestRemoveFrameRectFilter.cpp @@ -39,8 +39,7 @@ void AssertConfiguringRemoveFrameRectFilterFails(const IntSize& aSize, SurfaceConfig{decoder, aSize, SurfaceFormat::B8G8R8A8, false}); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_100_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(0, 0, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -51,8 +50,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_100_100) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_0_0) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_0_0) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(0, 0, 0, 0), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -64,8 +62,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_0_0) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_50_0_0) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_50_0_0) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(-50, 50, 0, 0), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -77,8 +74,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_50_0_0) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_Minus50_0_0) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_Minus50_0_0) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(50, -50, 0, 0), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -90,8 +86,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_Minus50_0_0) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_150_50_0_0) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_150_50_0_0) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(150, 50, 0, 0), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -103,8 +98,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_150_50_0_0) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_150_0_0) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_150_0_0) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(50, 150, 0, 0), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -116,8 +110,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_150_0_0) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_200_100_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_200_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(200, 200, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -132,8 +125,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_200_100_100) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus200_25_100_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus200_25_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(-200, 25, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -148,8 +140,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus200_25_100_100) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus200_100_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus200_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(25, -200, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -164,8 +155,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus200_100_100) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_25_100_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_25_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(200, 25, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -180,8 +170,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_25_100_100) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_200_100_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_200_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(25, 200, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -197,8 +186,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_200_100_100) } TEST(ImageRemoveFrameRectFilter, - WritePixels100_100_to_Minus200_Minus200_100_100) -{ + WritePixels100_100_to_Minus200_Minus200_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(-200, -200, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -210,8 +198,8 @@ TEST(ImageRemoveFrameRectFilter, }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_Minus50_100_100) -{ +TEST(ImageRemoveFrameRectFilter, + WritePixels100_100_to_Minus50_Minus50_100_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(-50, -50, 100, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -223,8 +211,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_Minus50_100_100) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_25_100_50) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_25_100_50) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(-50, 25, 100, 50), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -236,8 +223,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_25_100_50) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus50_50_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus50_50_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(25, -50, 50, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -249,8 +235,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus50_50_100) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_25_100_50) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_25_100_50) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(50, 25, 100, 50), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -263,8 +248,7 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_25_100_50) }); } -TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_50_50_100) -{ +TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_50_50_100) { WithRemoveFrameRectFilter( IntSize(100, 100), IntRect(25, 50, 50, 100), [](Decoder* aDecoder, SurfaceFilter* aFilter) { @@ -280,31 +264,27 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_50_50_100) }); } -TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor0_0_to_0_0_100_100) -{ +TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor0_0_to_0_0_100_100) { // A zero-size image is disallowed. AssertConfiguringRemoveFrameRectFilterFails(IntSize(0, 0), IntRect(0, 0, 100, 100)); } TEST(ImageRemoveFrameRectFilter, - RemoveFrameRectFailsForMinus1_Minus1_to_0_0_100_100) -{ + RemoveFrameRectFailsForMinus1_Minus1_to_0_0_100_100) { // A negative-size image is disallowed. AssertConfiguringRemoveFrameRectFilterFails(IntSize(-1, -1), IntRect(0, 0, 100, 100)); } -TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor100_100_to_0_0_0_0) -{ +TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor100_100_to_0_0_0_0) { // A zero size frame rect is disallowed. AssertConfiguringRemoveFrameRectFilterFails(IntSize(100, 100), IntRect(0, 0, -1, -1)); } TEST(ImageRemoveFrameRectFilter, - RemoveFrameRectFailsFor100_100_to_0_0_Minus1_Minus1) -{ + RemoveFrameRectFailsFor100_100_to_0_0_Minus1_Minus1) { // A negative size frame rect is disallowed. AssertConfiguringRemoveFrameRectFilterFails(IntSize(100, 100), IntRect(0, 0, -1, -1)); diff --git a/image/test/gtest/TestSurfaceSink.cpp b/image/test/gtest/TestSurfaceSink.cpp index 519c829775d0..fac472321b28 100644 --- a/image/test/gtest/TestSurfaceSink.cpp +++ b/image/test/gtest/TestSurfaceSink.cpp @@ -84,8 +84,7 @@ void CheckIterativeWrite(Decoder* aDecoder, SurfaceSink* aSink, [&] { CheckGeneratedImage(aDecoder, aOutputRect); }); } -TEST(ImageSurfaceSink, SurfaceSinkInitialization) -{ +TEST(ImageSurfaceSink, SurfaceSinkInitialization) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Check initial state. EXPECT_FALSE(aSink->IsSurfaceFinished()); @@ -101,15 +100,13 @@ TEST(ImageSurfaceSink, SurfaceSinkInitialization) }); } -TEST(ImageSurfaceSink, SurfaceSinkWritePixels) -{ +TEST(ImageSurfaceSink, SurfaceSinkWritePixels) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { CheckWritePixels(aDecoder, aSink); }); } -TEST(ImageSurfaceSink, SurfaceSinkWritePixelsFinish) -{ +TEST(ImageSurfaceSink, SurfaceSinkWritePixelsFinish) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Write nothing into the surface; just finish immediately. uint32_t count = 0; @@ -140,8 +137,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsFinish) }); } -TEST(ImageSurfaceSink, SurfaceSinkWritePixelsEarlyExit) -{ +TEST(ImageSurfaceSink, SurfaceSinkWritePixelsEarlyExit) { auto checkEarlyExit = [](Decoder* aDecoder, SurfaceSink* aSink, WriteState aState) { // Write half a row of green pixels and then exit early with |aState|. If @@ -214,8 +210,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsEarlyExit) }); } -TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRow) -{ +TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRow) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Write the first 99 rows of our 100x100 surface and verify that even // though our lambda will yield pixels forever, only one row is written per @@ -273,8 +268,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRow) }); } -TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRowEarlyExit) -{ +TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRowEarlyExit) { auto checkEarlyExit = [](Decoder* aDecoder, SurfaceSink* aSink, WriteState aState) { // Write half a row of green pixels and then exit early with |aState|. If @@ -345,8 +339,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRowEarlyExit) }); } -TEST(ImageSurfaceSink, SurfaceSinkWriteBuffer) -{ +TEST(ImageSurfaceSink, SurfaceSinkWriteBuffer) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Create a green buffer the same size as one row of the surface (which is // 100x100), containing 60 pixels of green in the middle and 20 transparent @@ -361,8 +354,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBuffer) }); } -TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRow) -{ +TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRow) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Create a buffer the same size as one row of the surface, containing all // green pixels. @@ -378,8 +370,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRow) }); } -TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowStartColOverflow) -{ +TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowStartColOverflow) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Create a buffer the same size as one row of the surface, containing all // green pixels. @@ -411,8 +402,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowStartColOverflow) }); } -TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowBufferOverflow) -{ +TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowBufferOverflow) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Create a buffer twice as large as a row of the surface. The first half // (which is as large as a row of the image) will contain green pixels, @@ -448,8 +438,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowBufferOverflow) }); } -TEST(ImageSurfaceSink, SurfaceSinkWriteBufferFromNullSource) -{ +TEST(ImageSurfaceSink, SurfaceSinkWriteBufferFromNullSource) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Calling WriteBuffer() with a null pointer should fail without making any // changes to the surface. @@ -466,8 +455,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferFromNullSource) }); } -TEST(ImageSurfaceSink, SurfaceSinkWriteEmptyRow) -{ +TEST(ImageSurfaceSink, SurfaceSinkWriteEmptyRow) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { { // Write an empty row to each row of the surface. We check that the @@ -537,8 +525,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteEmptyRow) }); } -TEST(ImageSurfaceSink, SurfaceSinkWriteUnsafeComputedRow) -{ +TEST(ImageSurfaceSink, SurfaceSinkWriteUnsafeComputedRow) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Create a green buffer the same size as one row of the surface. uint32_t buffer[100]; @@ -560,8 +547,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteUnsafeComputedRow) }); } -TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks) -{ +TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Create a green buffer the same size as one row of the surface (which is // 100x100), containing 60 pixels of green in the middle and 20 transparent @@ -607,8 +593,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks) }); } -TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow) -{ +TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { // Create a green buffer the same size as one row of the surface (which is // 100x100), containing 60 pixels of green in the middle and 20 transparent @@ -700,8 +685,7 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow) }); } -TEST(ImageSurfaceSink, SurfaceSinkProgressivePasses) -{ +TEST(ImageSurfaceSink, SurfaceSinkProgressivePasses) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { { // Fill the image with a first pass of red. @@ -752,8 +736,7 @@ TEST(ImageSurfaceSink, SurfaceSinkProgressivePasses) }); } -TEST(ImageSurfaceSink, SurfaceSinkInvalidRect) -{ +TEST(ImageSurfaceSink, SurfaceSinkInvalidRect) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { { // Write one row. @@ -876,8 +859,7 @@ TEST(ImageSurfaceSink, SurfaceSinkInvalidRect) }); } -TEST(ImageSurfaceSink, SurfaceSinkFlipVertically) -{ +TEST(ImageSurfaceSink, SurfaceSinkFlipVertically) { WithSurfaceSink([](Decoder* aDecoder, SurfaceSink* aSink) { { diff --git a/intl/locale/nsLanguageAtomService.cpp b/intl/locale/nsLanguageAtomService.cpp index fcabe88ce85a..3338c625ed61 100644 --- a/intl/locale/nsLanguageAtomService.cpp +++ b/intl/locale/nsLanguageAtomService.cpp @@ -183,12 +183,11 @@ nsStaticAtom* nsLanguageAtomService::GetUncachedLanguageGroup( } else { size_t foundIndex; const nsCString& script = loc.GetScript(); - if (BinarySearchIf( - kScriptLangGroup, 0, ArrayLength(kScriptLangGroup), - [script](const auto& entry) -> int { - return script.Compare(entry.mTag); - }, - &foundIndex)) { + if (BinarySearchIf(kScriptLangGroup, 0, ArrayLength(kScriptLangGroup), + [script](const auto& entry) -> int { + return script.Compare(entry.mTag); + }, + &foundIndex)) { return kScriptLangGroup[foundIndex].mAtom; } } diff --git a/intl/locale/tests/gtest/TestCollation.cpp b/intl/locale/tests/gtest/TestCollation.cpp index 8a90f1d9a971..3bd869388604 100644 --- a/intl/locale/tests/gtest/TestCollation.cpp +++ b/intl/locale/tests/gtest/TestCollation.cpp @@ -10,8 +10,7 @@ #include "nsICollation.h" #include "nsString.h" -TEST(Collation, AllocateRowSortKey) -{ +TEST(Collation, AllocateRowSortKey) { nsCOMPtr colFactory = do_CreateInstance(NS_COLLATIONFACTORY_CONTRACTID); ASSERT_TRUE(colFactory); diff --git a/intl/locale/tests/gtest/TestDateTimeFormat.cpp b/intl/locale/tests/gtest/TestDateTimeFormat.cpp index 86037947fe93..e1f92155813f 100644 --- a/intl/locale/tests/gtest/TestDateTimeFormat.cpp +++ b/intl/locale/tests/gtest/TestDateTimeFormat.cpp @@ -25,8 +25,7 @@ static nsAutoCString nt(nsAutoCString aDatetime) { return datetime; } -TEST(DateTimeFormat, FormatPRExplodedTime) -{ +TEST(DateTimeFormat, FormatPRExplodedTime) { PRTime prTime = 0; PRExplodedTime prExplodedTime; PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime); @@ -88,8 +87,7 @@ TEST(DateTimeFormat, FormatPRExplodedTime) nt(NS_ConvertUTF16toUTF8(formattedTime)).get()); } -TEST(DateTimeFormat, DateFormatSelectors) -{ +TEST(DateTimeFormat, DateFormatSelectors) { PRTime prTime = 0; PRExplodedTime prExplodedTime; PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime); @@ -160,8 +158,7 @@ static nsAutoCString ntd(nsAutoCString aDatetime) { return datetime; } -TEST(DateTimeFormat, FormatPRExplodedTimeForeign) -{ +TEST(DateTimeFormat, FormatPRExplodedTimeForeign) { PRTime prTime = 0; PRExplodedTime prExplodedTime; PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime); @@ -223,8 +220,7 @@ TEST(DateTimeFormat, FormatPRExplodedTimeForeign) ntd(NS_ConvertUTF16toUTF8(formattedTime)).get()); } -TEST(DateTimeFormat, DateFormatSelectorsForeign) -{ +TEST(DateTimeFormat, DateFormatSelectorsForeign) { PRTime prTime = 0; PRExplodedTime prExplodedTime; PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime); diff --git a/intl/locale/tests/gtest/TestLocaleService.cpp b/intl/locale/tests/gtest/TestLocaleService.cpp index 7ace8623b43e..89c239b6700d 100644 --- a/intl/locale/tests/gtest/TestLocaleService.cpp +++ b/intl/locale/tests/gtest/TestLocaleService.cpp @@ -11,24 +11,21 @@ using namespace mozilla::intl; -TEST(Intl_Locale_LocaleService, GetAppLocalesAsBCP47) -{ +TEST(Intl_Locale_LocaleService, GetAppLocalesAsBCP47) { nsTArray appLocales; LocaleService::GetInstance()->GetAppLocalesAsBCP47(appLocales); ASSERT_FALSE(appLocales.IsEmpty()); } -TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags) -{ +TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags) { nsTArray appLocales; LocaleService::GetInstance()->GetAppLocalesAsLangTags(appLocales); ASSERT_FALSE(appLocales.IsEmpty()); } -TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags_lastIsEnUS) -{ +TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags_lastIsEnUS) { nsAutoCString lastFallbackLocale; LocaleService::GetInstance()->GetLastFallbackLocale(lastFallbackLocale); @@ -39,8 +36,7 @@ TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags_lastIsEnUS) ASSERT_TRUE(appLocales[len - 1].Equals(lastFallbackLocale)); } -TEST(Intl_Locale_LocaleService, GetAppLocaleAsLangTag) -{ +TEST(Intl_Locale_LocaleService, GetAppLocaleAsLangTag) { nsTArray appLocales; LocaleService::GetInstance()->GetAppLocalesAsLangTags(appLocales); @@ -50,8 +46,7 @@ TEST(Intl_Locale_LocaleService, GetAppLocaleAsLangTag) ASSERT_TRUE(appLocales[0] == locale); } -TEST(Intl_Locale_LocaleService, GetRegionalPrefsLocales) -{ +TEST(Intl_Locale_LocaleService, GetRegionalPrefsLocales) { nsTArray rpLocales; LocaleService::GetInstance()->GetRegionalPrefsLocales(rpLocales); @@ -59,8 +54,7 @@ TEST(Intl_Locale_LocaleService, GetRegionalPrefsLocales) ASSERT_TRUE(len > 0); } -TEST(Intl_Locale_LocaleService, GetWebExposedLocales) -{ +TEST(Intl_Locale_LocaleService, GetWebExposedLocales) { const nsTArray spoofLocale{NS_LITERAL_CSTRING("de")}; LocaleService::GetInstance()->SetAvailableLocales(spoofLocale); LocaleService::GetInstance()->SetRequestedLocales(spoofLocale); @@ -83,8 +77,7 @@ TEST(Intl_Locale_LocaleService, GetWebExposedLocales) ASSERT_TRUE(pvLocales[0].Equals(NS_LITERAL_CSTRING("en-US"))); } -TEST(Intl_Locale_LocaleService, GetRequestedLocales) -{ +TEST(Intl_Locale_LocaleService, GetRequestedLocales) { nsTArray reqLocales; LocaleService::GetInstance()->GetRequestedLocales(reqLocales); @@ -92,8 +85,7 @@ TEST(Intl_Locale_LocaleService, GetRequestedLocales) ASSERT_TRUE(len > 0); } -TEST(Intl_Locale_LocaleService, GetAvailableLocales) -{ +TEST(Intl_Locale_LocaleService, GetAvailableLocales) { nsTArray availableLocales; LocaleService::GetInstance()->GetAvailableLocales(availableLocales); @@ -101,8 +93,7 @@ TEST(Intl_Locale_LocaleService, GetAvailableLocales) ASSERT_TRUE(len > 0); } -TEST(Intl_Locale_LocaleService, GetPackagedLocales) -{ +TEST(Intl_Locale_LocaleService, GetPackagedLocales) { nsTArray packagedLocales; LocaleService::GetInstance()->GetPackagedLocales(packagedLocales); @@ -110,8 +101,7 @@ TEST(Intl_Locale_LocaleService, GetPackagedLocales) ASSERT_TRUE(len > 0); } -TEST(Intl_Locale_LocaleService, GetDefaultLocale) -{ +TEST(Intl_Locale_LocaleService, GetDefaultLocale) { nsAutoCString locStr; LocaleService::GetInstance()->GetDefaultLocale(locStr); @@ -119,8 +109,7 @@ TEST(Intl_Locale_LocaleService, GetDefaultLocale) ASSERT_TRUE(Locale(locStr).IsWellFormed()); } -TEST(Intl_Locale_LocaleService, IsAppLocaleRTL) -{ +TEST(Intl_Locale_LocaleService, IsAppLocaleRTL) { // For now we can only test if the method doesn't crash. LocaleService::GetInstance()->IsAppLocaleRTL(); ASSERT_TRUE(true); diff --git a/intl/locale/tests/gtest/TestLocaleServiceNegotiate.cpp b/intl/locale/tests/gtest/TestLocaleServiceNegotiate.cpp index 4db7372a7ed3..bba4f2b37a4f 100644 --- a/intl/locale/tests/gtest/TestLocaleServiceNegotiate.cpp +++ b/intl/locale/tests/gtest/TestLocaleServiceNegotiate.cpp @@ -9,8 +9,7 @@ using namespace mozilla::intl; -TEST(Intl_Locale_LocaleService, Negotiate) -{ +TEST(Intl_Locale_LocaleService, Negotiate) { nsTArray requestedLocales; nsTArray availableLocales; nsTArray supportedLocales; @@ -31,8 +30,7 @@ TEST(Intl_Locale_LocaleService, Negotiate) ASSERT_TRUE(supportedLocales[1].EqualsLiteral("en-US")); } -TEST(Intl_Locale_LocaleService, UseLSDefaultLocale) -{ +TEST(Intl_Locale_LocaleService, UseLSDefaultLocale) { nsTArray requestedLocales; nsTArray availableLocales; nsTArray supportedLocales; diff --git a/intl/locale/tests/gtest/TestMozLocale.cpp b/intl/locale/tests/gtest/TestMozLocale.cpp index 9bc974b9c3c1..14375caf8948 100644 --- a/intl/locale/tests/gtest/TestMozLocale.cpp +++ b/intl/locale/tests/gtest/TestMozLocale.cpp @@ -8,23 +8,20 @@ using namespace mozilla::intl; -TEST(Intl_Locale_Locale, Locale) -{ +TEST(Intl_Locale_Locale, Locale) { Locale loc = Locale("en-US"); ASSERT_TRUE(loc.GetLanguage().Equals("en")); ASSERT_TRUE(loc.GetRegion().Equals("US")); } -TEST(Intl_Locale_Locale, AsString) -{ +TEST(Intl_Locale_Locale, AsString) { Locale loc = Locale("ja-jp-windows"); ASSERT_TRUE(loc.AsString().Equals("ja-JP-windows")); } -TEST(Intl_Locale_Locale, GetSubTags) -{ +TEST(Intl_Locale_Locale, GetSubTags) { Locale loc = Locale("en-latn-us-macos"); ASSERT_TRUE(loc.GetLanguage().Equals("en")); @@ -34,8 +31,7 @@ TEST(Intl_Locale_Locale, GetSubTags) ASSERT_TRUE(loc.GetVariants()[0].Equals("macos")); } -TEST(Intl_Locale_Locale, Matches) -{ +TEST(Intl_Locale_Locale, Matches) { Locale loc = Locale("en-US"); Locale loc2 = Locale("en-GB"); @@ -48,8 +44,7 @@ TEST(Intl_Locale_Locale, Matches) ASSERT_TRUE(loc == loc4); } -TEST(Intl_Locale_Locale, MatchesRange) -{ +TEST(Intl_Locale_Locale, MatchesRange) { Locale loc = Locale("en-US"); Locale loc2 = Locale("en-Latn-US"); @@ -67,16 +62,14 @@ TEST(Intl_Locale_Locale, MatchesRange) ASSERT_TRUE(loc.Matches(loc3, true, true)); } -TEST(Intl_Locale_Locale, Variants) -{ +TEST(Intl_Locale_Locale, Variants) { Locale loc = Locale("en-US-UniFon-BasicEng"); // Make sure that we canonicalize and sort variant tags ASSERT_TRUE(loc.AsString().Equals("en-US-basiceng-unifon")); } -TEST(Intl_Locale_Locale, PrivateUse) -{ +TEST(Intl_Locale_Locale, PrivateUse) { Locale loc = Locale("x-test"); ASSERT_TRUE(loc.IsWellFormed()); @@ -105,8 +98,7 @@ TEST(Intl_Locale_Locale, PrivateUse) ASSERT_TRUE(loc3.AsString().Equals("fr-x-foo-bar-baz")); } -TEST(Intl_Locale_Locale, InvalidLocale) -{ +TEST(Intl_Locale_Locale, InvalidLocale) { Locale loc = Locale("en-verylongsubtag"); ASSERT_FALSE(loc.IsWellFormed()); @@ -114,15 +106,13 @@ TEST(Intl_Locale_Locale, InvalidLocale) ASSERT_FALSE(loc2.IsWellFormed()); } -TEST(Intl_Locale_Locale, ClearRegion) -{ +TEST(Intl_Locale_Locale, ClearRegion) { Locale loc = Locale("en-US"); loc.ClearRegion(); ASSERT_TRUE(loc.AsString().Equals("en")); } -TEST(Intl_Locale_Locale, ClearVariants) -{ +TEST(Intl_Locale_Locale, ClearVariants) { Locale loc = Locale("en-US-mac"); loc.ClearVariants(); ASSERT_TRUE(loc.AsString().Equals("en-US")); diff --git a/intl/locale/tests/gtest/TestOSPreferences.cpp b/intl/locale/tests/gtest/TestOSPreferences.cpp index 955162edf475..46c15b3e8fc8 100644 --- a/intl/locale/tests/gtest/TestOSPreferences.cpp +++ b/intl/locale/tests/gtest/TestOSPreferences.cpp @@ -17,8 +17,7 @@ using namespace mozilla::intl; * decide how to handle this and special case and this test should make * it not happen without us noticing. */ -TEST(Intl_Locale_OSPreferences, GetSystemLocales) -{ +TEST(Intl_Locale_OSPreferences, GetSystemLocales) { nsTArray systemLocales; ASSERT_TRUE(NS_SUCCEEDED( OSPreferences::GetInstance()->GetSystemLocales(systemLocales))); @@ -34,8 +33,7 @@ TEST(Intl_Locale_OSPreferences, GetSystemLocales) * decide how to handle this and special case and this test should make * it not happen without us noticing. */ -TEST(Intl_Locale_OSPreferences, GetRegionalPrefsLocales) -{ +TEST(Intl_Locale_OSPreferences, GetRegionalPrefsLocales) { nsTArray rgLocales; ASSERT_TRUE(NS_SUCCEEDED( OSPreferences::GetInstance()->GetRegionalPrefsLocales(rgLocales))); @@ -51,8 +49,7 @@ TEST(Intl_Locale_OSPreferences, GetRegionalPrefsLocales) * bindings for, so effectively, we're testing for crashes. We should * never crash. */ -TEST(Intl_Locale_OSPreferences, GetDateTimePattern) -{ +TEST(Intl_Locale_OSPreferences, GetDateTimePattern) { nsAutoString pattern; OSPreferences* osprefs = OSPreferences::GetInstance(); diff --git a/intl/lwbrk/gtest/TestLineBreak.cpp b/intl/lwbrk/gtest/TestLineBreak.cpp index f8b00c72dcaa..f1c0d752dce1 100644 --- a/intl/lwbrk/gtest/TestLineBreak.cpp +++ b/intl/lwbrk/gtest/TestLineBreak.cpp @@ -125,8 +125,7 @@ bool TestASCIIWB(mozilla::intl::WordBreaker* lb, const char* in, return Check(in, out, outlen, i, res); } -TEST(LineBreak, LineBreaker) -{ +TEST(LineBreak, LineBreaker) { RefPtr t = mozilla::intl::LineBreaker::Create(); ASSERT_TRUE(t); @@ -136,8 +135,7 @@ TEST(LineBreak, LineBreaker) ASSERT_TRUE(TestASCIILB(t, teng3, lexp3, sizeof(lexp3) / sizeof(uint32_t))); } -TEST(LineBreak, WordBreaker) -{ +TEST(LineBreak, WordBreaker) { RefPtr t = mozilla::intl::WordBreaker::Create(); ASSERT_TRUE(t); @@ -253,8 +251,7 @@ void TestFindWordBreakFromPosition(uint32_t fragN, uint32_t offset, << "FindWordBreakFromPosition(" << fragN << ", " << offset << ")"; } -TEST(LineBreak, WordBreakUsage) -{ +TEST(LineBreak, WordBreakUsage) { TestPrintWordWithBreak(); TestFindWordBreakFromPosition(0, 0, "This"); TestFindWordBreakFromPosition(1, 0, "his"); diff --git a/intl/strres/nsStringBundle.cpp b/intl/strres/nsStringBundle.cpp index 3c563569f853..c691020b526d 100644 --- a/intl/strres/nsStringBundle.cpp +++ b/intl/strres/nsStringBundle.cpp @@ -85,9 +85,9 @@ static const char kContentBundles[][52] = { static bool IsContentBundle(const nsCString& aUrl) { size_t index; - return BinarySearchIf( - kContentBundles, 0, MOZ_ARRAY_LENGTH(kContentBundles), - [&](const char* aElem) { return aUrl.Compare(aElem); }, &index); + return BinarySearchIf(kContentBundles, 0, MOZ_ARRAY_LENGTH(kContentBundles), + [&](const char* aElem) { return aUrl.Compare(aElem); }, + &index); } namespace { diff --git a/intl/uconv/nsTextToSubURI.cpp b/intl/uconv/nsTextToSubURI.cpp index cc9cf27988d9..a1eb5e14d4cd 100644 --- a/intl/uconv/nsTextToSubURI.cpp +++ b/intl/uconv/nsTextToSubURI.cpp @@ -128,12 +128,12 @@ NS_IMETHODIMP nsTextToSubURI::UnEscapeURIForUI(const nsACString& aCharset, MOZ_ASSERT(!mIDNBlocklist.IsEmpty()); const nsPromiseFlatString& unescapedResult = PromiseFlatString(_retval); nsString reescapedSpec; - _retval = NS_EscapeURL( - unescapedResult, - [&](char16_t aChar) -> bool { - return mozilla::net::CharInBlocklist(aChar, mIDNBlocklist); - }, - reescapedSpec); + _retval = + NS_EscapeURL(unescapedResult, + [&](char16_t aChar) -> bool { + return mozilla::net::CharInBlocklist(aChar, mIDNBlocklist); + }, + reescapedSpec); return NS_OK; } diff --git a/ipc/chromium/src/base/thread_local_win.cc b/ipc/chromium/src/base/thread_local_win.cc index 2eb68e63b30d..3f8c465d05f4 100644 --- a/ipc/chromium/src/base/thread_local_win.cc +++ b/ipc/chromium/src/base/thread_local_win.cc @@ -33,8 +33,7 @@ void* ThreadLocalPlatform::GetValueFromSlot(SlotType& slot) { // static void ThreadLocalPlatform::SetValueInSlot(SlotType& slot, void* value) { if (!TlsSetValue(slot, value)) { - CHECK(false) - << "Failed to TlsSetValue()."; + CHECK(false) << "Failed to TlsSetValue()."; } } diff --git a/ipc/chromium/src/base/waitable_event_win.cc b/ipc/chromium/src/base/waitable_event_win.cc index ca94c5cdd924..c7f5ef3e634d 100644 --- a/ipc/chromium/src/base/waitable_event_win.cc +++ b/ipc/chromium/src/base/waitable_event_win.cc @@ -62,7 +62,7 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) { size_t WaitableEvent::WaitMany(WaitableEvent** events, size_t count) { HANDLE handles[MAXIMUM_WAIT_OBJECTS]; CHECK(count <= MAXIMUM_WAIT_OBJECTS) - << "Can only wait on " << MAXIMUM_WAIT_OBJECTS << " with WaitMany"; + << "Can only wait on " << MAXIMUM_WAIT_OBJECTS << " with WaitMany"; for (size_t i = 0; i < count; ++i) handles[i] = events[i]->handle(); diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc index 652ab7c84228..47695b28f841 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc +++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc @@ -131,9 +131,8 @@ class PipeMap { DCHECK(fd != -1); ChannelToFDMap::const_iterator i = map_.find(channel_id); - CHECK(i == map_.end()) - << "Creating second IPC server for '" << channel_id - << "' while first still exists"; + CHECK(i == map_.end()) << "Creating second IPC server for '" << channel_id + << "' while first still exists"; map_[channel_id] = fd; } diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index e027b689a98f..984c1102af71 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -148,9 +148,7 @@ void CALLBACK WinEventHook(HWINEVENTHOOK aWinEventHook, DWORD aEvent, } break; } - default: { - return; - } + default: { return; } } } @@ -796,7 +794,8 @@ static void StopNeutering() { NeuteredWindowRegion::NeuteredWindowRegion( bool aDoNeuter MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) - : mNeuteredByThis(!gWindowHook && aDoNeuter && + : mNeuteredByThis(!gWindowHook && + aDoNeuter && XRE_UseNativeEventProcessing()) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; if (mNeuteredByThis) { diff --git a/js/public/Conversions.h b/js/public/Conversions.h index 7f62da49a741..c7e0cad07edc 100644 --- a/js/public/Conversions.h +++ b/js/public/Conversions.h @@ -348,8 +348,7 @@ inline UnsignedInteger ToUnsignedInteger(double d) { // The implicit leading bit matters identically to the other case, so // again, |exponent < ResultWidth|. if (exponent < ResultWidth) { - const auto implicitOne = - static_cast(UnsignedInteger{1} << exponent); + const auto implicitOne = static_cast(UnsignedInteger{1} << exponent); result &= implicitOne - 1; // remove bogus bits result += implicitOne; // add the implicit bit } diff --git a/js/public/RegExp.h b/js/public/RegExp.h index 2b872b659ae2..1ac6d7e488ed 100644 --- a/js/public/RegExp.h +++ b/js/public/RegExp.h @@ -14,8 +14,8 @@ #include "jstypes.h" // JS_PUBLIC_API #include "js/RegExpFlags.h" // JS::RegExpFlags -#include "js/RootingAPI.h" // JS::{,Mutable}Handle -#include "js/Value.h" // JS::Value +#include "js/RootingAPI.h" // JS::{,Mutable}Handle +#include "js/Value.h" // JS::Value struct JSContext; class JSString; diff --git a/js/src/builtin/String.cpp b/js/src/builtin/String.cpp index 40d65c28be9c..8f6d5727c305 100644 --- a/js/src/builtin/String.cpp +++ b/js/src/builtin/String.cpp @@ -1576,19 +1576,19 @@ bool js::str_normalize(JSContext* cx, unsigned argc, Value* vp) { PodCopy(chars.begin(), srcChars.begin().get(), spanLength); } - int32_t size = intl::CallICU( - cx, - [normalizer, &srcChars, spanLength](UChar* chars, uint32_t size, - UErrorCode* status) { - mozilla::RangedPtr remainingStart = - srcChars.begin() + spanLength; - size_t remainingLength = srcChars.length() - spanLength; + int32_t size = + intl::CallICU(cx, + [normalizer, &srcChars, spanLength]( + UChar* chars, uint32_t size, UErrorCode* status) { + mozilla::RangedPtr remainingStart = + srcChars.begin() + spanLength; + size_t remainingLength = srcChars.length() - spanLength; - return unorm2_normalizeSecondAndAppend(normalizer, chars, spanLength, - size, remainingStart.get(), - remainingLength, status); - }, - chars); + return unorm2_normalizeSecondAndAppend( + normalizer, chars, spanLength, size, + remainingStart.get(), remainingLength, status); + }, + chars); if (size < 0) { return false; } diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index b51153e23c6b..758da12f65ba 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -977,6 +977,7 @@ struct DefaultHasher> : js::ReadBarrieredHasher {}; namespace js { + class ArrayObject; class DebugEnvironmentProxy; class GlobalObject; diff --git a/js/src/gc/GC.cpp b/js/src/gc/GC.cpp index 3de6f3eb4c26..461a0e037e0a 100644 --- a/js/src/gc/GC.cpp +++ b/js/src/gc/GC.cpp @@ -7871,8 +7871,7 @@ JS::AutoDisableGenerationalGC::AutoDisableGenerationalGC(JSContext* cx) } JS::AutoDisableGenerationalGC::~AutoDisableGenerationalGC() { - if (--cx->generationalDisabled == 0 && - cx->runtime()->gc.tunables.gcMaxNurseryBytes() > 0) { + if (--cx->generationalDisabled == 0 && cx->runtime()->gc.tunables.gcMaxNurseryBytes() > 0) { cx->nursery().enable(); } } diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp index ed7b961df6de..f0d9f4bd9693 100644 --- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -525,20 +525,19 @@ RetAddrEntry& BaselineScript::retAddrEntryFromReturnOffset( #ifdef DEBUG bool found = #endif - BinarySearchIf( - RetAddrEntries(this), 0, numRetAddrEntries(), - [&returnOffset](const RetAddrEntry& entry) { - size_t roffset = returnOffset.offset(); - size_t entryRoffset = entry.returnOffset().offset(); - if (roffset < entryRoffset) { - return -1; - } - if (entryRoffset < roffset) { - return 1; - } - return 0; - }, - &loc); + BinarySearchIf(RetAddrEntries(this), 0, numRetAddrEntries(), + [&returnOffset](const RetAddrEntry& entry) { + size_t roffset = returnOffset.offset(); + size_t entryRoffset = entry.returnOffset().offset(); + if (roffset < entryRoffset) { + return -1; + } + if (entryRoffset < roffset) { + return 1; + } + return 0; + }, + &loc); MOZ_ASSERT(found); MOZ_ASSERT(loc < numRetAddrEntries()); @@ -551,19 +550,18 @@ template static inline bool ComputeBinarySearchMid(ScriptT* script, uint32_t pcOffset, size_t* loc) { Entries entries(script); - return BinarySearchIf( - entries, 0, entries.numEntries(), - [pcOffset](typename Entries::EntryT& entry) { - uint32_t entryOffset = entry.pcOffset(); - if (pcOffset < entryOffset) { - return -1; - } - if (entryOffset < pcOffset) { - return 1; - } - return 0; - }, - loc); + return BinarySearchIf(entries, 0, entries.numEntries(), + [pcOffset](typename Entries::EntryT& entry) { + uint32_t entryOffset = entry.pcOffset(); + if (pcOffset < entryOffset) { + return -1; + } + if (entryOffset < pcOffset) { + return 1; + } + return 0; + }, + loc); } uint8_t* BaselineScript::returnAddressForEntry(const RetAddrEntry& ent) { diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index 0451f6e0da7a..43fdf19b5c30 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -239,7 +239,7 @@ class ExecutableAllocator { "jr.hb $ra \n" "move $ra, %[tmp] \n" ".set pop\n" - : [ tmp ] "=&r"(tmp)); + : [tmp] "=&r"(tmp)); # elif defined(__GNUC__) intptr_t end = reinterpret_cast(code) + size; __builtin___clear_cache(reinterpret_cast(code), diff --git a/js/src/jit/arm/MacroAssembler-arm.cpp b/js/src/jit/arm/MacroAssembler-arm.cpp index a5dbba42d8eb..67c08114e563 100644 --- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -6112,9 +6112,7 @@ void MacroAssemblerARM::wasmUnalignedLoadImpl( } case Scalar::Int8: case Scalar::Uint8: - default: { - MOZ_CRASH("Bad type"); - } + default: { MOZ_CRASH("Bad type"); } } asMasm().memoryBarrierAfter(access.sync()); diff --git a/js/src/jit/arm64/MacroAssembler-arm64.cpp b/js/src/jit/arm64/MacroAssembler-arm64.cpp index c34e08868e92..765d9048b2d4 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.cpp +++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp @@ -1573,9 +1573,7 @@ static void LoadExclusive(MacroAssembler& masm, } break; } - default: { - MOZ_CRASH(); - } + default: { MOZ_CRASH(); } } } diff --git a/js/src/jit/shared/AtomicOperations-shared-jit.cpp b/js/src/jit/shared/AtomicOperations-shared-jit.cpp index 526434613e03..fed866f4aa01 100644 --- a/js/src/jit/shared/AtomicOperations-shared-jit.cpp +++ b/js/src/jit/shared/AtomicOperations-shared-jit.cpp @@ -198,9 +198,7 @@ static void GenGprArg(MacroAssembler& masm, MIRType t, ArgIterator* iter, masm.loadPtr(src, reg); break; } - default: { - MOZ_CRASH("Not possible"); - } + default: { MOZ_CRASH("Not possible"); } } } @@ -234,9 +232,7 @@ static void GenGpr64Arg(MacroAssembler& masm, ArgIterator* iter, break; } #endif - default: { - MOZ_CRASH("Not possible"); - } + default: { MOZ_CRASH("Not possible"); } } } diff --git a/js/src/jsapi-tests/testChromeBuffer.cpp b/js/src/jsapi-tests/testChromeBuffer.cpp index 9fddd7f6a3d5..315b626d92af 100644 --- a/js/src/jsapi-tests/testChromeBuffer.cpp +++ b/js/src/jsapi-tests/testChromeBuffer.cpp @@ -10,9 +10,9 @@ static TestJSPrincipals system_principals(1); -static const JSClass global_class = {"global", - JSCLASS_IS_GLOBAL | JSCLASS_GLOBAL_FLAGS, - &JS::DefaultGlobalClassOps}; +static const JSClass global_class = { + "global", JSCLASS_IS_GLOBAL | JSCLASS_GLOBAL_FLAGS, + &JS::DefaultGlobalClassOps}; static JS::PersistentRootedObject trusted_glob; static JS::PersistentRootedObject trusted_fun; diff --git a/js/src/jsapi-tests/testCompileUtf8.cpp b/js/src/jsapi-tests/testCompileUtf8.cpp index 53e50443c279..da2a668723e0 100644 --- a/js/src/jsapi-tests/testCompileUtf8.cpp +++ b/js/src/jsapi-tests/testCompileUtf8.cpp @@ -23,106 +23,98 @@ using mozilla::Utf8Unit; BEGIN_TEST(testUtf8BadBytes) { static const char badLeadingUnit[] = "var x = \x80"; - CHECK(testBadUtf8( - badLeadingUnit, JSMSG_BAD_LEADING_UTF8_UNIT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(startsWith(chars, "0x80")); - CHECK(isBadLeadUnitMessage(chars)); - return true; - }, - "0x80")); + CHECK(testBadUtf8(badLeadingUnit, JSMSG_BAD_LEADING_UTF8_UNIT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(startsWith(chars, "0x80")); + CHECK(isBadLeadUnitMessage(chars)); + return true; + }, + "0x80")); static const char badSecondInTwoByte[] = "var x = \xDF\x20"; - CHECK(testBadUtf8( - badSecondInTwoByte, JSMSG_BAD_TRAILING_UTF8_UNIT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isBadTrailingBytesMessage(chars)); - CHECK(contains(chars, "0x20")); - return true; - }, - "0xDF 0x20")); + CHECK(testBadUtf8(badSecondInTwoByte, JSMSG_BAD_TRAILING_UTF8_UNIT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isBadTrailingBytesMessage(chars)); + CHECK(contains(chars, "0x20")); + return true; + }, + "0xDF 0x20")); static const char badSecondInThreeByte[] = "var x = \xEF\x17\xA7"; - CHECK(testBadUtf8( - badSecondInThreeByte, JSMSG_BAD_TRAILING_UTF8_UNIT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isBadTrailingBytesMessage(chars)); - CHECK(contains(chars, "0x17")); - return true; - }, - // Validating stops with the first invalid code unit and - // shouldn't go beyond that. - "0xEF 0x17")); + CHECK(testBadUtf8(badSecondInThreeByte, JSMSG_BAD_TRAILING_UTF8_UNIT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isBadTrailingBytesMessage(chars)); + CHECK(contains(chars, "0x17")); + return true; + }, + // Validating stops with the first invalid code unit and + // shouldn't go beyond that. + "0xEF 0x17")); static const char lengthTwoTooShort[] = "var x = \xDF"; - CHECK(testBadUtf8( - lengthTwoTooShort, JSMSG_NOT_ENOUGH_CODE_UNITS, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isNotEnoughUnitsMessage(chars)); - CHECK(contains(chars, "0xDF")); - CHECK(contains(chars, " 1 byte, but 0 bytes were present")); - return true; - }, - "0xDF")); + CHECK(testBadUtf8(lengthTwoTooShort, JSMSG_NOT_ENOUGH_CODE_UNITS, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isNotEnoughUnitsMessage(chars)); + CHECK(contains(chars, "0xDF")); + CHECK( + contains(chars, " 1 byte, but 0 bytes were present")); + return true; + }, + "0xDF")); static const char forbiddenHighSurrogate[] = "var x = \xED\xA2\x87"; - CHECK(testBadUtf8( - forbiddenHighSurrogate, JSMSG_FORBIDDEN_UTF8_CODE_POINT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isSurrogateMessage(chars)); - CHECK(contains(chars, "0xD887")); - return true; - }, - "0xED 0xA2 0x87")); + CHECK(testBadUtf8(forbiddenHighSurrogate, JSMSG_FORBIDDEN_UTF8_CODE_POINT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isSurrogateMessage(chars)); + CHECK(contains(chars, "0xD887")); + return true; + }, + "0xED 0xA2 0x87")); static const char forbiddenLowSurrogate[] = "var x = \xED\xB7\xAF"; - CHECK(testBadUtf8( - forbiddenLowSurrogate, JSMSG_FORBIDDEN_UTF8_CODE_POINT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isSurrogateMessage(chars)); - CHECK(contains(chars, "0xDDEF")); - return true; - }, - "0xED 0xB7 0xAF")); + CHECK(testBadUtf8(forbiddenLowSurrogate, JSMSG_FORBIDDEN_UTF8_CODE_POINT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isSurrogateMessage(chars)); + CHECK(contains(chars, "0xDDEF")); + return true; + }, + "0xED 0xB7 0xAF")); static const char oneTooBig[] = "var x = \xF4\x90\x80\x80"; - CHECK(testBadUtf8( - oneTooBig, JSMSG_FORBIDDEN_UTF8_CODE_POINT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isTooBigMessage(chars)); - CHECK(contains(chars, "0x110000")); - return true; - }, - "0xF4 0x90 0x80 0x80")); + CHECK(testBadUtf8(oneTooBig, JSMSG_FORBIDDEN_UTF8_CODE_POINT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isTooBigMessage(chars)); + CHECK(contains(chars, "0x110000")); + return true; + }, + "0xF4 0x90 0x80 0x80")); static const char notShortestFormZero[] = "var x = \xC0\x80"; - CHECK(testBadUtf8( - notShortestFormZero, JSMSG_FORBIDDEN_UTF8_CODE_POINT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isNotShortestFormMessage(chars)); - CHECK(startsWith(chars, "0x0 isn't ")); - return true; - }, - "0xC0 0x80")); + CHECK(testBadUtf8(notShortestFormZero, JSMSG_FORBIDDEN_UTF8_CODE_POINT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isNotShortestFormMessage(chars)); + CHECK(startsWith(chars, "0x0 isn't ")); + return true; + }, + "0xC0 0x80")); static const char notShortestFormNonzero[] = "var x = \xE0\x87\x80"; - CHECK(testBadUtf8( - notShortestFormNonzero, JSMSG_FORBIDDEN_UTF8_CODE_POINT, - [this](JS::ConstUTF8CharsZ message) { - const char* chars = message.c_str(); - CHECK(isNotShortestFormMessage(chars)); - CHECK(startsWith(chars, "0x1C0 isn't ")); - return true; - }, - "0xE0 0x87 0x80")); + CHECK(testBadUtf8(notShortestFormNonzero, JSMSG_FORBIDDEN_UTF8_CODE_POINT, + [this](JS::ConstUTF8CharsZ message) { + const char* chars = message.c_str(); + CHECK(isNotShortestFormMessage(chars)); + CHECK(startsWith(chars, "0x1C0 isn't ")); + return true; + }, + "0xE0 0x87 0x80")); return true; } diff --git a/js/src/jsapi-tests/testSetProperty.cpp b/js/src/jsapi-tests/testSetProperty.cpp index a1f195f88250..529f3cf6f58e 100644 --- a/js/src/jsapi-tests/testSetProperty.cpp +++ b/js/src/jsapi-tests/testSetProperty.cpp @@ -43,8 +43,8 @@ const JSClass* getGlobalClass(void) override { JS_GlobalObjectTraceHook}; static const JSClass noResolveGlobalClass = { - "testSetProperty_InheritedGlobalSetter_noResolveGlobalClass", - JSCLASS_GLOBAL_FLAGS, &noResolveGlobalClassOps}; + "testSetProperty_InheritedGlobalSetter_noResolveGlobalClass", + JSCLASS_GLOBAL_FLAGS, &noResolveGlobalClassOps}; return &noResolveGlobalClass; } diff --git a/js/src/jsapi-tests/testUbiNode.cpp b/js/src/jsapi-tests/testUbiNode.cpp index 5bbbfade8b7d..80c70b0c1d1e 100644 --- a/js/src/jsapi-tests/testUbiNode.cpp +++ b/js/src/jsapi-tests/testUbiNode.cpp @@ -226,12 +226,11 @@ BEGIN_TEST(test_ubiStackFrame) { // All frames should be from the "filename.js" source. while (ubiFrame) { - CHECK(checkString( - "filename.js", - [&](mozilla::RangedPtr ptr, size_t length) { - return ubiFrame.source(ptr, length); - }, - [&] { return ubiFrame.source(); })); + CHECK(checkString("filename.js", + [&](mozilla::RangedPtr ptr, size_t length) { + return ubiFrame.source(ptr, length); + }, + [&] { return ubiFrame.source(); })); ubiFrame = ubiFrame.parent(); } diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 937b0a8466b3..a09ea68ece95 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -19,7 +19,7 @@ #include "gc/GC.h" #include "js/AllocPolicy.h" #include "js/CharacterEncoding.h" -#include "js/Equality.h" // JS::SameValue +#include "js/Equality.h" // JS::SameValue #include "js/RegExpFlags.h" // JS::RegExpFlags #include "js/Vector.h" #include "vm/JSContext.h" diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 26db79a8efe7..618413139eb0 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -6784,9 +6784,7 @@ static bool GetSharedObject(JSContext* cx, unsigned argc, Value* vp) { } break; } - default: { - MOZ_CRASH(); - } + default: { MOZ_CRASH(); } } } diff --git a/js/src/vm/BigIntType.cpp b/js/src/vm/BigIntType.cpp index 3b07239545f7..47d5a6f84951 100644 --- a/js/src/vm/BigIntType.cpp +++ b/js/src/vm/BigIntType.cpp @@ -271,7 +271,7 @@ BigInt::Digit BigInt::digitDiv(Digit high, Digit low, Digit divisor, : "=a"(quotient), "=d"(rem) // Inputs: put `high` into rdx, `low` into rax, and `divisor` into // any register or stack slot. - : "d"(high), "a"(low), [ divisor ] "rm"(divisor)); + : "d"(high), "a"(low), [divisor] "rm"(divisor)); *remainder = rem; return quotient; #elif defined(__i386__) @@ -282,7 +282,7 @@ BigInt::Digit BigInt::digitDiv(Digit high, Digit low, Digit divisor, : "=a"(quotient), "=d"(rem) // Inputs: put `high` into edx, `low` into eax, and `divisor` into // any register or stack slot. - : "d"(high), "a"(low), [ divisor ] "rm"(divisor)); + : "d"(high), "a"(low), [divisor] "rm"(divisor)); *remainder = rem; return quotient; #else diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index ebb0dc6ca1c8..aa4976a74f97 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -866,14 +866,14 @@ bool Debugger::hasAnyLiveHooks(JSRuntime* rt) const { ResumeMode Debugger::slowPathOnEnterFrame(JSContext* cx, AbstractFramePtr frame) { RootedValue rval(cx); - ResumeMode resumeMode = dispatchHook( - cx, - [frame](Debugger* dbg) -> bool { - return dbg->observesFrame(frame) && dbg->observesEnterFrame(); - }, - [&](Debugger* dbg) -> ResumeMode { - return dbg->fireEnterFrame(cx, &rval); - }); + ResumeMode resumeMode = dispatchHook(cx, + [frame](Debugger* dbg) -> bool { + return dbg->observesFrame(frame) && + dbg->observesEnterFrame(); + }, + [&](Debugger* dbg) -> ResumeMode { + return dbg->fireEnterFrame(cx, &rval); + }); switch (resumeMode) { case ResumeMode::Continue: diff --git a/js/src/vm/MallocProvider.h b/js/src/vm/MallocProvider.h index b73dba4a81ea..9594b1621055 100644 --- a/js/src/vm/MallocProvider.h +++ b/js/src/vm/MallocProvider.h @@ -194,12 +194,11 @@ struct MallocProvider { } JS_DECLARE_NEW_METHODS(new_, pod_malloc, MOZ_ALWAYS_INLINE) - JS_DECLARE_NEW_ARENA_METHODS( - arena_new_, - [this](arena_id_t arena, size_t size) { - return pod_malloc(size, arena); - }, - MOZ_ALWAYS_INLINE) + JS_DECLARE_NEW_ARENA_METHODS(arena_new_, + [this](arena_id_t arena, size_t size) { + return pod_malloc(size, arena); + }, + MOZ_ALWAYS_INLINE) JS_DECLARE_MAKE_METHODS(make_unique, new_, MOZ_ALWAYS_INLINE) JS_DECLARE_MAKE_METHODS(arena_make_unique, arena_new_, MOZ_ALWAYS_INLINE) diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index e258e45a2056..893875aaaf6b 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -2096,9 +2096,7 @@ bool TypedArrayObject::getElementPure(uint32_t index, Value* vp) { } /* static */ -bool TypedArrayObject::getElements(JSContext* cx, - Handle tarray, - Value* vp) { +bool TypedArrayObject::getElements(JSContext* cx, Handle tarray, Value* vp) { uint32_t length = tarray->length(); MOZ_ASSERT_IF(length > 0, !tarray->hasDetachedBuffer()); diff --git a/js/src/vm/TypedArrayObject.h b/js/src/vm/TypedArrayObject.h index e313c2dacca3..d72aac51b631 100644 --- a/js/src/vm/TypedArrayObject.h +++ b/js/src/vm/TypedArrayObject.h @@ -140,8 +140,7 @@ class TypedArrayObject : public ArrayBufferViewObject { * Copy all elements from this typed array to vp. vp must point to rooted * memory. */ - static bool getElements(JSContext* cx, Handle tarray, - Value* vp); + static bool getElements(JSContext* cx, Handle tarray, Value* vp); static bool GetTemplateObjectForNative(JSContext* cx, Native native, const JS::HandleValueArray args, diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompile.cpp index 5f31b4e48f3e..cb9b637004f3 100644 --- a/js/src/wasm/WasmBaselineCompile.cpp +++ b/js/src/wasm/WasmBaselineCompile.cpp @@ -3225,9 +3225,7 @@ class BaseCompiler final : public BaseCompilerInterface { stackMapGenerator_.memRefsOnStk++; break; } - default: { - break; - } + default: { break; } } } } @@ -3765,9 +3763,7 @@ class BaseCompiler final : public BaseCompilerInterface { k == Stk::MemRef || k == Stk::LocalRef); return Some(AnyReg(popRef(joinRegPtr_))); } - default: { - MOZ_CRASH("Compiler bug: unexpected expression type"); - } + default: { MOZ_CRASH("Compiler bug: unexpected expression type"); } } } @@ -5570,9 +5566,7 @@ class BaseCompiler final : public BaseCompilerInterface { masm.wasmAtomicFetchOp(access, op, rv, srcAddr, temps[0], rd); #endif break; - default: { - MOZ_CRASH("Bad type for atomic operation"); - } + default: { MOZ_CRASH("Bad type for atomic operation"); } } } @@ -7979,9 +7973,7 @@ void BaseCompiler::emitBranchSetup(BranchState* b) { pop2xF64(&b->f64.lhs, &b->f64.rhs); break; } - default: { - MOZ_CRASH("Unexpected type for LatentOp::Compare"); - } + default: { MOZ_CRASH("Unexpected type for LatentOp::Compare"); } } break; } @@ -8001,9 +7993,7 @@ void BaseCompiler::emitBranchSetup(BranchState* b) { b->i64.imm = 0; break; } - default: { - MOZ_CRASH("Unexpected type for LatentOp::Eqz"); - } + default: { MOZ_CRASH("Unexpected type for LatentOp::Eqz"); } } break; } @@ -8048,9 +8038,7 @@ void BaseCompiler::emitBranchPerform(BranchState* b) { freeF64(b->f64.rhs); break; } - default: { - MOZ_CRASH("Unexpected type for LatentOp::Compare"); - } + default: { MOZ_CRASH("Unexpected type for LatentOp::Compare"); } } resetLatentOp(); } @@ -8525,9 +8513,7 @@ void BaseCompiler::doReturn(ExprType type, bool popStack) { freeRef(rv); break; } - default: { - MOZ_CRASH("Function return type"); - } + default: { MOZ_CRASH("Function return type"); } } } @@ -9608,9 +9594,7 @@ bool BaseCompiler::emitSelect() { pushRef(r); break; } - default: { - MOZ_CRASH("select type"); - } + default: { MOZ_CRASH("select type"); } } return true; @@ -10530,9 +10514,7 @@ bool BaseCompiler::emitStructNew() { } case ValType::NullRef: MOZ_CRASH("NullRef not expressible"); - default: { - MOZ_CRASH("Unexpected field type"); - } + default: { MOZ_CRASH("Unexpected field type"); } } } @@ -10606,9 +10588,7 @@ bool BaseCompiler::emitStructGet() { case ValType::NullRef: { MOZ_CRASH("NullRef not expressible"); } - default: { - MOZ_CRASH("Unexpected field type"); - } + default: { MOZ_CRASH("Unexpected field type"); } } freeRef(rp); @@ -10714,9 +10694,7 @@ bool BaseCompiler::emitStructSet() { case ValType::NullRef: { MOZ_CRASH("NullRef not expressible"); } - default: { - MOZ_CRASH("Unexpected field type"); - } + default: { MOZ_CRASH("Unexpected field type"); } } freeRef(rp); diff --git a/js/src/wasm/WasmCraneliftCompile.cpp b/js/src/wasm/WasmCraneliftCompile.cpp index f75ac76f99bd..3c78e54d5bec 100644 --- a/js/src/wasm/WasmCraneliftCompile.cpp +++ b/js/src/wasm/WasmCraneliftCompile.cpp @@ -159,9 +159,7 @@ static bool GenerateCraneliftCode(WasmMacroAssembler& masm, masm.append(SymbolicAccess(CodeOffset(offset.value()), sym)); break; } - default: { - MOZ_CRASH("unknown cranelift metadata kind"); - } + default: { MOZ_CRASH("unknown cranelift metadata kind"); } } } diff --git a/js/src/wasm/WasmInstance.cpp b/js/src/wasm/WasmInstance.cpp index 304ee639e08c..e4cf09954942 100644 --- a/js/src/wasm/WasmInstance.cpp +++ b/js/src/wasm/WasmInstance.cpp @@ -1068,9 +1068,7 @@ void CopyValPostBarriered(uint8_t* dst, const Val& src) { case ValType::NullRef: { break; } - default: { - MOZ_CRASH("unexpected Val type"); - } + default: { MOZ_CRASH("unexpected Val type"); } } } diff --git a/js/src/wasm/WasmIonCompile.cpp b/js/src/wasm/WasmIonCompile.cpp index 61f1c56e21bd..10c9f2eda843 100644 --- a/js/src/wasm/WasmIonCompile.cpp +++ b/js/src/wasm/WasmIonCompile.cpp @@ -494,9 +494,7 @@ class FunctionCompiler { ins = MSignExtendInt64::New(alloc(), op, mode); break; } - default: { - MOZ_CRASH("Bad sign extension"); - } + default: { MOZ_CRASH("Bad sign extension"); } } curBlock_->add(ins); return ins; @@ -2938,8 +2936,7 @@ static bool EmitMemOrTableCopy(FunctionCompiler& f, bool isMem) { uint32_t lineOrBytecode = f.readCallSiteLineOrBytecode(); - const SymbolicAddressSignature& callee = - isMem ? SASigMemCopy : SASigTableCopy; + const SymbolicAddressSignature& callee = isMem ? SASigMemCopy : SASigTableCopy; CallCompileState args; if (!f.passInstance(callee.argTypes[0], &args)) { return false; @@ -3085,8 +3082,7 @@ static bool EmitMemOrTableInit(FunctionCompiler& f, bool isMem) { uint32_t lineOrBytecode = f.readCallSiteLineOrBytecode(); - const SymbolicAddressSignature& callee = - isMem ? SASigMemInit : SASigTableInit; + const SymbolicAddressSignature& callee = isMem ? SASigMemInit : SASigTableInit; CallCompileState args; if (!f.passInstance(callee.argTypes[0], &args)) { return false; diff --git a/js/src/wasm/WasmJS.cpp b/js/src/wasm/WasmJS.cpp index 35f97ee5237d..6e6eeb12931a 100644 --- a/js/src/wasm/WasmJS.cpp +++ b/js/src/wasm/WasmJS.cpp @@ -2119,9 +2119,7 @@ bool WasmTableObject::getImpl(JSContext* cx, const CallArgs& args) { args.rval().set(UnboxAnyRef(table.getAnyRef(index))); break; } - default: { - MOZ_CRASH("Unexpected table kind"); - } + default: { MOZ_CRASH("Unexpected table kind"); } } return true; } @@ -2211,9 +2209,7 @@ bool WasmTableObject::setImpl(JSContext* cx, const CallArgs& args) { table.setAnyRef(index, tmp); break; } - default: { - MOZ_CRASH("Unexpected table kind"); - } + default: { MOZ_CRASH("Unexpected table kind"); } } args.rval().setUndefined(); @@ -2296,9 +2292,7 @@ bool WasmTableObject::growImpl(JSContext* cx, const CallArgs& args) { } break; } - default: { - MOZ_CRASH("Unexpected table kind"); - } + default: { MOZ_CRASH("Unexpected table kind"); } } args.rval().setInt32(oldLength); diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp index a8c06746c2c6..0f1502633da1 100644 --- a/js/src/wasm/WasmStubs.cpp +++ b/js/src/wasm/WasmStubs.cpp @@ -845,9 +845,7 @@ static bool GenerateJitEntry(MacroAssembler& masm, size_t funcExportIndex, } break; } - default: { - MOZ_CRASH("unexpected input argument when calling from jit"); - } + default: { MOZ_CRASH("unexpected input argument when calling from jit"); } } } diff --git a/js/src/wasm/WasmValidate.cpp b/js/src/wasm/WasmValidate.cpp index b50f3381fdce..ba7149371336 100644 --- a/js/src/wasm/WasmValidate.cpp +++ b/js/src/wasm/WasmValidate.cpp @@ -1975,9 +1975,7 @@ static bool DecodeInitializerExpression(Decoder& d, ModuleEnvironment* env, } break; } - default: { - return d.fail("unexpected initializer expression"); - } + default: { return d.fail("unexpected initializer expression"); } } if (expected != init->type()) { diff --git a/js/xpconnect/loader/AutoMemMap.h b/js/xpconnect/loader/AutoMemMap.h index d6ed8815c7e0..eee036d169cc 100644 --- a/js/xpconnect/loader/AutoMemMap.h +++ b/js/xpconnect/loader/AutoMemMap.h @@ -42,7 +42,8 @@ class AutoMemMap { // Unix-like systems, this is identical to the above init() method. On // Windows, the FileDescriptor must be a handle for a file mapping, // rather than a file descriptor. - Result initWithHandle(const FileDescriptor& file, size_t size, + Result initWithHandle(const FileDescriptor& file, + size_t size, PRFileMapProtect prot = PR_PROT_READONLY); void reset(); diff --git a/layout/build/nsContentDLF.cpp b/layout/build/nsContentDLF.cpp index a4ffc0ffad14..c6d1222b808a 100644 --- a/layout/build/nsContentDLF.cpp +++ b/layout/build/nsContentDLF.cpp @@ -150,41 +150,41 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel, // Try html or plaintext; both use the same document CID if (IsTypeInList(contentType, gHTMLTypes) || nsContentUtils::IsPlainTextType(contentType)) { - return CreateDocument( - aCommand, aChannel, aLoadGroup, aContainer, - []() -> already_AddRefed { - RefPtr doc; - nsresult rv = NS_NewHTMLDocument(getter_AddRefs(doc)); - NS_ENSURE_SUCCESS(rv, nullptr); - return doc.forget(); - }, - aDocListener, aDocViewer); + return CreateDocument(aCommand, aChannel, aLoadGroup, aContainer, + []() -> already_AddRefed { + RefPtr doc; + nsresult rv = + NS_NewHTMLDocument(getter_AddRefs(doc)); + NS_ENSURE_SUCCESS(rv, nullptr); + return doc.forget(); + }, + aDocListener, aDocViewer); } // Try XML if (IsTypeInList(contentType, gXMLTypes)) { - return CreateDocument( - aCommand, aChannel, aLoadGroup, aContainer, - []() -> already_AddRefed { - RefPtr doc; - nsresult rv = NS_NewXMLDocument(getter_AddRefs(doc)); - NS_ENSURE_SUCCESS(rv, nullptr); - return doc.forget(); - }, - aDocListener, aDocViewer); + return CreateDocument(aCommand, aChannel, aLoadGroup, aContainer, + []() -> already_AddRefed { + RefPtr doc; + nsresult rv = + NS_NewXMLDocument(getter_AddRefs(doc)); + NS_ENSURE_SUCCESS(rv, nullptr); + return doc.forget(); + }, + aDocListener, aDocViewer); } // Try SVG if (IsTypeInList(contentType, gSVGTypes)) { - return CreateDocument( - aCommand, aChannel, aLoadGroup, aContainer, - []() -> already_AddRefed { - RefPtr doc; - nsresult rv = NS_NewSVGDocument(getter_AddRefs(doc)); - NS_ENSURE_SUCCESS(rv, nullptr); - return doc.forget(); - }, - aDocListener, aDocViewer); + return CreateDocument(aCommand, aChannel, aLoadGroup, aContainer, + []() -> already_AddRefed { + RefPtr doc; + nsresult rv = + NS_NewSVGDocument(getter_AddRefs(doc)); + NS_ENSURE_SUCCESS(rv, nullptr); + return doc.forget(); + }, + aDocListener, aDocViewer); } // Try XUL @@ -200,28 +200,28 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel, if (mozilla::DecoderTraits::ShouldHandleMediaType( contentType.get(), /* DecoderDoctorDiagnostics* */ nullptr)) { - return CreateDocument( - aCommand, aChannel, aLoadGroup, aContainer, - []() -> already_AddRefed { - RefPtr doc; - nsresult rv = NS_NewVideoDocument(getter_AddRefs(doc)); - NS_ENSURE_SUCCESS(rv, nullptr); - return doc.forget(); - }, - aDocListener, aDocViewer); + return CreateDocument(aCommand, aChannel, aLoadGroup, aContainer, + []() -> already_AddRefed { + RefPtr doc; + nsresult rv = + NS_NewVideoDocument(getter_AddRefs(doc)); + NS_ENSURE_SUCCESS(rv, nullptr); + return doc.forget(); + }, + aDocListener, aDocViewer); } // Try image types if (IsImageContentType(contentType.get())) { - return CreateDocument( - aCommand, aChannel, aLoadGroup, aContainer, - []() -> already_AddRefed { - RefPtr doc; - nsresult rv = NS_NewImageDocument(getter_AddRefs(doc)); - NS_ENSURE_SUCCESS(rv, nullptr); - return doc.forget(); - }, - aDocListener, aDocViewer); + return CreateDocument(aCommand, aChannel, aLoadGroup, aContainer, + []() -> already_AddRefed { + RefPtr doc; + nsresult rv = + NS_NewImageDocument(getter_AddRefs(doc)); + NS_ENSURE_SUCCESS(rv, nullptr); + return doc.forget(); + }, + aDocListener, aDocViewer); } RefPtr pluginHost = nsPluginHost::GetInst(); @@ -229,15 +229,15 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel, // is disabled" placeholder. if (pluginHost && pluginHost->HavePluginForType(contentType, nsPluginHost::eExcludeNone)) { - return CreateDocument( - aCommand, aChannel, aLoadGroup, aContainer, - []() -> already_AddRefed { - RefPtr doc; - nsresult rv = NS_NewPluginDocument(getter_AddRefs(doc)); - NS_ENSURE_SUCCESS(rv, nullptr); - return doc.forget(); - }, - aDocListener, aDocViewer); + return CreateDocument(aCommand, aChannel, aLoadGroup, aContainer, + []() -> already_AddRefed { + RefPtr doc; + nsresult rv = + NS_NewPluginDocument(getter_AddRefs(doc)); + NS_ENSURE_SUCCESS(rv, nullptr); + return doc.forget(); + }, + aDocListener, aDocViewer); } // If we get here, then we weren't able to create anything. Sorry! diff --git a/layout/generic/WritingModes.h b/layout/generic/WritingModes.h index fcdf22d878a4..c0d4a2b3ebae 100644 --- a/layout/generic/WritingModes.h +++ b/layout/generic/WritingModes.h @@ -362,9 +362,8 @@ class WritingMode { if (IsBlock(aSide)) { static_assert(eOrientationMask == 0x01 && eBlockFlowMask == 0x04, "unexpected mask values"); - const auto wm = - static_cast(((mWritingMode & eBlockFlowMask) >> 1) | - (mWritingMode & eOrientationMask)); + const auto wm = static_cast(((mWritingMode & eBlockFlowMask) >> 1) | + (mWritingMode & eOrientationMask)); return PhysicalSideForBlockAxis(wm, GetEdge(aSide)); } diff --git a/layout/generic/nsTextFrameUtils.cpp b/layout/generic/nsTextFrameUtils.cpp index a5fc18cb708d..c05aca49b5db 100644 --- a/layout/generic/nsTextFrameUtils.cpp +++ b/layout/generic/nsTextFrameUtils.cpp @@ -19,7 +19,7 @@ using namespace mozilla; // static bool nsTextFrameUtils::IsSpaceCombiningSequenceTail(const char16_t* aChars, - int32_t aLength) { + int32_t aLength) { return aLength > 0 && (mozilla::unicode::IsClusterExtender(aChars[0]) || (IsBidiControl(aChars[0]) && diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp index 5cc94be22f6d..3c269085a5c3 100644 --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -4859,8 +4859,7 @@ void ContainerState::ProcessDisplayItems(nsDisplayList* aList) { nsIntRegion itemVisibleRegion = itemVisibleRect; nsRegion tightBounds = item->GetTightBounds(mBuilder, &snap); if (!tightBounds.IsEmpty()) { - itemVisibleRegion.AndWith( - ScaleRegionToOutsidePixels(tightBounds, snap)); + itemVisibleRegion.AndWith(ScaleRegionToOutsidePixels(tightBounds, snap)); } ContainerLayer* oldContainer = ownLayer->GetParent(); diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 57d0923e1f46..9d9aa3b54a60 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -1602,20 +1602,19 @@ Loader::Completed Loader::ParseSheet(const nsACString& aBytes, RefPtr loadData = aLoadData; nsCOMPtr target = DispatchTarget(); sheet->ParseSheet(this, aBytes, aLoadData) - ->Then( - target, __func__, - [loadData = std::move(loadData)](bool aDummy) { - MOZ_ASSERT(NS_IsMainThread()); - loadData->mIsBeingParsed = false; - loadData->mLoader->UnblockOnload(/* aFireSync = */ false); - // If there are no child sheets outstanding, mark us as complete. - // Otherwise, the children are holding strong refs to the data - // and will call SheetComplete() on it when they complete. - if (loadData->mPendingChildren == 0) { - loadData->mLoader->SheetComplete(loadData, NS_OK); - } - }, - [] { MOZ_CRASH("rejected parse promise"); }); + ->Then(target, __func__, + [loadData = std::move(loadData)](bool aDummy) { + MOZ_ASSERT(NS_IsMainThread()); + loadData->mIsBeingParsed = false; + loadData->mLoader->UnblockOnload(/* aFireSync = */ false); + // If there are no child sheets outstanding, mark us as complete. + // Otherwise, the children are holding strong refs to the data + // and will call SheetComplete() on it when they complete. + if (loadData->mPendingChildren == 0) { + loadData->mLoader->SheetComplete(loadData, NS_OK); + } + }, + [] { MOZ_CRASH("rejected parse promise"); }); return Completed::No; } diff --git a/media/gmp-clearkey/0.1/gtest/TestClearKeyUtils.cpp b/media/gmp-clearkey/0.1/gtest/TestClearKeyUtils.cpp index bff6d0f35660..aafba73dc380 100644 --- a/media/gmp-clearkey/0.1/gtest/TestClearKeyUtils.cpp +++ b/media/gmp-clearkey/0.1/gtest/TestClearKeyUtils.cpp @@ -65,8 +65,7 @@ const B64Test tests[] = { {"_", {}, false}, // 1 character is too few. }; -TEST(ClearKey, DecodeBase64) -{ +TEST(ClearKey, DecodeBase64) { for (const B64Test& test : tests) { vector v; bool rv = DecodeBase64(string(test.b64), v); diff --git a/media/mtransport/test/ice_unittest.cpp b/media/mtransport/test/ice_unittest.cpp index b1bf84884907..0c04ac13fd8b 100644 --- a/media/mtransport/test/ice_unittest.cpp +++ b/media/mtransport/test/ice_unittest.cpp @@ -1098,13 +1098,13 @@ class IceTestPeer : public sigslot::has_slots<> { std::vector old_pairs = *new_pairs; GetCandidatePairs(stream_index, new_pairs); ASSERT_TRUE(CandidatePairsPriorityDescending(*new_pairs)) - << "New list of " - "candidate pairs is either not sorted in priority order, or has " - "duplicate priorities."; + << "New list of " + "candidate pairs is either not sorted in priority order, or has " + "duplicate priorities."; ASSERT_TRUE(CandidatePairsPriorityDescending(old_pairs)) - << "Old list of " - "candidate pairs is either not sorted in priority order, or has " - "duplicate priorities. This indicates some bug in the test case."; + << "Old list of " + "candidate pairs is either not sorted in priority order, or has " + "duplicate priorities. This indicates some bug in the test case."; std::vector added_pairs; std::vector removed_pairs; @@ -1134,9 +1134,8 @@ class IceTestPeer : public sigslot::has_slots<> { DumpCandidatePair(removed_pair); } - ASSERT_TRUE(removed_pairs.empty()) - << "At least one candidate pair has " - "gone missing."; + ASSERT_TRUE(removed_pairs.empty()) << "At least one candidate pair has " + "gone missing."; } void StreamReady(NrIceMediaStream* stream) { @@ -1221,8 +1220,7 @@ class IceTestPeer : public sigslot::has_slots<> { void ParseCandidate_s(size_t i, const std::string& candidate) { auto media_stream = GetStream_s(i); - ASSERT_TRUE(media_stream.get()) - << "No such stream " << i; + ASSERT_TRUE(media_stream.get()) << "No such stream " << i; media_stream->ParseTrickleCandidate(candidate, ""); } @@ -1235,8 +1233,7 @@ class IceTestPeer : public sigslot::has_slots<> { void DisableComponent_s(size_t index, int component_id) { ASSERT_LT(index, stream_counter_); auto stream = GetStream_s(index); - ASSERT_TRUE(stream.get()) - << "No such stream " << index; + ASSERT_TRUE(stream.get()) << "No such stream " << index; nsresult res = stream->DisableComponent(component_id); ASSERT_TRUE(NS_SUCCEEDED(res)); } @@ -1252,8 +1249,7 @@ class IceTestPeer : public sigslot::has_slots<> { ConsentStatus status) { ASSERT_LT(index, stream_counter_); auto stream = GetStream_s(index); - ASSERT_TRUE(stream.get()) - << "No such stream " << index; + ASSERT_TRUE(stream.get()) << "No such stream " << index; bool can_send; struct timeval timestamp; nsresult res = @@ -3848,8 +3844,7 @@ TEST_F(WebRtcIcePacketFilterTest, TestRecvDataPacketWithAPendingAddress) { ASSERT_EQ(0, nr_stun_message_destroy(&msg)); } -TEST(WebRtcIceInternalsTest, TestAddBogusAttribute) -{ +TEST(WebRtcIceInternalsTest, TestAddBogusAttribute) { nr_stun_message* req; ASSERT_EQ(0, nr_stun_message_create(&req)); Data* data; diff --git a/media/mtransport/test/simpletokenbucket_unittest.cpp b/media/mtransport/test/simpletokenbucket_unittest.cpp index 937a1b7078f9..42c27d2e8be6 100644 --- a/media/mtransport/test/simpletokenbucket_unittest.cpp +++ b/media/mtransport/test/simpletokenbucket_unittest.cpp @@ -28,46 +28,39 @@ class TestSimpleTokenBucket : public SimpleTokenBucket { } }; -TEST(SimpleTokenBucketTest, TestConstruct) -{ TestSimpleTokenBucket b(10, 1); } +TEST(SimpleTokenBucketTest, TestConstruct) { TestSimpleTokenBucket b(10, 1); } -TEST(SimpleTokenBucketTest, TestGet) -{ +TEST(SimpleTokenBucketTest, TestGet) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(5U, b.getTokens(5)); } -TEST(SimpleTokenBucketTest, TestGetAll) -{ +TEST(SimpleTokenBucketTest, TestGetAll) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(10U, b.getTokens(10)); } -TEST(SimpleTokenBucketTest, TestGetInsufficient) -{ +TEST(SimpleTokenBucketTest, TestGetInsufficient) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(5U, b.getTokens(5)); ASSERT_EQ(5U, b.getTokens(6)); } -TEST(SimpleTokenBucketTest, TestGetBucketCount) -{ +TEST(SimpleTokenBucketTest, TestGetBucketCount) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(10U, b.getTokens(UINT32_MAX)); ASSERT_EQ(5U, b.getTokens(5)); ASSERT_EQ(5U, b.getTokens(UINT32_MAX)); } -TEST(SimpleTokenBucketTest, TestTokenRefill) -{ +TEST(SimpleTokenBucketTest, TestTokenRefill) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(5U, b.getTokens(5)); b.fastForward(1000); ASSERT_EQ(6U, b.getTokens(6)); } -TEST(SimpleTokenBucketTest, TestNoTimeWasted) -{ +TEST(SimpleTokenBucketTest, TestNoTimeWasted) { // Makes sure that when the time elapsed is insufficient to add any // tokens to the bucket, the internal timestamp that is used in this // calculation is not updated (ie; two subsequent 0.5 second elapsed times @@ -80,8 +73,7 @@ TEST(SimpleTokenBucketTest, TestNoTimeWasted) ASSERT_EQ(6U, b.getTokens(6)); } -TEST(SimpleTokenBucketTest, TestNegativeTime) -{ +TEST(SimpleTokenBucketTest, TestNegativeTime) { TestSimpleTokenBucket b(10, 1); b.fastForward(-1000); // Make sure we don't end up with an invalid number of tokens, but otherwise @@ -89,15 +81,13 @@ TEST(SimpleTokenBucketTest, TestNegativeTime) ASSERT_GT(11U, b.getTokens(100)); } -TEST(SimpleTokenBucketTest, TestEmptyBucket) -{ +TEST(SimpleTokenBucketTest, TestEmptyBucket) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(10U, b.getTokens(10)); ASSERT_EQ(0U, b.getTokens(10)); } -TEST(SimpleTokenBucketTest, TestEmptyThenFillBucket) -{ +TEST(SimpleTokenBucketTest, TestEmptyThenFillBucket) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(10U, b.getTokens(10)); ASSERT_EQ(0U, b.getTokens(1)); @@ -105,8 +95,7 @@ TEST(SimpleTokenBucketTest, TestEmptyThenFillBucket) ASSERT_EQ(10U, b.getTokens(10)); } -TEST(SimpleTokenBucketTest, TestNoOverflow) -{ +TEST(SimpleTokenBucketTest, TestNoOverflow) { TestSimpleTokenBucket b(10, 1); ASSERT_EQ(10U, b.getTokens(10)); ASSERT_EQ(0U, b.getTokens(1)); diff --git a/media/mtransport/test/test_nr_socket_unittest.cpp b/media/mtransport/test/test_nr_socket_unittest.cpp index a78e48d9fcf1..21c70b4d7f42 100644 --- a/media/mtransport/test/test_nr_socket_unittest.cpp +++ b/media/mtransport/test/test_nr_socket_unittest.cpp @@ -93,8 +93,7 @@ class TestNrSocketTest : public MtransportTest { void CreatePublicAddrs_s(size_t count, const char *ip_str, int proto) { while (count--) { auto sock = CreateTestNrSocket_s(ip_str, proto, nullptr); - ASSERT_TRUE(sock) - << "Failed to create socket"; + ASSERT_TRUE(sock) << "Failed to create socket"; public_addrs_.push_back(sock); } } @@ -658,8 +657,8 @@ TEST_F(TestNrSocketTest, PortDependentMappingFullCone) { ASSERT_TRUE(nr_transport_addr_cmp(&sender_external_address0, &sender_external_address1, NR_TRANSPORT_ADDR_CMP_MODE_ALL)) - << "addr1: " << sender_external_address0.as_string - << " addr2: " << sender_external_address1.as_string; + << "addr1: " << sender_external_address0.as_string + << " addr2: " << sender_external_address1.as_string; // Verify that return traffic works ASSERT_TRUE(CheckConnectivityVia(public_addrs_[1], private_addrs_[0], diff --git a/media/psshparser/gtest/TestPsshParser.cpp b/media/psshparser/gtest/TestPsshParser.cpp index 2027090a1fb2..16ff272d85ea 100644 --- a/media/psshparser/gtest/TestPsshParser.cpp +++ b/media/psshparser/gtest/TestPsshParser.cpp @@ -125,8 +125,7 @@ const uint8_t g2xGoogleWPTCencInitData[] = { // clang-format on }; -TEST(PsshParser, ParseCencInitData) -{ +TEST(PsshParser, ParseCencInitData) { std::vector> keyIds; bool rv; diff --git a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp index 1c808a32ff13..27256406786a 100644 --- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp +++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp @@ -121,10 +121,10 @@ class JsepSessionTest : public JsepSessionTestBase, for (const RefPtr& oldTransceiver : oldTransceivers) { if (oldTransceiver->HasLevel()) { ASSERT_TRUE(levels.count(oldTransceiver->GetLevel())) - << "Level " << oldTransceiver->GetLevel() - << " had a transceiver in the old, but not the new (or, " - "perhaps this level had more than one transceiver in the " - "old)"; + << "Level " << oldTransceiver->GetLevel() + << " had a transceiver in the old, but not the new (or, " + "perhaps this level had more than one transceiver in the " + "old)"; levels.erase(oldTransceiver->GetLevel()); } } @@ -1077,7 +1077,7 @@ class JsepSessionTest : public JsepSessionTestBase, expectedCandidates[transportId][RTCP].size()); ASSERT_TRUE(attrs.HasAttribute(SdpAttribute::kCandidateAttribute)) - << context << " (level " << msection.GetLevel() << ")"; + << context << " (level " << msection.GetLevel() << ")"; auto& candidates = attrs.GetCandidate(); ASSERT_EQ(kNumCandidatesPerComponent * 2, candidates.size()) << context << " (level " << msection.GetLevel() << ")"; @@ -1124,7 +1124,7 @@ class JsepSessionTest : public JsepSessionTestBase, auto defaultCandidates = mDefaultCandidates; ASSERT_TRUE(msection.GetAttributeList().HasAttribute( SdpAttribute::kRtcpAttribute)) - << context << " (level " << msection.GetLevel() << ")"; + << context << " (level " << msection.GetLevel() << ")"; auto& rtcpAttr = msection.GetAttributeList().GetRtcp(); ASSERT_EQ(defaultCandidates[transportId][RTCP].second, rtcpAttr.mPort) << context << " (level " << msection.GetLevel() << ")"; @@ -1173,7 +1173,7 @@ class JsepSessionTest : public JsepSessionTestBase, if (expectEoc) { ASSERT_TRUE(msection.GetAttributeList().HasAttribute( SdpAttribute::kEndOfCandidatesAttribute)) - << context << " (level " << msection.GetLevel() << ")"; + << context << " (level " << msection.GetLevel() << ")"; } else { ASSERT_FALSE(msection.GetAttributeList().HasAttribute( SdpAttribute::kEndOfCandidatesAttribute)) @@ -1184,8 +1184,7 @@ class JsepSessionTest : public JsepSessionTestBase, void CheckTransceiversAreBundled(const JsepSession& session, const std::string& context) { for (const auto& transceiver : session.GetTransceivers()) { - ASSERT_TRUE(transceiver->HasBundleLevel()) - << context; + ASSERT_TRUE(transceiver->HasBundleLevel()) << context; ASSERT_EQ(0U, transceiver->BundleLevel()) << context; } } @@ -3997,8 +3996,7 @@ TEST_P(JsepSessionTest, TestRejectMline) { EnsureNegotiationFailure(types.front(), "webrtc-datachannel"); break; default: - ASSERT_TRUE(false) - << "Unknown media type"; + ASSERT_TRUE(false) << "Unknown media type"; } AddTracks(*mSessionOff); @@ -4022,8 +4020,7 @@ TEST_P(JsepSessionTest, TestRejectMline) { } } - ASSERT_TRUE(failed_section) - << "Failed type was entirely absent from SDP"; + ASSERT_TRUE(failed_section) << "Failed type was entirely absent from SDP"; auto& failed_attrs = failed_section->GetAttributeList(); ASSERT_EQ(SdpDirectionAttribute::kInactive, failed_attrs.GetDirection()); ASSERT_EQ(0U, failed_section->GetPort()); @@ -4396,8 +4393,7 @@ TEST_F(JsepSessionTest, UnknownFingerprintAlgorithm) { ASSERT_NE("", mSessionAns->GetLastError()); } -TEST(H264ProfileLevelIdTest, TestLevelComparisons) -{ +TEST(H264ProfileLevelIdTest, TestLevelComparisons) { ASSERT_LT(JsepVideoCodecDescription::GetSaneH264Level(0x421D0B), // 1b JsepVideoCodecDescription::GetSaneH264Level(0x420D0B)); // 1.1 ASSERT_LT(JsepVideoCodecDescription::GetSaneH264Level(0x420D0A), // 1.0 @@ -4413,8 +4409,7 @@ TEST(H264ProfileLevelIdTest, TestLevelComparisons) JsepVideoCodecDescription::GetSaneH264Level(0x64000B)); // 1.1 } -TEST(H264ProfileLevelIdTest, TestLevelSetting) -{ +TEST(H264ProfileLevelIdTest, TestLevelSetting) { uint32_t profileLevelId = 0x420D0A; JsepVideoCodecDescription::SetSaneH264Level( JsepVideoCodecDescription::GetSaneH264Level(0x42100B), &profileLevelId); diff --git a/media/webrtc/signaling/gtest/sdp_unittests.cpp b/media/webrtc/signaling/gtest/sdp_unittests.cpp index e24472df04b2..7259402ee3d5 100644 --- a/media/webrtc/signaling/gtest/sdp_unittests.cpp +++ b/media/webrtc/signaling/gtest/sdp_unittests.cpp @@ -1580,7 +1580,7 @@ class NewSdpTest if (expectSuccess) { ASSERT_TRUE(!!mSdp) - << "Parse failed on first pass: " << GetParseErrors(); + << "Parse failed on first pass: " << GetParseErrors(); } if (mSdp) { @@ -1595,9 +1595,9 @@ class NewSdpTest // Whether we expected the parse to work or not, it should // succeed the second time if it succeeded the first. ASSERT_TRUE(!!mSdp) - << "Parse failed on second pass, SDP was: " << std::endl - << os.str() << std::endl - << "Errors were: " << GetParseErrors(); + << "Parse failed on second pass, SDP was: " << std::endl + << os.str() << std::endl + << "Errors were: " << GetParseErrors(); // Serialize again and compare std::stringstream os2; @@ -1607,8 +1607,7 @@ class NewSdpTest } if (expectSuccess) { - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(0U, mSdpErrorHolder->GetParseErrors().size()) << "Got unexpected parse errors/warnings: " << GetParseErrors(); } @@ -1934,8 +1933,7 @@ TEST_P(NewSdpTest, BasicAudioVideoSdpParse) { ParseSdp(kBasicAudioVideoOffer); } TEST_P(NewSdpTest, CheckRemoveFmtp) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -1970,8 +1968,7 @@ TEST_P(NewSdpTest, CheckRemoveFmtp) { TEST_P(NewSdpTest, CheckIceUfrag) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_TRUE( mSdp->GetAttributeList().HasAttribute(SdpAttribute::kIceUfragAttribute)); auto ice_ufrag = mSdp->GetAttributeList().GetIceUfrag(); @@ -1986,8 +1983,7 @@ TEST_P(NewSdpTest, CheckIceUfrag) { TEST_P(NewSdpTest, CheckIcePwd) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_TRUE( mSdp->GetAttributeList().HasAttribute(SdpAttribute::kIcePwdAttribute)); auto ice_pwd = mSdp->GetAttributeList().GetIcePwd(); @@ -2005,8 +2001,7 @@ TEST_P(NewSdpTest, CheckIcePwd) { TEST_P(NewSdpTest, CheckIceOptions) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_TRUE(mSdp->GetAttributeList().HasAttribute( SdpAttribute::kIceOptionsAttribute)); auto ice_options = mSdp->GetAttributeList().GetIceOptions(); @@ -2028,8 +2023,7 @@ TEST_P(NewSdpTest, CheckIceOptions) { TEST_P(NewSdpTest, CheckFingerprint) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_TRUE(mSdp->GetAttributeList().HasAttribute( SdpAttribute::kFingerprintAttribute)); auto fingerprints = mSdp->GetAttributeList().GetFingerprint(); @@ -2085,8 +2079,7 @@ TEST_P(NewSdpTest, CheckFingerprint) { TEST_P(NewSdpTest, CheckIdentity) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_TRUE( mSdp->GetAttributeList().HasAttribute(SdpAttribute::kIdentityAttribute)); auto identity = mSdp->GetAttributeList().GetIdentity(); @@ -2095,8 +2088,7 @@ TEST_P(NewSdpTest, CheckIdentity) { TEST_P(NewSdpTest, CheckDtlsMessage) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_TRUE(mSdp->GetAttributeList().HasAttribute( SdpAttribute::kDtlsMessageAttribute)); auto dtls_message = mSdp->GetAttributeList().GetDtlsMessage(); @@ -2108,16 +2100,14 @@ TEST_P(NewSdpTest, CheckDtlsMessage) { TEST_P(NewSdpTest, CheckNumberOfMediaSections) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; } TEST_P(NewSdpTest, CheckMlines) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; ASSERT_EQ(SdpMediaSection::kAudio, mSdp->GetMediaSection(0).GetMediaType()) @@ -2149,8 +2139,7 @@ TEST_P(NewSdpTest, CheckMlines) { TEST_P(NewSdpTest, CheckSetup) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2168,8 +2157,7 @@ TEST_P(NewSdpTest, CheckSetup) { TEST_P(NewSdpTest, CheckSsrc) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2197,8 +2185,7 @@ TEST_P(NewSdpTest, CheckSsrc) { TEST_P(NewSdpTest, CheckRtpmap) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2254,8 +2241,7 @@ static const std::string kAudioWithTelephoneEvent = TEST_P(NewSdpTest, CheckTelephoneEventNoFmtp) { ParseSdp(kAudioWithTelephoneEvent); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2273,8 +2259,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventNoFmtp) { TEST_P(NewSdpTest, CheckTelephoneEventWithDefaultEvents) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-15" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2283,8 +2268,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventWithDefaultEvents) { TEST_P(NewSdpTest, CheckTelephoneEventWithBadCharacter) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-5." CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2293,8 +2277,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventWithBadCharacter) { TEST_P(NewSdpTest, CheckTelephoneEventIncludingCommas) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-15,66,67" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2303,8 +2286,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventIncludingCommas) { TEST_P(NewSdpTest, CheckTelephoneEventComplexEvents) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0,1,2-4,5-15,66,67" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2313,8 +2295,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventComplexEvents) { TEST_P(NewSdpTest, CheckTelephoneEventNoHyphen) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 5,6,7" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2323,8 +2304,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventNoHyphen) { TEST_P(NewSdpTest, CheckTelephoneEventOnlyZero) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2333,8 +2313,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventOnlyZero) { TEST_P(NewSdpTest, CheckTelephoneEventOnlyOne) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2343,8 +2322,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventOnlyOne) { TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigit) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 123" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2354,8 +2332,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigit) { TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigitWithHyphen) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-123" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2365,8 +2342,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigitWithHyphen) { TEST_P(NewSdpTest, CheckTelephoneEventBadLeadingHyphen) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 -12" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2384,8 +2360,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadTrailingHyphenInMiddle) { TEST_P(NewSdpTest, CheckTelephoneEventBadLeadingComma) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 ,2,3" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2395,8 +2370,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadLeadingComma) { TEST_P(NewSdpTest, CheckTelephoneEventBadMultipleLeadingComma) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 ,,,2,3" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2406,8 +2380,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadMultipleLeadingComma) { TEST_P(NewSdpTest, CheckTelephoneEventBadConsecutiveCommas) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1,,,,,,,,3" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2417,8 +2390,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadConsecutiveCommas) { TEST_P(NewSdpTest, CheckTelephoneEventBadTrailingComma) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1,2,3," CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2428,8 +2400,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadTrailingComma) { TEST_P(NewSdpTest, CheckTelephoneEventBadTwoHyphens) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1-2-3" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2439,8 +2410,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadTwoHyphens) { TEST_P(NewSdpTest, CheckTelephoneEventBadSixDigit) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 112233" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2450,8 +2420,7 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadSixDigit) { TEST_P(NewSdpTest, CheckTelephoneEventBadRangeReversed) { ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 33-2" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2472,8 +2441,7 @@ static const std::string kVideoWithRedAndUlpfecSdp = TEST_P(NewSdpTest, CheckRedNoFmtp) { ParseSdp(kVideoWithRedAndUlpfecSdp); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2505,8 +2473,7 @@ TEST_P(NewSdpTest, CheckRedEmptyFmtp) { } } - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2524,8 +2491,7 @@ TEST_P(NewSdpTest, CheckRedEmptyFmtp) { TEST_P(NewSdpTest, CheckRedFmtpWith2Codecs) { ParseSdp(kVideoWithRedAndUlpfecSdp + "a=fmtp:122 120/121" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2549,8 +2515,7 @@ TEST_P(NewSdpTest, CheckRedFmtpWith2Codecs) { TEST_P(NewSdpTest, CheckRedFmtpWith3Codecs) { ParseSdp(kVideoWithRedAndUlpfecSdp + "a=fmtp:122 120/121/123" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2634,8 +2599,7 @@ const std::string kH264AudioVideoOffer = TEST_P(NewSdpTest, CheckFormatParameters) { ParseSdp(kH264AudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2748,8 +2712,7 @@ TEST_P(NewSdpTest, CheckFlags) { TEST_P(NewSdpTest, CheckConnectionLines) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2776,8 +2739,7 @@ TEST_P(NewSdpTest, CheckConnectionLines) { TEST_P(NewSdpTest, CheckDirections) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(SdpDirectionAttribute::kSendonly, mSdp->GetMediaSection(0).GetAttributeList().GetDirection()); ASSERT_EQ(SdpDirectionAttribute::kRecvonly, @@ -2788,8 +2750,7 @@ TEST_P(NewSdpTest, CheckDirections) { TEST_P(NewSdpTest, CheckCandidates) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2965,8 +2926,7 @@ TEST_P(NewSdpTest, CheckRid) { TEST_P(NewSdpTest, CheckMediaLevelIceUfrag) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -2986,8 +2946,7 @@ TEST_P(NewSdpTest, CheckMediaLevelIceUfrag) { TEST_P(NewSdpTest, CheckMediaLevelIcePwd) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -3300,8 +3259,7 @@ TEST_P(NewSdpTest, CheckSimulcast) { TEST_P(NewSdpTest, CheckSctpmap) { ParseSdp(kBasicAudioVideoDataOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -3322,8 +3280,7 @@ TEST_P(NewSdpTest, CheckSctpmap) { TEST_P(NewSdpTest, CheckMaxPtime) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -3792,8 +3749,7 @@ const std::string kMediaLevelDtlsMessage = TEST_P(NewSdpTest, CheckMediaLevelDtlsMessage) { ParseSdp(kMediaLevelDtlsMessage); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); // dtls-message is not defined for use at the media level; we don't // parse it @@ -3809,8 +3765,7 @@ TEST_P(NewSdpTest, CheckSetPort) { "a=sendonly" CRLF, false); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); constexpr unsigned int expectedParesPort = 56436; unsigned int currentPort = mSdp->GetMediaSection(0).GetPort(); @@ -3827,8 +3782,7 @@ TEST_P(NewSdpTest, CheckAddCodec) { "m=video 56436 RTP/SAVPF 120" CRLF "a=rtpmap:120 VP8/90000" CRLF "a=sendonly" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()); ASSERT_EQ(1U, mSdp->GetMediaSection(0).GetFormats().size()); @@ -3859,8 +3813,7 @@ TEST_P(NewSdpTest, CheckClearCodecs) { "m=video 56436 RTP/SAVPF 120 110" CRLF "a=rtpmap:120 VP8/90000" CRLF "a=sendonly" CRLF "a=rtpmap:110 opus/48000/2" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()); ASSERT_EQ(2U, mSdp->GetMediaSection(0).GetFormats().size()); @@ -3878,8 +3831,7 @@ TEST_P(NewSdpTest, CheckClearCodecs) { TEST_P(NewSdpTest, CheckAddMediaSection) { ParseSdp(kBasicAudioVideoOffer); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections"; @@ -3954,8 +3906,7 @@ TEST_P(NewSdpTest, CheckAddDataChannel_Draft05) { "c=IN IP4 198.51.100.7" CRLF "b=CT:5000" CRLF "t=0 0" CRLF "m=application 56436 DTLS/SCTP 5000" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()); auto& mediaSection = mSdp->GetMediaSection(0); @@ -3989,8 +3940,7 @@ TEST_P(NewSdpTest, CheckAddDataChannel) { "c=IN IP4 198.51.100.7" CRLF "b=CT:5000" CRLF "t=0 0" CRLF "m=application 56436 UDP/DTLS/SCTP webrtc-datachannel" CRLF); - ASSERT_TRUE(!!mSdp) - << "Parse failed: " << GetParseErrors(); + ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors(); ASSERT_EQ(1U, mSdp->GetMediaSectionCount()); auto& mediaSection = mSdp->GetMediaSection(0); @@ -4012,8 +3962,7 @@ TEST_P(NewSdpTest, CheckAddDataChannel) { ASSERT_EQ(15000U, mediaSection.GetAttributeList().GetSctpPort()); } -TEST(NewSdpTestNoFixture, CheckParsingResultComparer) -{ +TEST(NewSdpTestNoFixture, CheckParsingResultComparer) { auto check_comparison = [](const std::string sdp_string) { SipccSdpParser sipccParser; RsdparsaSdpParser rustParser; @@ -4073,8 +4022,7 @@ TEST(NewSdpTestNoFixture, CheckParsingResultComparer) ASSERT_TRUE(check_comparison(kBasicH264Fmtp2)); } -TEST(NewSdpTestNoFixture, CheckAttributeTypeSerialize) -{ +TEST(NewSdpTestNoFixture, CheckAttributeTypeSerialize) { for (auto a = static_cast(SdpAttribute::kFirstAttribute); a <= static_cast(SdpAttribute::kLastAttribute); ++a) { SdpAttribute::AttributeType type = @@ -4100,8 +4048,7 @@ static SdpImageattrAttributeList::XYRange ParseXYRange( return range; } -TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseValid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseValid) { { SdpImageattrAttributeList::XYRange range(ParseXYRange("640")); ASSERT_EQ(1U, range.discreteValues.size()); @@ -4156,8 +4103,7 @@ void ParseInvalid(const std::string& input, size_t last) { std::cout << "\"" << input << "\" - " << error << std::endl; } -TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseInvalid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseInvalid) { ParseInvalid("[-1", 1); ParseInvalid("[-", 1); ParseInvalid("[-v", 1); @@ -4206,8 +4152,7 @@ static SdpImageattrAttributeList::SRange ParseSRange(const std::string& input) { return range; } -TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseValid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseValid) { { SdpImageattrAttributeList::SRange range(ParseSRange("0.1")); ASSERT_EQ(1U, range.discreteValues.size()); @@ -4237,8 +4182,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseValid) } } -TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseInvalid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseInvalid) { ParseInvalid("", 0); ParseInvalid("[", 1); ParseInvalid("[v", 1); @@ -4279,15 +4223,13 @@ static SdpImageattrAttributeList::PRange ParsePRange(const std::string& input) { return range; } -TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseValid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseValid) { SdpImageattrAttributeList::PRange range(ParsePRange("[0.1000-9.9999]")); ASSERT_FLOAT_EQ(0.1f, range.min); ASSERT_FLOAT_EQ(9.9999f, range.max); } -TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseInvalid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseInvalid) { ParseInvalid("", 0); ParseInvalid("[", 1); ParseInvalid("[v", 1); @@ -4325,8 +4267,7 @@ static SdpImageattrAttributeList::Set ParseSet(const std::string& input) { return set; } -TEST(NewSdpTestNoFixture, CheckImageattrSetParseValid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrSetParseValid) { { SdpImageattrAttributeList::Set set(ParseSet("[x=320,y=240]")); ASSERT_EQ(1U, set.xRange.discreteValues.size()); @@ -4450,8 +4391,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrSetParseValid) } } -TEST(NewSdpTestNoFixture, CheckImageattrSetParseInvalid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrSetParseInvalid) { ParseInvalid("", 0); ParseInvalid("x", 0); ParseInvalid("[", 1); @@ -4499,8 +4439,7 @@ static SdpImageattrAttributeList::Imageattr ParseImageattr( return imageattr; } -TEST(NewSdpTestNoFixture, CheckImageattrParseValid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrParseValid) { { SdpImageattrAttributeList::Imageattr imageattr(ParseImageattr("* send *")); ASSERT_FALSE(imageattr.pt.isSome()); @@ -4632,8 +4571,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrParseValid) } } -TEST(NewSdpTestNoFixture, CheckImageattrParseInvalid) -{ +TEST(NewSdpTestNoFixture, CheckImageattrParseInvalid) { ParseInvalid("", 0); ParseInvalid(" ", 0); ParseInvalid("-1", 0); @@ -4657,8 +4595,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrParseInvalid) "* send * recv [x=640,y=480] foobajooba", 28); } -TEST(NewSdpTestNoFixture, CheckImageattrXYRangeSerialization) -{ +TEST(NewSdpTestNoFixture, CheckImageattrXYRangeSerialization) { SdpImageattrAttributeList::XYRange range; std::stringstream os; @@ -4685,8 +4622,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrXYRangeSerialization) ASSERT_EQ("[320,640]", os.str()); } -TEST(NewSdpTestNoFixture, CheckImageattrSRangeSerialization) -{ +TEST(NewSdpTestNoFixture, CheckImageattrSRangeSerialization) { SdpImageattrAttributeList::SRange range; std::ostringstream os; @@ -4708,8 +4644,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrSRangeSerialization) ASSERT_EQ("[0.1000,0.5000]", os.str()); } -TEST(NewSdpTestNoFixture, CheckImageattrPRangeSerialization) -{ +TEST(NewSdpTestNoFixture, CheckImageattrPRangeSerialization) { SdpImageattrAttributeList::PRange range; std::ostringstream os; @@ -4719,8 +4654,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrPRangeSerialization) ASSERT_EQ("[0.1000-0.9999]", os.str()); } -TEST(NewSdpTestNoFixture, CheckImageattrSetSerialization) -{ +TEST(NewSdpTestNoFixture, CheckImageattrSetSerialization) { SdpImageattrAttributeList::Set set; std::ostringstream os; @@ -4757,8 +4691,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrSetSerialization) os.str(""); } -TEST(NewSdpTestNoFixture, CheckImageattrSerialization) -{ +TEST(NewSdpTestNoFixture, CheckImageattrSerialization) { SdpImageattrAttributeList::Imageattr imageattr; std::ostringstream os; @@ -4818,8 +4751,7 @@ TEST(NewSdpTestNoFixture, CheckImageattrSerialization) os.str(""); } -TEST(NewSdpTestNoFixture, CheckSimulcastVersionSerialize) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastVersionSerialize) { std::ostringstream os; SdpSimulcastAttribute::Version version; @@ -4850,8 +4782,7 @@ static SdpSimulcastAttribute::Version ParseSimulcastVersion( return version; } -TEST(NewSdpTestNoFixture, CheckSimulcastVersionValidParse) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastVersionValidParse) { { SdpSimulcastAttribute::Version version(ParseSimulcastVersion("1")); ASSERT_EQ(1U, version.choices.size()); @@ -4866,8 +4797,7 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionValidParse) } } -TEST(NewSdpTestNoFixture, CheckSimulcastVersionInvalidParse) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastVersionInvalidParse) { ParseInvalid("", 0); ParseInvalid(",", 0); ParseInvalid(";", 0); @@ -4878,8 +4808,7 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionInvalidParse) ParseInvalid("8,;", 2); } -TEST(NewSdpTestNoFixture, CheckSimulcastVersionsSerialize) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastVersionsSerialize) { std::ostringstream os; SdpSimulcastAttribute::Versions versions; @@ -4923,8 +4852,7 @@ static SdpSimulcastAttribute::Versions ParseSimulcastVersions( return list; } -TEST(NewSdpTestNoFixture, CheckSimulcastVersionsValidParse) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastVersionsValidParse) { { SdpSimulcastAttribute::Versions versions(ParseSimulcastVersions("pt=8")); ASSERT_EQ(1U, versions.size()); @@ -4961,8 +4889,7 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionsValidParse) } } -TEST(NewSdpTestNoFixture, CheckSimulcastVersionsInvalidParse) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastVersionsInvalidParse) { ParseInvalid("", 0); ParseInvalid("x", 1); ParseInvalid(";", 1); @@ -4977,8 +4904,7 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionsInvalidParse) ParseInvalid("pt=8;;", 5); } -TEST(NewSdpTestNoFixture, CheckSimulcastSerialize) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastSerialize) { std::ostringstream os; SdpSimulcastAttribute simulcast; @@ -5005,8 +4931,7 @@ static SdpSimulcastAttribute ParseSimulcast(const std::string& input) { return simulcast; } -TEST(NewSdpTestNoFixture, CheckSimulcastValidParse) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastValidParse) { { SdpSimulcastAttribute simulcast(ParseSimulcast(" send pt=8")); ASSERT_EQ(1U, simulcast.sendVersions.size()); @@ -5063,8 +4988,7 @@ TEST(NewSdpTestNoFixture, CheckSimulcastValidParse) } } -TEST(NewSdpTestNoFixture, CheckSimulcastInvalidParse) -{ +TEST(NewSdpTestNoFixture, CheckSimulcastInvalidParse) { ParseInvalid("", 0); ParseInvalid(" ", 1); ParseInvalid("vcer ", 4); @@ -5083,8 +5007,7 @@ static SdpRidAttributeList::Rid ParseRid(const std::string& input) { return rid; } -TEST(NewSdpTestNoFixture, CheckRidValidParse) -{ +TEST(NewSdpTestNoFixture, CheckRidValidParse) { { SdpRidAttributeList::Rid rid(ParseRid("1 send")); ASSERT_EQ("1", rid.id); @@ -5369,8 +5292,7 @@ TEST(NewSdpTestNoFixture, CheckRidValidParse) } } -TEST(NewSdpTestNoFixture, CheckRidInvalidParse) -{ +TEST(NewSdpTestNoFixture, CheckRidInvalidParse) { ParseInvalid("", 0); ParseInvalid(" ", 0); ParseInvalid("foo", 3); @@ -5397,8 +5319,7 @@ TEST(NewSdpTestNoFixture, CheckRidInvalidParse) ParseInvalid("foo send depend=1,", 18); } -TEST(NewSdpTestNoFixture, CheckRidSerialize) -{ +TEST(NewSdpTestNoFixture, CheckRidSerialize) { { SdpRidAttributeList::Rid rid; rid.id = "foo"; diff --git a/media/webrtc/signaling/src/media-conduit/RtpSourceObserver.cpp b/media/webrtc/signaling/src/media-conduit/RtpSourceObserver.cpp index c28b43a37446..840b0e0bd968 100644 --- a/media/webrtc/signaling/src/media-conduit/RtpSourceObserver.cpp +++ b/media/webrtc/signaling/src/media-conduit/RtpSourceObserver.cpp @@ -19,6 +19,7 @@ double RtpSourceObserver::RtpSourceEntry::ToLinearAudioLevel() const { RtpSourceObserver::RtpSourceObserver() : mMaxJitterWindow(0), mLevelGuard("RtpSourceObserver::mLevelGuard") {} + void RtpSourceObserver::OnRtpPacket(const webrtc::RTPHeader& aHeader, const int64_t aTimestamp, const uint32_t aJitter) { diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcMediaDataDecoderCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcMediaDataDecoderCodec.cpp index d6dd394b1155..aa157f8695c8 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcMediaDataDecoderCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaDataDecoderCodec.cpp @@ -64,10 +64,9 @@ int32_t WebrtcMediaDataDecoder::InitDecode( return WEBRTC_VIDEO_CODEC_ERROR; } - media::Await( - do_AddRef(mThreadPool), mDecoder->Init(), - [&](TrackInfo::TrackType) { mError = NS_OK; }, - [&](const MediaResult& aError) { mError = aError; }); + media::Await(do_AddRef(mThreadPool), mDecoder->Init(), + [&](TrackInfo::TrackType) { mError = NS_OK; }, + [&](const MediaResult& aError) { mError = aError; }); return NS_SUCCEEDED(mError) ? WEBRTC_VIDEO_CODEC_OK : WEBRTC_VIDEO_CODEC_ERROR; @@ -111,13 +110,12 @@ int32_t WebrtcMediaDataDecoder::Decode( compressedFrame->mKeyframe = aInputImage._frameType == webrtc::FrameType::kVideoFrameKey; { - media::Await( - do_AddRef(mThreadPool), mDecoder->Decode(compressedFrame), - [&](const MediaDataDecoder::DecodedData& aResults) { - mResults = aResults; - mError = NS_OK; - }, - [&](const MediaResult& aError) { mError = aError; }); + media::Await(do_AddRef(mThreadPool), mDecoder->Decode(compressedFrame), + [&](const MediaDataDecoder::DecodedData& aResults) { + mResults = aResults; + mError = NS_OK; + }, + [&](const MediaResult& aError) { mError = aError; }); for (auto& frame : mResults) { MOZ_ASSERT(frame->mType == MediaData::Type::VIDEO_DATA); diff --git a/media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.cpp b/media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.cpp index ae1ecd64e560..ab49a1f61c18 100644 --- a/media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.cpp +++ b/media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.cpp @@ -291,18 +291,17 @@ MediaTransportHandlerIPC::GetIceStats( } RefPtr promise = mChild->SendGetIceStats(aTransportId, aNow, *aReport) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [](const dom::MovableRTCStatsReportInternal& aReport) { - std::unique_ptr report( - new dom::RTCStatsReportInternal(aReport)); - return StatsPromise::CreateAndResolve(std::move(report), - __func__); - }, - [](ipc::ResponseRejectReason aReason) { - return StatsPromise::CreateAndReject(NS_ERROR_FAILURE, - __func__); - }); + ->Then(GetMainThreadSerialEventTarget(), __func__, + [](const dom::MovableRTCStatsReportInternal& aReport) { + std::unique_ptr report( + new dom::RTCStatsReportInternal(aReport)); + return StatsPromise::CreateAndResolve( + std::move(report), __func__); + }, + [](ipc::ResponseRejectReason aReason) { + return StatsPromise::CreateAndReject(NS_ERROR_FAILURE, + __func__); + }); return promise; }, [](const nsCString& aError) { diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp index c25ce2c00fdc..82ce828925e5 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp @@ -280,14 +280,13 @@ void PeerConnectionCtx::EverySecondTelemetryCallback_m(nsITimer* timer, for (auto& idAndPc : GetInstance()->mPeerConnections) { if (idAndPc.second->HasMedia()) { idAndPc.second->GetStats(nullptr, true) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [=](UniquePtr&& aQuery) { - if (PeerConnectionCtx::isActive()) { - PeerConnectionCtx::GetInstance()->DeliverStats(*aQuery); - } - }, - [=](nsresult aError) {}); + ->Then(GetMainThreadSerialEventTarget(), __func__, + [=](UniquePtr&& aQuery) { + if (PeerConnectionCtx::isActive()) { + PeerConnectionCtx::GetInstance()->DeliverStats(*aQuery); + } + }, + [=](nsresult aError) {}); } } } diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index a1cac6149860..956e385b9222 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -1553,16 +1553,15 @@ PeerConnectionImpl::GetStats(MediaStreamTrack* aSelector) { PC_AUTO_ENTER_API_CALL(true); GetStats(aSelector, false) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [handle = mHandle](UniquePtr&& aQuery) { - DeliverStatsReportToPCObserver_m( - handle, NS_OK, nsAutoPtr(aQuery.release())); - }, - [handle = mHandle](nsresult aError) { - DeliverStatsReportToPCObserver_m(handle, aError, - nsAutoPtr()); - }); + ->Then(GetMainThreadSerialEventTarget(), __func__, + [handle = mHandle](UniquePtr&& aQuery) { + DeliverStatsReportToPCObserver_m( + handle, NS_OK, nsAutoPtr(aQuery.release())); + }, + [handle = mHandle](nsresult aError) { + DeliverStatsReportToPCObserver_m(handle, aError, + nsAutoPtr()); + }); return NS_OK; } diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp index 71c8e634c011..d10e6eacf7fe 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp @@ -319,32 +319,30 @@ static void RunStatsQuery( if (pc.HasMedia()) { promises.AppendElement( pc.GetStats(nullptr, true) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [=](UniquePtr&& aQuery) { - return RTCStatsQueryPromise::CreateAndResolve( - std::move(aQuery), __func__); - }, - [=](nsresult aError) { - // Ignore errors! Just resolve with a nullptr. - return RTCStatsQueryPromise::CreateAndResolve( - UniquePtr(), __func__); - })); + ->Then(GetMainThreadSerialEventTarget(), __func__, + [=](UniquePtr&& aQuery) { + return RTCStatsQueryPromise::CreateAndResolve( + std::move(aQuery), __func__); + }, + [=](nsresult aError) { + // Ignore errors! Just resolve with a nullptr. + return RTCStatsQueryPromise::CreateAndResolve( + UniquePtr(), __func__); + })); } } } RTCStatsQueryPromise::All(GetMainThreadSerialEventTarget(), promises) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - // MOZ_CAN_RUN_SCRIPT_BOUNDARY because we're going to run that - // function async anyway. - [aThisChild, - aRequestId](nsTArray>&& aQueries) - MOZ_CAN_RUN_SCRIPT_BOUNDARY { - OnStatsReport_m(aThisChild, aRequestId, std::move(aQueries)); - }, - [=](nsresult) { MOZ_CRASH(); }); + ->Then(GetMainThreadSerialEventTarget(), __func__, + // MOZ_CAN_RUN_SCRIPT_BOUNDARY because we're going to run that + // function async anyway. + [aThisChild, + aRequestId](nsTArray>&& aQueries) + MOZ_CAN_RUN_SCRIPT_BOUNDARY { + OnStatsReport_m(aThisChild, aRequestId, std::move(aQueries)); + }, + [=](nsresult) { MOZ_CRASH(); }); } void ClearClosedStats() { @@ -460,20 +458,19 @@ static nsresult RunLogQuery(const nsCString& aPattern, [transportHandler, aPattern]() { return transportHandler->GetIceLog(aPattern); }) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - // MOZ_CAN_RUN_SCRIPT_BOUNDARY because we're going to run that - // function async anyway. - [aRequestId, aThisChild](Sequence&& aLogLines) - MOZ_CAN_RUN_SCRIPT_BOUNDARY { - OnGetLogging_m(aThisChild, aRequestId, std::move(aLogLines)); - }, - // MOZ_CAN_RUN_SCRIPT_BOUNDARY because we're going to run that - // function async anyway. - [aRequestId, aThisChild](nsresult aError) - MOZ_CAN_RUN_SCRIPT_BOUNDARY { - OnGetLogging_m(aThisChild, aRequestId, Sequence()); - }); + ->Then(GetMainThreadSerialEventTarget(), __func__, + // MOZ_CAN_RUN_SCRIPT_BOUNDARY because we're going to run that + // function async anyway. + [aRequestId, aThisChild](Sequence&& aLogLines) + MOZ_CAN_RUN_SCRIPT_BOUNDARY { + OnGetLogging_m(aThisChild, aRequestId, std::move(aLogLines)); + }, + // MOZ_CAN_RUN_SCRIPT_BOUNDARY because we're going to run that + // function async anyway. + [aRequestId, aThisChild](nsresult aError) + MOZ_CAN_RUN_SCRIPT_BOUNDARY { + OnGetLogging_m(aThisChild, aRequestId, Sequence()); + }); return NS_OK; } @@ -1051,14 +1048,13 @@ void WebrtcGlobalInformation::StoreLongTermICEStatistics( } aPc.GetStats(nullptr, true) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [=](UniquePtr&& aQuery) { - StoreLongTermICEStatisticsImpl_m(NS_OK, aQuery.get()); - }, - [=](nsresult aError) { - StoreLongTermICEStatisticsImpl_m(aError, nullptr); - }); + ->Then(GetMainThreadSerialEventTarget(), __func__, + [=](UniquePtr&& aQuery) { + StoreLongTermICEStatisticsImpl_m(NS_OK, aQuery.get()); + }, + [=](nsresult aError) { + StoreLongTermICEStatisticsImpl_m(aError, nullptr); + }); } } // namespace dom diff --git a/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp b/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp index 3f88f675d579..cdaedc479838 100644 --- a/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp +++ b/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp @@ -715,8 +715,7 @@ void SipccSdpAttributeList::LoadFmtp(sdp_t* sdp, uint16_t level) { } parameters.reset(teParameters); } break; - default: { - } + default: {} } fmtps->PushEntry(osPayloadType.str(), std::move(parameters)); diff --git a/memory/gtest/TestJemalloc.cpp b/memory/gtest/TestJemalloc.cpp index 7a6645bef9d1..1c11ff888557 100644 --- a/memory/gtest/TestJemalloc.cpp +++ b/memory/gtest/TestJemalloc.cpp @@ -66,8 +66,7 @@ static inline void TestThree(size_t size) { ASSERT_NO_FATAL_FAILURE(TestOne(size + 1)); } -TEST(Jemalloc, UsableSizeInAdvance) -{ +TEST(Jemalloc, UsableSizeInAdvance) { /* * Test every size up to a certain point, then (N-1, N, N+1) triplets for a * various sizes beyond that. @@ -98,8 +97,7 @@ bool InfoEqFreedPage(jemalloc_ptr_info_t& aInfo, void* aAddr, aInfo.size == aPageSize; } -TEST(Jemalloc, PtrInfo) -{ +TEST(Jemalloc, PtrInfo) { // Some things might be running in other threads, so ensure our assumptions // (e.g. about isFreedSmall and isFreedPage ratios below) are not altered by // other threads. @@ -255,8 +253,7 @@ TEST(Jemalloc, PtrInfo) size_t sSizes[] = {1, 42, 79, 918, 1.5_KiB, 73_KiB, 129_KiB, 1.1_MiB, 2.6_MiB, 5.1_MiB}; -TEST(Jemalloc, Arenas) -{ +TEST(Jemalloc, Arenas) { arena_id_t arena = moz_create_arena(); ASSERT_TRUE(arena != 0); void* ptr = moz_arena_malloc(arena, 42); @@ -388,8 +385,7 @@ static bool CanReallocInPlace(size_t aFromSize, size_t aToSize, return false; } -TEST(Jemalloc, InPlace) -{ +TEST(Jemalloc, InPlace) { jemalloc_stats_t stats; jemalloc_stats(&stats); @@ -421,8 +417,7 @@ TEST(Jemalloc, InPlace) // Bug 1474254: disable this test for windows ccov builds because it leads to // timeout. #if !defined(XP_WIN) || !defined(MOZ_CODE_COVERAGE) -TEST(Jemalloc, JunkPoison) -{ +TEST(Jemalloc, JunkPoison) { jemalloc_stats_t stats; jemalloc_stats(&stats); diff --git a/memory/volatile/tests/TestVolatileBuffer.cpp b/memory/volatile/tests/TestVolatileBuffer.cpp index e9e9699ec6a4..78296c467cc8 100644 --- a/memory/volatile/tests/TestVolatileBuffer.cpp +++ b/memory/volatile/tests/TestVolatileBuffer.cpp @@ -18,14 +18,11 @@ using namespace mozilla; -TEST(VolatileBufferTest, HeapVolatileBuffersWork) -{ +TEST(VolatileBufferTest, HeapVolatileBuffersWork) { RefPtr heapbuf = new VolatileBuffer(); - ASSERT_TRUE(heapbuf) - << "Failed to create VolatileBuffer"; - ASSERT_TRUE(heapbuf->Init(512)) - << "Failed to initialize VolatileBuffer"; + ASSERT_TRUE(heapbuf) << "Failed to create VolatileBuffer"; + ASSERT_TRUE(heapbuf->Init(512)) << "Failed to initialize VolatileBuffer"; VolatileBufferPtr ptr(heapbuf); @@ -34,14 +31,11 @@ TEST(VolatileBufferTest, HeapVolatileBuffersWork) EXPECT_TRUE(ptr) << "Couldn't get pointer from VolatileBufferPtr"; } -TEST(VolatileBufferTest, RealVolatileBuffersWork) -{ +TEST(VolatileBufferTest, RealVolatileBuffersWork) { RefPtr buf = new VolatileBuffer(); - ASSERT_TRUE(buf) - << "Failed to create VolatileBuffer"; - ASSERT_TRUE(buf->Init(16384)) - << "Failed to initialize VolatileBuffer"; + ASSERT_TRUE(buf) << "Failed to create VolatileBuffer"; + ASSERT_TRUE(buf->Init(16384)) << "Failed to initialize VolatileBuffer"; const char teststr[] = "foobar"; @@ -57,8 +51,7 @@ TEST(VolatileBufferTest, RealVolatileBuffersWork) EXPECT_FALSE(ptr.WasBufferPurged()) << "Failed to lock buffer again while currently locked"; - ASSERT_TRUE(ptr2) - << "Didn't get a pointer on the second lock"; + ASSERT_TRUE(ptr2) << "Didn't get a pointer on the second lock"; strcpy(ptr2, teststr); } diff --git a/mfbt/Variant.h b/mfbt/Variant.h index ee40f64c64a3..83609dca2063 100644 --- a/mfbt/Variant.h +++ b/mfbt/Variant.h @@ -730,8 +730,7 @@ class MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS MOZ_NON_PARAM Variant { tl::And::ReturnType, typename FunctionTypeTraits::ReturnType>::value, IsSame::ReturnType, - typename FunctionTypeTraits::ReturnType>::value...>:: - value, + typename FunctionTypeTraits::ReturnType>::value...>::value, "all matchers must have the same return type"); return Impl::matchN(*this, std::forward(aM0), std::forward(aM1), std::forward(aMs)...); @@ -753,8 +752,7 @@ class MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS MOZ_NON_PARAM Variant { tl::And::ReturnType, typename FunctionTypeTraits::ReturnType>::value, IsSame::ReturnType, - typename FunctionTypeTraits::ReturnType>::value...>:: - value, + typename FunctionTypeTraits::ReturnType>::value...>::value, "all matchers must have the same return type"); return Impl::matchN(*this, std::forward(aM0), std::forward(aM1), std::forward(aMs)...); diff --git a/mfbt/tests/gtest/TestBuffer.cpp b/mfbt/tests/gtest/TestBuffer.cpp index df36282be1f5..6dfe5cf8477d 100644 --- a/mfbt/tests/gtest/TestBuffer.cpp +++ b/mfbt/tests/gtest/TestBuffer.cpp @@ -9,8 +9,7 @@ using namespace mozilla; -TEST(Buffer, TestBufferInfallible) -{ +TEST(Buffer, TestBufferInfallible) { const size_t LEN = 8; Array arr = {1, 2, 3, 4, 5, 6, 7, 8}; Buffer buf(arr); @@ -48,8 +47,7 @@ TEST(Buffer, TestBufferInfallible) ASSERT_EQ(buf.Length(), 0U); } -TEST(Buffer, TestBufferFallible) -{ +TEST(Buffer, TestBufferFallible) { const size_t LEN = 8; Array arr = {1, 2, 3, 4, 5, 6, 7, 8}; auto maybe = Buffer::CopyFrom(arr); @@ -89,8 +87,7 @@ TEST(Buffer, TestBufferFallible) ASSERT_EQ(buf.Length(), 0U); } -TEST(Buffer, TestBufferElements) -{ +TEST(Buffer, TestBufferElements) { ASSERT_EQ(Buffer().Elements(), reinterpret_cast(alignof(int32_t))); } diff --git a/mfbt/tests/gtest/TestLinkedList.cpp b/mfbt/tests/gtest/TestLinkedList.cpp index d53cba592009..bd8465dba5e2 100644 --- a/mfbt/tests/gtest/TestLinkedList.cpp +++ b/mfbt/tests/gtest/TestLinkedList.cpp @@ -34,8 +34,7 @@ class InheritedPtrClass : public PtrClass { virtual ~InheritedPtrClass() { *mInheritedResult = true; } }; -TEST(LinkedList, AutoCleanLinkedList) -{ +TEST(LinkedList, AutoCleanLinkedList) { bool rv1 = false; bool rv2 = false; bool rv3 = false; @@ -60,8 +59,7 @@ class CountedClass final : public LinkedListElement> { ~CountedClass() { EXPECT_TRUE(mCount == 0); } }; -TEST(LinkedList, AutoCleanLinkedListRefPtr) -{ +TEST(LinkedList, AutoCleanLinkedListRefPtr) { RefPtr elt1 = new CountedClass; CountedClass* elt2 = new CountedClass; { diff --git a/mfbt/tests/gtest/TestMozDbg.cpp b/mfbt/tests/gtest/TestMozDbg.cpp index 0eb0571c99fb..ddfcbbf74f86 100644 --- a/mfbt/tests/gtest/TestMozDbg.cpp +++ b/mfbt/tests/gtest/TestMozDbg.cpp @@ -102,8 +102,7 @@ void StaticAssertions() { Unused << z; } -TEST(MozDbg, ObjectValues) -{ +TEST(MozDbg, ObjectValues) { // Test that moves and assignments all operate correctly with MOZ_DBG wrapped // around various parts of the expression. diff --git a/modules/libpref/SharedPrefMap.cpp b/modules/libpref/SharedPrefMap.cpp index 25c68071641d..11c771f52ece 100644 --- a/modules/libpref/SharedPrefMap.cpp +++ b/modules/libpref/SharedPrefMap.cpp @@ -62,12 +62,11 @@ Maybe SharedPrefMap::Get(const char* aKey) const { bool SharedPrefMap::Find(const char* aKey, size_t* aIndex) const { const auto& keys = KeyTable(); - return BinarySearchIf( - Entries(), 0, EntryCount(), - [&](const Entry& aEntry) { - return strcmp(aKey, keys.GetBare(aEntry.mKey)); - }, - aIndex); + return BinarySearchIf(Entries(), 0, EntryCount(), + [&](const Entry& aEntry) { + return strcmp(aKey, keys.GetBare(aEntry.mKey)); + }, + aIndex); } void SharedPrefMapBuilder::Add(const char* aKey, const Flags& aFlags, diff --git a/modules/libpref/test/gtest/Basics.cpp b/modules/libpref/test/gtest/Basics.cpp index e3e05c6015b0..e581d58fa193 100644 --- a/modules/libpref/test/gtest/Basics.cpp +++ b/modules/libpref/test/gtest/Basics.cpp @@ -9,8 +9,7 @@ using namespace mozilla; -TEST(PrefsBasics, Errors) -{ +TEST(PrefsBasics, Errors) { Preferences::SetBool("foo.bool", true, PrefValueKind::Default); Preferences::SetBool("foo.bool", false, PrefValueKind::User); ASSERT_EQ(Preferences::GetBool("foo.bool", false, PrefValueKind::Default), diff --git a/modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp b/modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp index 2168136fac23..39afc8bbea22 100644 --- a/modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp +++ b/modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp @@ -137,61 +137,52 @@ void RunTest(const nsCString& aPrefName1, const nsCString& aPrefName2, ASSERT_TRUE(closure2.mCalled); } -TEST(CallbackAndVarCacheOrder, Bool) -{ +TEST(CallbackAndVarCacheOrder, Bool) { RunTest(NS_LITERAL_CSTRING("test_pref.bool.1"), NS_LITERAL_CSTRING("test_pref.bool.2"), false, true); } -TEST(CallbackAndVarCacheOrder, AtomicBoolRelaxed) -{ +TEST(CallbackAndVarCacheOrder, AtomicBoolRelaxed) { RunTest>( NS_LITERAL_CSTRING("test_pref.atomic_bool.1"), NS_LITERAL_CSTRING("test_pref.atomic_bool.2"), false, true); } -TEST(CallbackAndVarCacheOrder, AtomicBoolReleaseAcquire) -{ +TEST(CallbackAndVarCacheOrder, AtomicBoolReleaseAcquire) { RunTest>( NS_LITERAL_CSTRING("test_pref.atomic_bool.3"), NS_LITERAL_CSTRING("test_pref.atomic_bool.4"), false, true); } -TEST(CallbackAndVarCacheOrder, Int) -{ +TEST(CallbackAndVarCacheOrder, Int) { RunTest(NS_LITERAL_CSTRING("test_pref.int.1"), NS_LITERAL_CSTRING("test_pref.int.2"), -2, 3); } -TEST(CallbackAndVarCacheOrder, AtomicInt) -{ +TEST(CallbackAndVarCacheOrder, AtomicInt) { RunTest>( NS_LITERAL_CSTRING("test_pref.atomic_int.1"), NS_LITERAL_CSTRING("test_pref.atomic_int.2"), -3, 4); } -TEST(CallbackAndVarCacheOrder, Uint) -{ +TEST(CallbackAndVarCacheOrder, Uint) { RunTest(NS_LITERAL_CSTRING("test_pref.uint.1"), NS_LITERAL_CSTRING("test_pref.uint.2"), 4u, 5u); } -TEST(CallbackAndVarCacheOrder, AtomicUintRelaxed) -{ +TEST(CallbackAndVarCacheOrder, AtomicUintRelaxed) { RunTest>( NS_LITERAL_CSTRING("test_pref.atomic_uint.1"), NS_LITERAL_CSTRING("test_pref.atomic_uint.2"), 6u, 7u); } -TEST(CallbackAndVarCacheOrder, AtomicUintReleaseAcquire) -{ +TEST(CallbackAndVarCacheOrder, AtomicUintReleaseAcquire) { RunTest>( NS_LITERAL_CSTRING("test_pref.atomic_uint.3"), NS_LITERAL_CSTRING("test_pref.atomic_uint.4"), 8u, 9u); } -TEST(CallbackAndVarCacheOrder, Float) -{ +TEST(CallbackAndVarCacheOrder, Float) { RunTest(NS_LITERAL_CSTRING("test_pref.float.1"), NS_LITERAL_CSTRING("test_pref.float.2"), -10.0f, 11.0f); } diff --git a/modules/libpref/test/gtest/Parser.cpp b/modules/libpref/test/gtest/Parser.cpp index 1738c2b3ae8c..0964ddfe9022 100644 --- a/modules/libpref/test/gtest/Parser.cpp +++ b/modules/libpref/test/gtest/Parser.cpp @@ -16,8 +16,7 @@ using namespace mozilla; void TestParseError(PrefValueKind aKind, const char* aText, nsCString& aErrorMsg); -TEST(PrefsParser, Errors) -{ +TEST(PrefsParser, Errors) { nsAutoCStringN<128> actualErrorMsg; // Use a macro rather than a function so that the line number reported by diff --git a/mozglue/tests/gtest/TestDLLBlocklist.cpp b/mozglue/tests/gtest/TestDLLBlocklist.cpp index 3cd09f137b8d..e10d1adbdb20 100644 --- a/mozglue/tests/gtest/TestDLLBlocklist.cpp +++ b/mozglue/tests/gtest/TestDLLBlocklist.cpp @@ -53,8 +53,7 @@ static nsString GetFullPath(const char16_t* leaf) { return ret; } -TEST(TestDllBlocklist, BlockDllByName) -{ +TEST(TestDllBlocklist, BlockDllByName) { sDllWasBlocked = false; sDllWasLoaded = false; DllBlocklist_SetDllLoadHook(DllLoadHook); @@ -79,8 +78,7 @@ TEST(TestDllBlocklist, BlockDllByName) } } -TEST(TestDllBlocklist, BlockDllByVersion) -{ +TEST(TestDllBlocklist, BlockDllByVersion) { sDllWasBlocked = false; sDllWasLoaded = false; DllBlocklist_SetDllLoadHook(DllLoadHook); @@ -103,8 +101,7 @@ TEST(TestDllBlocklist, BlockDllByVersion) } } -TEST(TestDllBlocklist, AllowDllByVersion) -{ +TEST(TestDllBlocklist, AllowDllByVersion) { sDllWasBlocked = false; sDllWasLoaded = false; DllBlocklist_SetDllLoadHook(DllLoadHook); @@ -127,8 +124,7 @@ TEST(TestDllBlocklist, AllowDllByVersion) } } -TEST(TestDllBlocklist, BlocklistIntegrity) -{ +TEST(TestDllBlocklist, BlocklistIntegrity) { auto msg = DllBlocklist_TestBlocklistIntegrity(); EXPECT_FALSE(msg) << msg; } diff --git a/mozglue/tests/gtest/TestDLLEject.cpp b/mozglue/tests/gtest/TestDLLEject.cpp index e7dccfd1d8a6..d94ba7a17482 100644 --- a/mozglue/tests/gtest/TestDLLEject.cpp +++ b/mozglue/tests/gtest/TestDLLEject.cpp @@ -215,8 +215,7 @@ static void DoTest_CreateRemoteThread_LoadLibrary(TgetArgsProc aGetArgsProc) { return; } -TEST(TestInjectEject, CreateRemoteThread_LoadLibraryA) -{ +TEST(TestInjectEject, CreateRemoteThread_LoadLibraryA) { DoTest_CreateRemoteThread_LoadLibrary( [](const nsString& dllPath, const nsCString& dllPathC, uintptr_t& aStartAddress, uintptr_t& aThreadParam) { @@ -226,8 +225,7 @@ TEST(TestInjectEject, CreateRemoteThread_LoadLibraryA) }); } -TEST(TestInjectEject, CreateRemoteThread_LoadLibraryW) -{ +TEST(TestInjectEject, CreateRemoteThread_LoadLibraryW) { DoTest_CreateRemoteThread_LoadLibrary( [](const nsString& dllPath, const nsCString& dllPathC, uintptr_t& aStartAddress, uintptr_t& aThreadParam) { @@ -237,8 +235,7 @@ TEST(TestInjectEject, CreateRemoteThread_LoadLibraryW) }); } -TEST(TestInjectEject, CreateRemoteThread_LoadLibraryExW) -{ +TEST(TestInjectEject, CreateRemoteThread_LoadLibraryExW) { DoTest_CreateRemoteThread_LoadLibrary( [](const nsString& dllPath, const nsCString& dllPathC, uintptr_t& aStartAddress, uintptr_t& aThreadParam) { @@ -251,8 +248,7 @@ TEST(TestInjectEject, CreateRemoteThread_LoadLibraryExW) }); } -TEST(TestInjectEject, CreateRemoteThread_LoadLibraryExA) -{ +TEST(TestInjectEject, CreateRemoteThread_LoadLibraryExA) { DoTest_CreateRemoteThread_LoadLibrary( [](const nsString& dllPath, const nsCString& dllPathC, uintptr_t& aStartAddress, uintptr_t& aThreadParam) { diff --git a/netwerk/base/ProxyAutoConfig.cpp b/netwerk/base/ProxyAutoConfig.cpp index e9badbf8613a..719497ecd0d2 100644 --- a/netwerk/base/ProxyAutoConfig.cpp +++ b/netwerk/base/ProxyAutoConfig.cpp @@ -636,9 +636,9 @@ class JSContextWrapper { } }; -const JSClass JSContextWrapper::sGlobalClass = {"PACResolutionThreadGlobal", - JSCLASS_GLOBAL_FLAGS, - &JS::DefaultGlobalClassOps}; +const JSClass JSContextWrapper::sGlobalClass = { + "PACResolutionThreadGlobal", JSCLASS_GLOBAL_FLAGS, + &JS::DefaultGlobalClassOps}; void ProxyAutoConfig::SetThreadLocalIndex(uint32_t index) { sRunningIndex = index; diff --git a/netwerk/base/nsBaseChannel.cpp b/netwerk/base/nsBaseChannel.cpp index 1a47c0e5d915..2614461516f9 100644 --- a/netwerk/base/nsBaseChannel.cpp +++ b/netwerk/base/nsBaseChannel.cpp @@ -274,19 +274,18 @@ nsresult nsBaseChannel::BeginPumpingData() { nsCOMPtr serialTarget(do_QueryInterface(target)); MOZ_ASSERT(serialTarget); - promise->Then( - serialTarget, __func__, - [self, this](nsresult rv) { - MOZ_ASSERT(mPump); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - mPump->Resume(); - }, - [self, this](nsresult rv) { - MOZ_ASSERT(mPump); - MOZ_ASSERT(NS_FAILED(rv)); - Cancel(rv); - mPump->Resume(); - }); + promise->Then(serialTarget, __func__, + [self, this](nsresult rv) { + MOZ_ASSERT(mPump); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + mPump->Resume(); + }, + [self, this](nsresult rv) { + MOZ_ASSERT(mPump); + MOZ_ASSERT(NS_FAILED(rv)); + Cancel(rv); + mPump->Resume(); + }); } return NS_OK; diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index fefcc5dd591c..26325f261320 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -659,16 +659,15 @@ bool HttpChannelParent::DoAsyncOpen( ++mAsyncOpenBarrier; RefPtr self = this; WaitForBgParent() - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [self]() { - self->mRequest.Complete(); - self->TryInvokeAsyncOpen(NS_OK); - }, - [self](nsresult aStatus) { - self->mRequest.Complete(); - self->TryInvokeAsyncOpen(aStatus); - }) + ->Then(GetMainThreadSerialEventTarget(), __func__, + [self]() { + self->mRequest.Complete(); + self->TryInvokeAsyncOpen(NS_OK); + }, + [self](nsresult aStatus) { + self->mRequest.Complete(); + self->TryInvokeAsyncOpen(aStatus); + }) ->Track(mRequest); // The stream, received from the child process, must be cloneable and seekable @@ -752,13 +751,12 @@ bool HttpChannelParent::ConnectChannel(const uint32_t& registrarId, // Waiting for background channel RefPtr self = this; WaitForBgParent() - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [self]() { self->mRequest.Complete(); }, - [self](const nsresult& aResult) { - NS_ERROR("failed to establish the background channel"); - self->mRequest.Complete(); - }) + ->Then(GetMainThreadSerialEventTarget(), __func__, + [self]() { self->mRequest.Complete(); }, + [self](const nsresult& aResult) { + NS_ERROR("failed to establish the background channel"); + self->mRequest.Complete(); + }) ->Track(mRequest); return true; } diff --git a/netwerk/test/TestBind.cpp b/netwerk/test/TestBind.cpp index 8bfaa8b2df7a..e141750ea038 100644 --- a/netwerk/test/TestBind.cpp +++ b/netwerk/test/TestBind.cpp @@ -95,8 +95,7 @@ ClientInputCallback::OnInputStreamReady(nsIAsyncInputStream* aStream) { return NS_OK; } -TEST(TestBind, MainTest) -{ +TEST(TestBind, MainTest) { // // Server side. // diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index 4fed959645c2..232c0714bded 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -189,8 +189,7 @@ void InitPrefs(nsIPrefBranch *aPrefBranch) { aPrefBranch->SetIntPref(kCookiesMaxPerHost, 50); } -TEST(TestCookie, TestCookieMain) -{ +TEST(TestCookie, TestCookieMain) { nsresult rv0; nsCOMPtr cookieService = diff --git a/netwerk/test/TestNamedPipeService.cpp b/netwerk/test/TestNamedPipeService.cpp index bd08305007ac..5855a385343f 100644 --- a/netwerk/test/TestNamedPipeService.cpp +++ b/netwerk/test/TestNamedPipeService.cpp @@ -251,8 +251,7 @@ static nsresult CreateNamedPipe(LPHANDLE aServer, LPHANDLE aClient) { return NS_OK; } -TEST(TestNamedPipeService, Test) -{ +TEST(TestNamedPipeService, Test) { nsCOMPtr svc = net::NamedPipeService::GetOrCreate(); HANDLE readPipe, writePipe; diff --git a/netwerk/test/TestUDPSocket.cpp b/netwerk/test/TestUDPSocket.cpp index c37a1aaa5b14..3bf7df4ef773 100644 --- a/netwerk/test/TestUDPSocket.cpp +++ b/netwerk/test/TestUDPSocket.cpp @@ -228,8 +228,7 @@ MulticastTimerCallback::Notify(nsITimer* timer) { /**** Main ****/ -TEST(TestUDPSocket, TestUDPSocketMain) -{ +TEST(TestUDPSocket, TestUDPSocketMain) { nsresult rv; // Create UDPSocket diff --git a/netwerk/test/gtest/TestBufferedInputStream.cpp b/netwerk/test/gtest/TestBufferedInputStream.cpp index e32334b15548..671da135135d 100644 --- a/netwerk/test/gtest/TestBufferedInputStream.cpp +++ b/netwerk/test/gtest/TestBufferedInputStream.cpp @@ -21,8 +21,7 @@ already_AddRefed CreateStream(uint32_t aSize, } // Simple reading. -TEST(TestBufferedInputStream, SimpleRead) -{ +TEST(TestBufferedInputStream, SimpleRead) { const size_t kBufSize = 10; nsCString buf; @@ -40,8 +39,7 @@ TEST(TestBufferedInputStream, SimpleRead) } // Simple segment reading. -TEST(TestBufferedInputStream, SimpleReadSegments) -{ +TEST(TestBufferedInputStream, SimpleReadSegments) { const size_t kBufSize = 10; nsCString buf; @@ -56,8 +54,7 @@ TEST(TestBufferedInputStream, SimpleReadSegments) } // AsyncWait - sync -TEST(TestBufferedInputStream, AsyncWait_sync) -{ +TEST(TestBufferedInputStream, AsyncWait_sync) { const size_t kBufSize = 10; nsCString buf; @@ -72,8 +69,7 @@ TEST(TestBufferedInputStream, AsyncWait_sync) } // AsyncWait - async -TEST(TestBufferedInputStream, AsyncWait_async) -{ +TEST(TestBufferedInputStream, AsyncWait_async) { const size_t kBufSize = 10; nsCString buf; @@ -92,8 +88,7 @@ TEST(TestBufferedInputStream, AsyncWait_async) } // AsyncWait - sync - closureOnly -TEST(TestBufferedInputStream, AsyncWait_sync_closureOnly) -{ +TEST(TestBufferedInputStream, AsyncWait_sync_closureOnly) { const size_t kBufSize = 10; nsCString buf; @@ -112,8 +107,7 @@ TEST(TestBufferedInputStream, AsyncWait_sync_closureOnly) } // AsyncWait - async -TEST(TestBufferedInputStream, AsyncWait_async_closureOnly) -{ +TEST(TestBufferedInputStream, AsyncWait_async_closureOnly) { const size_t kBufSize = 10; nsCString buf; diff --git a/netwerk/test/gtest/TestHeaders.cpp b/netwerk/test/gtest/TestHeaders.cpp index 52af2b4864fd..810061eac159 100644 --- a/netwerk/test/gtest/TestHeaders.cpp +++ b/netwerk/test/gtest/TestHeaders.cpp @@ -2,8 +2,7 @@ #include "nsHttpHeaderArray.h" -TEST(TestHeaders, DuplicateHSTS) -{ +TEST(TestHeaders, DuplicateHSTS) { // When the Strict-Transport-Security header is sent multiple times, its // effective value is the value of the first item. It is not merged as other // headers are. diff --git a/netwerk/test/gtest/TestHttpAuthUtils.cpp b/netwerk/test/gtest/TestHttpAuthUtils.cpp index 78fb40d4d00b..8d72f318e476 100644 --- a/netwerk/test/gtest/TestHttpAuthUtils.cpp +++ b/netwerk/test/gtest/TestHttpAuthUtils.cpp @@ -9,8 +9,7 @@ namespace net { #define TEST_PREF "network.http_test.auth_utils" -TEST(TestHttpAuthUtils, Bug1351301) -{ +TEST(TestHttpAuthUtils, Bug1351301) { nsCOMPtr url; nsAutoCString spec; diff --git a/netwerk/test/gtest/TestIsValidIp.cpp b/netwerk/test/gtest/TestIsValidIp.cpp index 24e7d38eade3..ffdc8dffdfca 100644 --- a/netwerk/test/gtest/TestIsValidIp.cpp +++ b/netwerk/test/gtest/TestIsValidIp.cpp @@ -3,26 +3,22 @@ #include "nsURLHelper.h" -TEST(TestIsValidIp, IPV4Localhost) -{ +TEST(TestIsValidIp, IPV4Localhost) { NS_NAMED_LITERAL_CSTRING(ip, "127.0.0.1"); ASSERT_EQ(true, net_IsValidIPv4Addr(ip)); } -TEST(TestIsValidIp, IPV4Only0) -{ +TEST(TestIsValidIp, IPV4Only0) { NS_NAMED_LITERAL_CSTRING(ip, "0.0.0.0"); ASSERT_EQ(true, net_IsValidIPv4Addr(ip)); } -TEST(TestIsValidIp, IPV4Max) -{ +TEST(TestIsValidIp, IPV4Max) { NS_NAMED_LITERAL_CSTRING(ip, "255.255.255.255"); ASSERT_EQ(true, net_IsValidIPv4Addr(ip)); } -TEST(TestIsValidIp, IPV4LeadingZero) -{ +TEST(TestIsValidIp, IPV4LeadingZero) { NS_NAMED_LITERAL_CSTRING(ip, "055.225.255.255"); ASSERT_EQ(false, net_IsValidIPv4Addr(ip)); @@ -36,20 +32,17 @@ TEST(TestIsValidIp, IPV4LeadingZero) ASSERT_EQ(false, net_IsValidIPv4Addr(ip4)); } -TEST(TestIsValidIp, IPV4StartWithADot) -{ +TEST(TestIsValidIp, IPV4StartWithADot) { NS_NAMED_LITERAL_CSTRING(ip, ".192.168.120.197"); ASSERT_EQ(false, net_IsValidIPv4Addr(ip)); } -TEST(TestIsValidIp, IPV4StartWith4Digits) -{ +TEST(TestIsValidIp, IPV4StartWith4Digits) { NS_NAMED_LITERAL_CSTRING(ip, "1927.168.120.197"); ASSERT_EQ(false, net_IsValidIPv4Addr(ip)); } -TEST(TestIsValidIp, IPV4OutOfRange) -{ +TEST(TestIsValidIp, IPV4OutOfRange) { NS_NAMED_LITERAL_CSTRING(invalid1, "421.168.120.124"); NS_NAMED_LITERAL_CSTRING(invalid2, "192.997.120.124"); NS_NAMED_LITERAL_CSTRING(invalid3, "192.168.300.124"); @@ -61,8 +54,7 @@ TEST(TestIsValidIp, IPV4OutOfRange) ASSERT_EQ(false, net_IsValidIPv4Addr(invalid4)); } -TEST(TestIsValidIp, IPV4EmptyDigits) -{ +TEST(TestIsValidIp, IPV4EmptyDigits) { NS_NAMED_LITERAL_CSTRING(invalid1, "..0.0.0"); NS_NAMED_LITERAL_CSTRING(invalid2, "127..0.0"); NS_NAMED_LITERAL_CSTRING(invalid3, "127.0..0"); @@ -74,8 +66,7 @@ TEST(TestIsValidIp, IPV4EmptyDigits) ASSERT_EQ(false, net_IsValidIPv4Addr(invalid4)); } -TEST(TestIsValidIp, IPV4NonNumeric) -{ +TEST(TestIsValidIp, IPV4NonNumeric) { NS_NAMED_LITERAL_CSTRING(invalid1, "127.0.0.f"); NS_NAMED_LITERAL_CSTRING(invalid2, "127.0.0.!"); NS_NAMED_LITERAL_CSTRING(invalid3, "127#0.0.1"); @@ -85,20 +76,17 @@ TEST(TestIsValidIp, IPV4NonNumeric) ASSERT_EQ(false, net_IsValidIPv4Addr(invalid3)); } -TEST(TestIsValidIp, IPV4TooManyDigits) -{ +TEST(TestIsValidIp, IPV4TooManyDigits) { NS_NAMED_LITERAL_CSTRING(ip, "127.0.0.1.2"); ASSERT_EQ(false, net_IsValidIPv4Addr(ip)); } -TEST(TestIsValidIp, IPV4TooFewDigits) -{ +TEST(TestIsValidIp, IPV4TooFewDigits) { NS_NAMED_LITERAL_CSTRING(ip, "127.0.1"); ASSERT_EQ(false, net_IsValidIPv4Addr(ip)); } -TEST(TestIsValidIp, IPV6WithIPV4Inside) -{ +TEST(TestIsValidIp, IPV6WithIPV4Inside) { const char ipv6[] = "0123:4567:89ab:cdef:0123:4567:127.0.0.1"; ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6, 39)); } diff --git a/netwerk/test/gtest/TestMIMEInputStream.cpp b/netwerk/test/gtest/TestMIMEInputStream.cpp index d57646bb5b00..6cae4f746bb5 100644 --- a/netwerk/test/gtest/TestMIMEInputStream.cpp +++ b/netwerk/test/gtest/TestMIMEInputStream.cpp @@ -56,8 +56,7 @@ NS_IMPL_ISUPPORTS_INHERITED(SeekableLengthInputStream, // nsIInputStreamLength && nsIAsyncInputStreamLength -TEST(TestNsMIMEInputStream, QIInputStreamLength) -{ +TEST(TestNsMIMEInputStream, QIInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -91,8 +90,7 @@ TEST(TestNsMIMEInputStream, QIInputStreamLength) } } -TEST(TestNsMIMEInputStream, InputStreamLength) -{ +TEST(TestNsMIMEInputStream, InputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -122,8 +120,7 @@ TEST(TestNsMIMEInputStream, InputStreamLength) ASSERT_EQ(buf.Length(), size); } -TEST(TestNsMIMEInputStream, NegativeInputStreamLength) -{ +TEST(TestNsMIMEInputStream, NegativeInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -153,8 +150,7 @@ TEST(TestNsMIMEInputStream, NegativeInputStreamLength) ASSERT_EQ(-1, size); } -TEST(TestNsMIMEInputStream, AsyncInputStreamLength) -{ +TEST(TestNsMIMEInputStream, AsyncInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -188,8 +184,7 @@ TEST(TestNsMIMEInputStream, AsyncInputStreamLength) ASSERT_EQ(buf.Length(), callback->Size()); } -TEST(TestNsMIMEInputStream, NegativeAsyncInputStreamLength) -{ +TEST(TestNsMIMEInputStream, NegativeAsyncInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -223,8 +218,7 @@ TEST(TestNsMIMEInputStream, NegativeAsyncInputStreamLength) ASSERT_EQ(-1, callback->Size()); } -TEST(TestNsMIMEInputStream, AbortLengthCallback) -{ +TEST(TestNsMIMEInputStream, AbortLengthCallback) { nsCString buf; buf.AssignLiteral("Hello world"); diff --git a/netwerk/test/gtest/TestMozURL.cpp b/netwerk/test/gtest/TestMozURL.cpp index 225667342a95..56f969eb1717 100644 --- a/netwerk/test/gtest/TestMozURL.cpp +++ b/netwerk/test/gtest/TestMozURL.cpp @@ -11,8 +11,7 @@ using namespace mozilla; using namespace mozilla::net; -TEST(TestMozURL, Getters) -{ +TEST(TestMozURL, Getters) { nsAutoCString href("http://user:pass@example.com/path?query#ref"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -39,8 +38,7 @@ TEST(TestMozURL, Getters) ASSERT_EQ(url, nullptr); } -TEST(TestMozURL, MutatorChain) -{ +TEST(TestMozURL, MutatorChain) { nsAutoCString href("http://user:pass@example.com/path?query#ref"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -62,8 +60,7 @@ TEST(TestMozURL, MutatorChain) "https://newuser:newpass@test/new/file/path?bla#huh")); } -TEST(TestMozURL, MutatorFinalizeTwice) -{ +TEST(TestMozURL, MutatorFinalizeTwice) { nsAutoCString href("http://user:pass@example.com/path?query#ref"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -82,8 +79,7 @@ TEST(TestMozURL, MutatorFinalizeTwice) ASSERT_EQ(url2, nullptr); } -TEST(TestMozURL, MutatorErrorStatus) -{ +TEST(TestMozURL, MutatorErrorStatus) { nsAutoCString href("http://user:pass@example.com/path?query#ref"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -99,8 +95,7 @@ TEST(TestMozURL, MutatorErrorStatus) ASSERT_EQ(mut.GetStatus(), NS_ERROR_MALFORMED_URI); } -TEST(TestMozURL, InitWithBase) -{ +TEST(TestMozURL, InitWithBase) { nsAutoCString href("https://example.net/a/b.html"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -115,8 +110,7 @@ TEST(TestMozURL, InitWithBase) ASSERT_TRUE(url2->Spec().EqualsLiteral("https://example.net/a/c.png")); } -TEST(TestMozURL, Path) -{ +TEST(TestMozURL, Path) { nsAutoCString href("about:blank"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -128,8 +122,7 @@ TEST(TestMozURL, Path) ASSERT_TRUE(url->FilePath().EqualsLiteral("blank")); } -TEST(TestMozURL, HostPort) -{ +TEST(TestMozURL, HostPort) { nsAutoCString href("https://user:pass@example.net:1234/path?query#ref"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -151,8 +144,7 @@ TEST(TestMozURL, HostPort) ASSERT_EQ(url->Port(), -1); } -TEST(TestMozURL, Origin) -{ +TEST(TestMozURL, Origin) { nsAutoCString href("https://user:pass@example.net:1234/path?query#ref"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -194,8 +186,7 @@ TEST(TestMozURL, Origin) ASSERT_TRUE(out.EqualsLiteral("about:home")); } -TEST(TestMozURL, BaseDomain) -{ +TEST(TestMozURL, BaseDomain) { nsAutoCString href("https://user:pass@example.net:1234/path?query#ref"); RefPtr url; ASSERT_EQ(MozURL::Init(getter_AddRefs(url), href), NS_OK); @@ -317,8 +308,7 @@ void CheckOrigin(const nsACString& aSpec, const nsACString& aBase, } // namespace -TEST(TestMozURL, UrlTestData) -{ +TEST(TestMozURL, UrlTestData) { nsCOMPtr file; nsresult rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR, getter_AddRefs(file)); diff --git a/netwerk/test/gtest/TestPartiallySeekableInputStream.cpp b/netwerk/test/gtest/TestPartiallySeekableInputStream.cpp index 18198428d91a..30dccd9e8c48 100644 --- a/netwerk/test/gtest/TestPartiallySeekableInputStream.cpp +++ b/netwerk/test/gtest/TestPartiallySeekableInputStream.cpp @@ -64,8 +64,7 @@ PartiallySeekableInputStream* CreateStream(uint32_t aSize, uint64_t aStreamSize, } // Simple reading. -TEST(TestPartiallySeekableInputStream, SimpleRead) -{ +TEST(TestPartiallySeekableInputStream, SimpleRead) { const size_t kBufSize = 10; nsCString buf; @@ -99,8 +98,7 @@ TEST(TestPartiallySeekableInputStream, SimpleRead) } // Simple seek -TEST(TestPartiallySeekableInputStream, SimpleSeek) -{ +TEST(TestPartiallySeekableInputStream, SimpleSeek) { const size_t kBufSize = 10; nsCString buf; @@ -188,8 +186,7 @@ TEST(TestPartiallySeekableInputStream, SimpleSeek) } // Full in cache -TEST(TestPartiallySeekableInputStream, FullCachedSeek) -{ +TEST(TestPartiallySeekableInputStream, FullCachedSeek) { const size_t kBufSize = 10; nsCString buf; @@ -221,8 +218,7 @@ TEST(TestPartiallySeekableInputStream, FullCachedSeek) ASSERT_EQ((uint64_t)0, length); } -TEST(TestPartiallySeekableInputStream, QIInputStreamLength) -{ +TEST(TestPartiallySeekableInputStream, QIInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -246,8 +242,7 @@ TEST(TestPartiallySeekableInputStream, QIInputStreamLength) } } -TEST(TestPartiallySeekableInputStream, InputStreamLength) -{ +TEST(TestPartiallySeekableInputStream, InputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -267,8 +262,7 @@ TEST(TestPartiallySeekableInputStream, InputStreamLength) ASSERT_EQ(buf.Length(), size); } -TEST(TestPartiallySeekableInputStream, NegativeInputStreamLength) -{ +TEST(TestPartiallySeekableInputStream, NegativeInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -288,8 +282,7 @@ TEST(TestPartiallySeekableInputStream, NegativeInputStreamLength) ASSERT_EQ(-1, size); } -TEST(TestPartiallySeekableInputStream, AsyncInputStreamLength) -{ +TEST(TestPartiallySeekableInputStream, AsyncInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -313,8 +306,7 @@ TEST(TestPartiallySeekableInputStream, AsyncInputStreamLength) ASSERT_EQ(buf.Length(), callback->Size()); } -TEST(TestPartiallySeekableInputStream, NegativeAsyncInputStreamLength) -{ +TEST(TestPartiallySeekableInputStream, NegativeAsyncInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -338,8 +330,7 @@ TEST(TestPartiallySeekableInputStream, NegativeAsyncInputStreamLength) ASSERT_EQ(-1, callback->Size()); } -TEST(TestPartiallySeekableInputStream, AbortLengthCallback) -{ +TEST(TestPartiallySeekableInputStream, AbortLengthCallback) { nsCString buf; buf.AssignLiteral("Hello world"); diff --git a/netwerk/test/gtest/TestProtocolProxyService.cpp b/netwerk/test/gtest/TestProtocolProxyService.cpp index a26f5f62a8a0..36933a17d735 100644 --- a/netwerk/test/gtest/TestProtocolProxyService.cpp +++ b/netwerk/test/gtest/TestProtocolProxyService.cpp @@ -12,8 +12,7 @@ namespace mozilla { namespace net { -TEST(TestProtocolProxyService, LoadHostFilters) -{ +TEST(TestProtocolProxyService, LoadHostFilters) { nsCOMPtr ps = do_GetService(NS_PROTOCOLPROXYSERVICE_CID); ASSERT_TRUE(ps); diff --git a/netwerk/test/gtest/TestReadStreamToString.cpp b/netwerk/test/gtest/TestReadStreamToString.cpp index a71c07b0212d..f4aa0cd1e8f7 100644 --- a/netwerk/test/gtest/TestReadStreamToString.cpp +++ b/netwerk/test/gtest/TestReadStreamToString.cpp @@ -4,8 +4,7 @@ #include "nsNetUtil.h" // Here we test the reading a pre-allocated size -TEST(TestReadStreamToString, SyncStreamPreAllocatedSize) -{ +TEST(TestReadStreamToString, SyncStreamPreAllocatedSize) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -27,8 +26,7 @@ TEST(TestReadStreamToString, SyncStreamPreAllocatedSize) } // Here we test the reading the full size of a sync stream -TEST(TestReadStreamToString, SyncStreamFullSize) -{ +TEST(TestReadStreamToString, SyncStreamFullSize) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -45,8 +43,7 @@ TEST(TestReadStreamToString, SyncStreamFullSize) } // Here we test the reading less than the full size of a sync stream -TEST(TestReadStreamToString, SyncStreamLessThan) -{ +TEST(TestReadStreamToString, SyncStreamLessThan) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -62,8 +59,7 @@ TEST(TestReadStreamToString, SyncStreamLessThan) } // Here we test the reading more than the full size of a sync stream -TEST(TestReadStreamToString, SyncStreamMoreThan) -{ +TEST(TestReadStreamToString, SyncStreamMoreThan) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -81,8 +77,7 @@ TEST(TestReadStreamToString, SyncStreamMoreThan) } // Here we test the reading a sync stream without passing the size -TEST(TestReadStreamToString, SyncStreamUnknownSize) -{ +TEST(TestReadStreamToString, SyncStreamUnknownSize) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -99,8 +94,7 @@ TEST(TestReadStreamToString, SyncStreamUnknownSize) } // Here we test the reading the full size of an async stream -TEST(TestReadStreamToString, AsyncStreamFullSize) -{ +TEST(TestReadStreamToString, AsyncStreamFullSize) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -116,8 +110,7 @@ TEST(TestReadStreamToString, AsyncStreamFullSize) } // Here we test the reading less than the full size of an async stream -TEST(TestReadStreamToString, AsyncStreamLessThan) -{ +TEST(TestReadStreamToString, AsyncStreamLessThan) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -132,8 +125,7 @@ TEST(TestReadStreamToString, AsyncStreamLessThan) } // Here we test the reading more than the full size of an async stream -TEST(TestReadStreamToString, AsyncStreamMoreThan) -{ +TEST(TestReadStreamToString, AsyncStreamMoreThan) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -150,8 +142,7 @@ TEST(TestReadStreamToString, AsyncStreamMoreThan) } // Here we test the reading an async stream without passing the size -TEST(TestReadStreamToString, AsyncStreamUnknownSize) -{ +TEST(TestReadStreamToString, AsyncStreamUnknownSize) { nsCString buffer; buffer.AssignLiteral("Hello world!"); @@ -167,8 +158,7 @@ TEST(TestReadStreamToString, AsyncStreamUnknownSize) } // Here we test the reading an async big stream without passing the size -TEST(TestReadStreamToString, AsyncStreamUnknownBigSize) -{ +TEST(TestReadStreamToString, AsyncStreamUnknownBigSize) { nsCString buffer; buffer.SetLength(4096 * 2); diff --git a/netwerk/test/gtest/TestServerTimingHeader.cpp b/netwerk/test/gtest/TestServerTimingHeader.cpp index ac55308a0ebb..30e8e392820d 100644 --- a/netwerk/test/gtest/TestServerTimingHeader.cpp +++ b/netwerk/test/gtest/TestServerTimingHeader.cpp @@ -34,8 +34,7 @@ void testServerTimingHeader( } } -TEST(TestServerTimingHeader, HeaderParsing) -{ +TEST(TestServerTimingHeader, HeaderParsing) { // Test cases below are copied from // https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp diff --git a/netwerk/test/gtest/TestStandardURL.cpp b/netwerk/test/gtest/TestStandardURL.cpp index ab459054fa45..927a4641fb82 100644 --- a/netwerk/test/gtest/TestStandardURL.cpp +++ b/netwerk/test/gtest/TestStandardURL.cpp @@ -15,8 +15,7 @@ // In nsStandardURL.cpp extern nsresult Test_NormalizeIPv4(const nsACString& host, nsCString& result); -TEST(TestStandardURL, Simple) -{ +TEST(TestStandardURL, Simple) { nsCOMPtr url; ASSERT_EQ(NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID) .SetSpec(NS_LITERAL_CSTRING("http://example.com")) @@ -80,8 +79,7 @@ TEST(TestStandardURL, Simple) ASSERT_TRUE(out == NS_LITERAL_CSTRING("some-book-mark")); } -TEST(TestStandardURL, NormalizeGood) -{ +TEST(TestStandardURL, NormalizeGood) { nsCString result; const char* manual[] = {"0.0.0.0", "0.0.0.0", @@ -186,8 +184,7 @@ TEST(TestStandardURL, NormalizeGood) } } -TEST(TestStandardURL, NormalizeBad) -{ +TEST(TestStandardURL, NormalizeBad) { nsAutoCString result; const char* manual[] = { "x22.232.12.32", "122..12.32", "122.12.32.12.32", "122.12.32..", @@ -205,8 +202,7 @@ TEST(TestStandardURL, NormalizeBad) } } -TEST(TestStandardURL, From_test_standardurldotjs) -{ +TEST(TestStandardURL, From_test_standardurldotjs) { // These are test (success and failure) cases from test_standardurl.js nsAutoCString result; @@ -331,8 +327,7 @@ MOZ_GTEST_BENCH(TestStandardURL, DISABLED_NormalizePerfFails, [] { }); #endif -TEST(TestStandardURL, Mutator) -{ +TEST(TestStandardURL, Mutator) { nsAutoCString out; nsCOMPtr uri; nsresult rv = NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID) @@ -359,8 +354,7 @@ TEST(TestStandardURL, Mutator) ASSERT_TRUE(out == NS_LITERAL_CSTRING("https://mozilla.org/path?query#ref")); } -TEST(TestStandardURL, Deserialize_Bug1392739) -{ +TEST(TestStandardURL, Deserialize_Bug1392739) { mozilla::ipc::StandardURLParams standard_params; standard_params.urlType() = nsIStandardURL::URLTYPE_STANDARD; standard_params.spec() = NS_LITERAL_CSTRING(""); diff --git a/netwerk/test/gtest/TestURIMutator.cpp b/netwerk/test/gtest/TestURIMutator.cpp index 34033a782d85..0aba70205caa 100644 --- a/netwerk/test/gtest/TestURIMutator.cpp +++ b/netwerk/test/gtest/TestURIMutator.cpp @@ -6,8 +6,7 @@ #include "nsThreadPool.h" #include "nsNetUtil.h" -TEST(TestURIMutator, Mutator) -{ +TEST(TestURIMutator, Mutator) { nsAutoCString out; // This test instantiates a new nsStandardURL::Mutator (via contractID) @@ -103,8 +102,7 @@ TEST(TestURIMutator, Mutator) extern MOZ_THREAD_LOCAL(uint32_t) gTlsURLRecursionCount; -TEST(TestURIMutator, NS_NewURIOnAnyThread) -{ +TEST(TestURIMutator, NS_NewURIOnAnyThread) { nsCOMPtr pool = new nsThreadPool(); pool->SetThreadLimit(60); diff --git a/netwerk/test/gtest/parse-ftp/TestParseFTPList.cpp b/netwerk/test/gtest/parse-ftp/TestParseFTPList.cpp index 1f8f529b90eb..d8e108832956 100644 --- a/netwerk/test/gtest/parse-ftp/TestParseFTPList.cpp +++ b/netwerk/test/gtest/parse-ftp/TestParseFTPList.cpp @@ -121,8 +121,7 @@ static const char* testFiles[] = { "U-WinNT", "U-wu", "V-MultiNet", "V-VMS-mix", }; -TEST(ParseFTPTest, Check) -{ +TEST(ParseFTPTest, Check) { PRStatus result = PR_ParseTimeString(kDefaultTestTime, true, &gTestTime); ASSERT_EQ(PR_SUCCESS, result); diff --git a/parser/html/nsHtml5MetaScanner.cpp b/parser/html/nsHtml5MetaScanner.cpp index e92dcf791530..41de496a02b1 100644 --- a/parser/html/nsHtml5MetaScanner.cpp +++ b/parser/html/nsHtml5MetaScanner.cpp @@ -115,9 +115,7 @@ stateloop: state = nsHtml5MetaScanner::TAG_OPEN; NS_HTML5_BREAK(dataloop); } - default: { - continue; - } + default: { continue; } } } dataloop_end:; @@ -620,9 +618,7 @@ stateloop: state = nsHtml5MetaScanner::COMMENT_END_DASH; NS_HTML5_BREAK(commentloop); } - default: { - continue; - } + default: { continue; } } } commentloop_end:; @@ -727,9 +723,7 @@ stateloop: state = nsHtml5MetaScanner::DATA; NS_HTML5_CONTINUE(stateloop); } - default: { - continue; - } + default: { continue; } } } } diff --git a/parser/html/nsHtml5Tokenizer.cpp b/parser/html/nsHtml5Tokenizer.cpp index 14ff5ba62fd8..e7202c04aab6 100644 --- a/parser/html/nsHtml5Tokenizer.cpp +++ b/parser/html/nsHtml5Tokenizer.cpp @@ -507,9 +507,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } dataloop_end:; @@ -1562,9 +1560,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } cdatasectionloop_end:; @@ -2101,9 +2097,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } } @@ -2216,9 +2210,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } } @@ -2253,9 +2245,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } rawtextloop_end:; @@ -2487,9 +2477,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } scriptdataloop_end:; @@ -2668,9 +2656,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } scriptdataescapedloop_end:; @@ -2860,9 +2846,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } scriptdatadoubleescapedloop_end:; @@ -3722,9 +3706,7 @@ stateloop: silentLineFeed(); MOZ_FALLTHROUGH; } - default: { - continue; - } + default: { continue; } } } } @@ -3995,9 +3977,7 @@ stateloop: reconsume, pos); NS_HTML5_BREAK(processinginstructionloop); } - default: { - continue; - } + default: { continue; } } } processinginstructionloop_end:; @@ -4410,9 +4390,7 @@ eofloop: NS_HTML5_BREAK(eofloop); } case DATA: - default: { - NS_HTML5_BREAK(eofloop); - } + default: { NS_HTML5_BREAK(eofloop); } } } eofloop_end:; diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index af43c122cf0f..c6b913967d55 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -277,9 +277,7 @@ void nsHtml5TreeBuilder::comment(char16_t* buf, int32_t start, int32_t length) { appendComment(stack[0]->node, buf, start, length); return; } - default: { - break; - } + default: { break; } } } flushCharacters(); @@ -641,9 +639,7 @@ void nsHtml5TreeBuilder::eof() { case AFTER_FRAMESET: case AFTER_AFTER_BODY: case AFTER_AFTER_FRAMESET: - default: { - NS_HTML5_BREAK(eofloop); - } + default: { NS_HTML5_BREAK(eofloop); } } } eofloop_end:; @@ -2133,9 +2129,7 @@ nsHtml5String nsHtml5TreeBuilder::extractCharsetFromContent( charsetState = CHARSET_C; continue; } - default: { - continue; - } + default: { continue; } } } case CHARSET_C: { @@ -2229,9 +2223,7 @@ nsHtml5String nsHtml5TreeBuilder::extractCharsetFromContent( charsetState = CHARSET_EQUALS; continue; } - default: { - return nullptr; - } + default: { return nullptr; } } } case CHARSET_EQUALS: { @@ -2266,9 +2258,7 @@ nsHtml5String nsHtml5TreeBuilder::extractCharsetFromContent( end = i; NS_HTML5_BREAK(charsetloop); } - default: { - continue; - } + default: { continue; } } } case CHARSET_DOUBLE_QUOTED: { @@ -2277,9 +2267,7 @@ nsHtml5String nsHtml5TreeBuilder::extractCharsetFromContent( end = i; NS_HTML5_BREAK(charsetloop); } - default: { - continue; - } + default: { continue; } } } case CHARSET_UNQUOTED: { @@ -2293,9 +2281,7 @@ nsHtml5String nsHtml5TreeBuilder::extractCharsetFromContent( end = i; NS_HTML5_BREAK(charsetloop); } - default: { - continue; - } + default: { continue; } } } } @@ -2517,9 +2503,7 @@ void nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName) { case TEMPLATE: { break; } - default: { - errStrayEndTag(name); - } + default: { errStrayEndTag(name); } } MOZ_FALLTHROUGH; } @@ -3310,9 +3294,7 @@ void nsHtml5TreeBuilder::generateImpliedEndTagsExceptFor(nsAtom* name) { pop(); continue; } - default: { - return; - } + default: { return; } } } } @@ -3330,9 +3312,7 @@ void nsHtml5TreeBuilder::generateImpliedEndTags() { pop(); continue; } - default: { - return; - } + default: { return; } } } } @@ -4504,9 +4484,7 @@ bool nsHtml5TreeBuilder::charBufferContainsNonWhitespace() { case '\f': { continue; } - default: { - return true; - } + default: { return true; } } } return false; diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp index 6cd8f0cf6cc4..185f2f6906c3 100644 --- a/parser/html/nsHtml5TreeOperation.cpp +++ b/parser/html/nsHtml5TreeOperation.cpp @@ -1116,9 +1116,7 @@ nsresult nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, aInterrupted); // this causes a notification flush anyway return NS_OK; } - default: { - MOZ_CRASH("Bogus tree op"); - } + default: { MOZ_CRASH("Bogus tree op"); } } return NS_OK; // keep compiler happy } diff --git a/security/certverifier/tests/gtest/TrustOverrideTest.cpp b/security/certverifier/tests/gtest/TrustOverrideTest.cpp index 6facadcf5e5e..a6be2eeb2830 100644 --- a/security/certverifier/tests/gtest/TrustOverrideTest.cpp +++ b/security/certverifier/tests/gtest/TrustOverrideTest.cpp @@ -124,29 +124,24 @@ class psm_TrustOverrideTest : public ::testing::Test { protected: void SetUp() override { nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); - ASSERT_TRUE(prefs != nullptr) - << "couldn't get nsIPrefBranch"; + ASSERT_TRUE(prefs != nullptr) << "couldn't get nsIPrefBranch"; // When PSM initializes, it attempts to get some localized strings. // As a result, Android flips out if this isn't set. nsresult rv = prefs->SetBoolPref("intl.locale.matchOS", true); - ASSERT_TRUE(NS_SUCCEEDED(rv)) - << "couldn't set pref 'intl.locale.matchOS'"; + ASSERT_TRUE(NS_SUCCEEDED(rv)) << "couldn't set pref 'intl.locale.matchOS'"; nsCOMPtr certdb(do_GetService(NS_X509CERTDB_CONTRACTID)); - ASSERT_TRUE(certdb != nullptr) - << "couldn't get certdb"; + ASSERT_TRUE(certdb != nullptr) << "couldn't get certdb"; } }; TEST_F(psm_TrustOverrideTest, CheckCertDNIsInList) { mozilla::UniqueCERTCertificate caObj = CertFromString(kOverrideCaPem); - ASSERT_TRUE(caObj != nullptr) - << "Should have parsed"; + ASSERT_TRUE(caObj != nullptr) << "Should have parsed"; mozilla::UniqueCERTCertificate intObj = CertFromString(kOverrideCaIntermediatePem); - ASSERT_TRUE(intObj != nullptr) - << "Should have parsed"; + ASSERT_TRUE(intObj != nullptr) << "Should have parsed"; EXPECT_TRUE(CertDNIsInList(caObj.get(), OverrideCaDNs)) << "CA should be in the DN list"; @@ -156,12 +151,10 @@ TEST_F(psm_TrustOverrideTest, CheckCertDNIsInList) { TEST_F(psm_TrustOverrideTest, CheckCertSPKIIsInList) { mozilla::UniqueCERTCertificate caObj = CertFromString(kOverrideCaPem); - ASSERT_TRUE(caObj != nullptr) - << "Should have parsed"; + ASSERT_TRUE(caObj != nullptr) << "Should have parsed"; mozilla::UniqueCERTCertificate intObj = CertFromString(kOverrideCaIntermediatePem); - ASSERT_TRUE(intObj != nullptr) - << "Should have parsed"; + ASSERT_TRUE(intObj != nullptr) << "Should have parsed"; EXPECT_TRUE(CertSPKIIsInList(caObj.get(), OverrideCaSPKIs)) << "CA should be in the SPKI list"; diff --git a/security/manager/ssl/tests/gtest/CertDBTest.cpp b/security/manager/ssl/tests/gtest/CertDBTest.cpp index 7cbb8ed4b23c..eae6f1f99e0f 100644 --- a/security/manager/ssl/tests/gtest/CertDBTest.cpp +++ b/security/manager/ssl/tests/gtest/CertDBTest.cpp @@ -12,54 +12,46 @@ #include "nsIX509CertList.h" #include "nsServiceManagerUtils.h" -TEST(psm_CertDB, Test) -{ +TEST(psm_CertDB, Test) { { nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); - ASSERT_TRUE(prefs) - << "couldn't get nsIPrefBranch"; + ASSERT_TRUE(prefs) << "couldn't get nsIPrefBranch"; // When PSM initializes, it attempts to get some localized strings. // As a result, Android flips out if this isn't set. nsresult rv = prefs->SetBoolPref("intl.locale.matchOS", true); - ASSERT_TRUE(NS_SUCCEEDED(rv)) - << "couldn't set pref 'intl.locale.matchOS'"; + ASSERT_TRUE(NS_SUCCEEDED(rv)) << "couldn't set pref 'intl.locale.matchOS'"; nsCOMPtr certdb(do_GetService(NS_X509CERTDB_CONTRACTID)); - ASSERT_TRUE(certdb) - << "couldn't get certdb"; + ASSERT_TRUE(certdb) << "couldn't get certdb"; nsCOMPtr certList; rv = certdb->GetCerts(getter_AddRefs(certList)); - ASSERT_TRUE(NS_SUCCEEDED(rv)) - << "couldn't get list of certificates"; + ASSERT_TRUE(NS_SUCCEEDED(rv)) << "couldn't get list of certificates"; nsCOMPtr enumerator; rv = certList->GetEnumerator(getter_AddRefs(enumerator)); - ASSERT_TRUE(NS_SUCCEEDED(rv)) - << "couldn't enumerate certificate list"; + ASSERT_TRUE(NS_SUCCEEDED(rv)) << "couldn't enumerate certificate list"; bool foundBuiltIn = false; bool hasMore = false; while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) { nsCOMPtr supports; ASSERT_TRUE(NS_SUCCEEDED(enumerator->GetNext(getter_AddRefs(supports)))) - << "couldn't get next certificate"; + << "couldn't get next certificate"; nsCOMPtr cert(do_QueryInterface(supports)); - ASSERT_TRUE(cert) - << "couldn't QI to nsIX509Cert"; + ASSERT_TRUE(cert) << "couldn't QI to nsIX509Cert"; ASSERT_TRUE(NS_SUCCEEDED(cert->GetIsBuiltInRoot(&foundBuiltIn))) - << "GetIsBuiltInRoot failed"; + << "GetIsBuiltInRoot failed"; if (foundBuiltIn) { break; } } - ASSERT_TRUE(foundBuiltIn) - << "didn't load any built-in certificates"; + ASSERT_TRUE(foundBuiltIn) << "didn't load any built-in certificates"; printf("successfully loaded at least one built-in certificate\n"); diff --git a/security/manager/ssl/tests/gtest/CertListTest.cpp b/security/manager/ssl/tests/gtest/CertListTest.cpp index 071c31b8ee76..7d12051763ca 100644 --- a/security/manager/ssl/tests/gtest/CertListTest.cpp +++ b/security/manager/ssl/tests/gtest/CertListTest.cpp @@ -120,18 +120,15 @@ class psm_CertList : public ::testing::Test { protected: void SetUp() override { nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); - ASSERT_TRUE(prefs) - << "couldn't get nsIPrefBranch"; + ASSERT_TRUE(prefs) << "couldn't get nsIPrefBranch"; // When PSM initializes, it attempts to get some localized strings. // As a result, Android flips out if this isn't set. nsresult rv = prefs->SetBoolPref("intl.locale.matchOS", true); - ASSERT_TRUE(NS_SUCCEEDED(rv)) - << "couldn't set pref 'intl.locale.matchOS'"; + ASSERT_TRUE(NS_SUCCEEDED(rv)) << "couldn't set pref 'intl.locale.matchOS'"; nsCOMPtr certdb(do_GetService(NS_X509CERTDB_CONTRACTID)); - ASSERT_TRUE(certdb) - << "couldn't get certdb"; + ASSERT_TRUE(certdb) << "couldn't get certdb"; } }; @@ -202,24 +199,22 @@ TEST_F(psm_CertList, TestValidSegmenting) { rv = certList->SegmentCertificateChain(rootCert, intCerts, eeCert); ASSERT_EQ(rv, NS_OK) << "Should have segmented OK"; - ASSERT_TRUE(rootCert) - << "Root cert should be filled in"; - ASSERT_TRUE(eeCert) - << "End entity cert should be filled in"; + ASSERT_TRUE(rootCert) << "Root cert should be filled in"; + ASSERT_TRUE(eeCert) << "End entity cert should be filled in"; ASSERT_EQ(CountCertsInList(intCerts), 0) << "There should be no intermediates"; bool selfSigned; ASSERT_TRUE(NS_SUCCEEDED(rootCert->GetIsSelfSigned(&selfSigned))) - << "Getters should work."; + << "Getters should work."; ASSERT_FALSE(selfSigned) << "Roots are self signed, but this was ca-second-intermediate"; nsAutoString rootCn; ASSERT_TRUE(NS_SUCCEEDED(rootCert->GetCommonName(rootCn))) - << "Getters should work."; + << "Getters should work."; ASSERT_TRUE(rootCn.EqualsLiteral("ca-second-intermediate")) - << "Second Intermediate CN should match"; + << "Second Intermediate CN should match"; rv = AddCertFromStringToList(kCaIntermediatePem, certList); ASSERT_EQ(rv, NS_OK) << "Should have loaded OK"; @@ -230,10 +225,8 @@ TEST_F(psm_CertList, TestValidSegmenting) { rv = certList->SegmentCertificateChain(rootCert, intCerts, eeCert); ASSERT_EQ(rv, NS_OK) << "Should have segmented OK"; - ASSERT_TRUE(rootCert) - << "Root cert should be filled in"; - ASSERT_TRUE(eeCert) - << "End entity cert should be filled in"; + ASSERT_TRUE(rootCert) << "Root cert should be filled in"; + ASSERT_TRUE(eeCert) << "End entity cert should be filled in"; ASSERT_EQ(CountCertsInList(intCerts), 1) << "There should be one intermediate"; @@ -246,28 +239,23 @@ TEST_F(psm_CertList, TestValidSegmenting) { rv = certList->SegmentCertificateChain(rootCert, intCerts, eeCert); ASSERT_EQ(rv, NS_OK) << "Should have segmented OK"; - ASSERT_TRUE(rootCert) - << "Root cert should be filled in"; - ASSERT_TRUE(eeCert) - << "End entity cert should be filled in"; + ASSERT_TRUE(rootCert) << "Root cert should be filled in"; + ASSERT_TRUE(eeCert) << "End entity cert should be filled in"; ASSERT_EQ(CountCertsInList(intCerts), 2) << "There should be two intermediates"; ASSERT_TRUE(NS_SUCCEEDED(rootCert->GetIsSelfSigned(&selfSigned))) - << "Getters should work."; - ASSERT_TRUE(selfSigned) - << "Roots are self signed"; + << "Getters should work."; + ASSERT_TRUE(selfSigned) << "Roots are self signed"; ASSERT_TRUE(NS_SUCCEEDED(rootCert->GetCommonName(rootCn))) - << "Getters should work."; - ASSERT_TRUE(rootCn.EqualsLiteral("ca")) - << "Root CN should match"; + << "Getters should work."; + ASSERT_TRUE(rootCn.EqualsLiteral("ca")) << "Root CN should match"; nsAutoString eeCn; ASSERT_TRUE(NS_SUCCEEDED(eeCert->GetCommonName(eeCn))) - << "Getters should work."; - ASSERT_TRUE(eeCn.EqualsLiteral("ee")) - << "EE CN should match"; + << "Getters should work."; + ASSERT_TRUE(eeCn.EqualsLiteral("ee")) << "EE CN should match"; rv = intCerts->GetCertList()->ForEachCertificateInChain( [](nsCOMPtr aCert, bool aHasMore, bool& aContinue) { @@ -425,8 +413,7 @@ TEST_F(psm_CertList, TestGetRootCertificateChainTwo) { nsCOMPtr rootCert; rv = certList->GetRootCertificate(rootCert); EXPECT_EQ(NS_OK, rv) << "Should have fetched the root OK"; - ASSERT_TRUE(rootCert) - << "Root cert should be filled in"; + ASSERT_TRUE(rootCert) << "Root cert should be filled in"; bool selfSigned; EXPECT_TRUE(NS_SUCCEEDED(rootCert->GetIsSelfSigned(&selfSigned))) @@ -442,8 +429,7 @@ TEST_F(psm_CertList, TestGetRootCertificateChainTwo) { nsCOMPtr rootCertRepeat; rv = certList->GetRootCertificate(rootCertRepeat); EXPECT_EQ(NS_OK, rv) << "Should have fetched the root OK the second time"; - ASSERT_TRUE(rootCertRepeat) - << "Root cert should still be filled in"; + ASSERT_TRUE(rootCertRepeat) << "Root cert should still be filled in"; nsAutoString rootRepeatCn; EXPECT_TRUE(NS_SUCCEEDED(rootCertRepeat->GetCommonName(rootRepeatCn))) @@ -466,8 +452,7 @@ TEST_F(psm_CertList, TestGetRootCertificateChainFour) { nsCOMPtr rootCert; rv = certList->GetRootCertificate(rootCert); EXPECT_EQ(NS_OK, rv) << "Should have again fetched the root OK"; - ASSERT_TRUE(rootCert) - << "Root cert should be filled in"; + ASSERT_TRUE(rootCert) << "Root cert should be filled in"; bool selfSigned; EXPECT_TRUE(NS_SUCCEEDED(rootCert->GetIsSelfSigned(&selfSigned))) diff --git a/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp b/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp index dbcb3170cb18..ce1b8d295f85 100644 --- a/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp +++ b/security/manager/ssl/tests/gtest/DeserializeCertTest.cpp @@ -74,8 +74,7 @@ void deserializeAndVerify(const nsCString &serializedSecInfo, } } -TEST(psm_DeserializeCert, gecko33) -{ +TEST(psm_DeserializeCert, gecko33) { // clang-format off // Gecko 33+ vintage Security info serialized with UUIDs: // - nsISupports 00000000-0000-0000-c000-000000000046 @@ -109,8 +108,7 @@ TEST(psm_DeserializeCert, gecko33) deserializeAndVerify(base64Serialization, false); } -TEST(psm_DeserializeCert, gecko46) -{ +TEST(psm_DeserializeCert, gecko46) { // clang-format off // Gecko 46+ vintage Security info serialized with UUIDs: // - nsISupports 00000000-0000-0000-c000-000000000046 @@ -144,8 +142,7 @@ TEST(psm_DeserializeCert, gecko46) deserializeAndVerify(base64Serialization, false); } -TEST(psm_DeserializeCert, preSSLStatusConsolidation) -{ +TEST(psm_DeserializeCert, preSSLStatusConsolidation) { // clang-format off // Generated using serialized output of test "good.include-subdomains.pinning.example.com" // in security/manager/ssl/tests/unit/test_cert_chains.js @@ -193,8 +190,7 @@ TEST(psm_DeserializeCert, preSSLStatusConsolidation) deserializeAndVerify(base64Serialization, false); } -TEST(psm_DeserializeCert, preSSLStatusConsolidationFailedCertChain) -{ +TEST(psm_DeserializeCert, preSSLStatusConsolidationFailedCertChain) { // clang-format off // Generated using serialized output of test "expired.example.com" // in security/manager/ssl/tests/unit/test_cert_chains.js diff --git a/security/sandbox/linux/gtest/TestBroker.cpp b/security/sandbox/linux/gtest/TestBroker.cpp index 4f4102c621ea..e44f23eadcf7 100644 --- a/security/sandbox/linux/gtest/TestBroker.cpp +++ b/security/sandbox/linux/gtest/TestBroker.cpp @@ -423,8 +423,7 @@ void SandboxBrokerTest::MultiThreadStatWorker() { ASSERT_EQ(0, statsyscall("/dev/null", &nullStat)) << "Shouldn't ever fail!"; ASSERT_EQ(0, statsyscall("/dev/zero", &zeroStat)) << "Shouldn't ever fail!"; ASSERT_EQ(0, lstatsyscall("/proc/self", &selfStat)) << "Shouldn't ever fail!"; - ASSERT_TRUE(S_ISLNK(selfStat.st_mode)) - << "Shouldn't ever fail!"; + ASSERT_TRUE(S_ISLNK(selfStat.st_mode)) << "Shouldn't ever fail!"; realNullDev = nullStat.st_rdev; realZeroDev = zeroStat.st_rdev; realSelfInode = selfStat.st_ino; @@ -440,8 +439,7 @@ void SandboxBrokerTest::MultiThreadStatWorker() { << "Loop " << i << "/" << kNumLoops; ASSERT_EQ(realZeroDev, zeroStat.st_rdev) << "Loop " << i << "/" << kNumLoops; - ASSERT_TRUE(S_ISLNK(selfStat.st_mode)) - << "Loop " << i << "/" << kNumLoops; + ASSERT_TRUE(S_ISLNK(selfStat.st_mode)) << "Loop " << i << "/" << kNumLoops; ASSERT_EQ(realSelfInode, selfStat.st_ino) << "Loop " << i << "/" << kNumLoops; } diff --git a/security/sandbox/linux/gtest/TestBrokerPolicy.cpp b/security/sandbox/linux/gtest/TestBrokerPolicy.cpp index d881e6d290ab..02344121ddac 100644 --- a/security/sandbox/linux/gtest/TestBrokerPolicy.cpp +++ b/security/sandbox/linux/gtest/TestBrokerPolicy.cpp @@ -17,8 +17,7 @@ static const int MAY_WRITE = SandboxBroker::MAY_WRITE; // static const int RECURSIVE = SandboxBroker::RECURSIVE; static const auto AddAlways = SandboxBroker::Policy::AddAlways; -TEST(SandboxBrokerPolicyLookup, Simple) -{ +TEST(SandboxBrokerPolicyLookup, Simple) { SandboxBroker::Policy p; p.AddPath(MAY_READ, "/dev/urandom", AddAlways); @@ -28,8 +27,7 @@ TEST(SandboxBrokerPolicyLookup, Simple) EXPECT_EQ(0, p.Lookup("/etc/passwd")) << "Non-added path was found."; } -TEST(SandboxBrokerPolicyLookup, CopyCtor) -{ +TEST(SandboxBrokerPolicyLookup, CopyCtor) { SandboxBroker::Policy psrc; psrc.AddPath(MAY_READ | MAY_WRITE, "/dev/null", AddAlways); SandboxBroker::Policy pdst(psrc); @@ -57,8 +55,7 @@ TEST(SandboxBrokerPolicyLookup, CopyCtor) << "Non-added path is present in copy source."; } -TEST(SandboxBrokerPolicyLookup, Recursive) -{ +TEST(SandboxBrokerPolicyLookup, Recursive) { SandboxBroker::Policy psrc; psrc.AddPath(MAY_READ | MAY_WRITE, "/dev/null", AddAlways); psrc.AddPath(MAY_READ, "/dev/zero", AddAlways); diff --git a/security/sandbox/mac/Sandbox.mm b/security/sandbox/mac/Sandbox.mm index dbb5eaeb5bfb..fea5f0e0ff67 100644 --- a/security/sandbox/mac/Sandbox.mm +++ b/security/sandbox/mac/Sandbox.mm @@ -24,6 +24,7 @@ #include "SandboxPolicyGMP.h" #include "SandboxPolicyUtility.h" + // XXX There are currently problems with the /usr/include/sandbox.h file on // some/all of the Macs in Mozilla's build system. Further, // sandbox_init_with_parameters is not included in the header. For the time diff --git a/storage/test/gtest/test_AsXXX_helpers.cpp b/storage/test/gtest/test_AsXXX_helpers.cpp index 4fef8693a947..eed0b1b62318 100644 --- a/storage/test/gtest/test_AsXXX_helpers.cpp +++ b/storage/test/gtest/test_AsXXX_helpers.cpp @@ -50,8 +50,7 @@ Spinner::HandleResult(mozIStorageResultSet *aResultSet) { return NS_OK; } -TEST(storage_AsXXX_helpers, NULLFallback) -{ +TEST(storage_AsXXX_helpers, NULLFallback) { nsCOMPtr db(getMemoryDatabase()); nsCOMPtr stmt; @@ -93,8 +92,7 @@ TEST(storage_AsXXX_helpers, NULLFallback) do_check_eq(valueArray->IsNull(0), true); } -TEST(storage_AsXXX_helpers, asyncNULLFallback) -{ +TEST(storage_AsXXX_helpers, asyncNULLFallback) { nsCOMPtr db(getMemoryDatabase()); nsCOMPtr stmt; diff --git a/storage/test/gtest/test_asyncStatementExecution_transaction.cpp b/storage/test/gtest/test_asyncStatementExecution_transaction.cpp index 4d4ffe5829be..4ddc3f16e53e 100644 --- a/storage/test/gtest/test_asyncStatementExecution_transaction.cpp +++ b/storage/test/gtest/test_asyncStatementExecution_transaction.cpp @@ -80,8 +80,7 @@ void check_transaction(mozIStorageConnection *aDB, * Test that executing multiple readonly AsyncStatements doesn't create a * transaction. */ -TEST(storage_asyncStatementExecution_transaction, MultipleAsyncReadStatements) -{ +TEST(storage_asyncStatementExecution_transaction, MultipleAsyncReadStatements) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -105,8 +104,7 @@ TEST(storage_asyncStatementExecution_transaction, MultipleAsyncReadStatements) * Test that executing multiple readonly Statements doesn't create a * transaction. */ -TEST(storage_asyncStatementExecution_transaction, MultipleReadStatements) -{ +TEST(storage_asyncStatementExecution_transaction, MultipleReadStatements) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -131,8 +129,7 @@ TEST(storage_asyncStatementExecution_transaction, MultipleReadStatements) * transaction. */ TEST(storage_asyncStatementExecution_transaction, - MultipleAsyncReadWriteStatements) -{ + MultipleAsyncReadWriteStatements) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -156,8 +153,7 @@ TEST(storage_asyncStatementExecution_transaction, /** * Test that executing multiple Statements causing writes creates a transaction. */ -TEST(storage_asyncStatementExecution_transaction, MultipleReadWriteStatements) -{ +TEST(storage_asyncStatementExecution_transaction, MultipleReadWriteStatements) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -182,8 +178,8 @@ TEST(storage_asyncStatementExecution_transaction, MultipleReadWriteStatements) * Test that executing multiple AsyncStatements causing writes creates a * single transaction. */ -TEST(storage_asyncStatementExecution_transaction, MultipleAsyncWriteStatements) -{ +TEST(storage_asyncStatementExecution_transaction, + MultipleAsyncWriteStatements) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -209,8 +205,7 @@ TEST(storage_asyncStatementExecution_transaction, MultipleAsyncWriteStatements) * Test that executing multiple Statements causing writes creates a * single transaction. */ -TEST(storage_asyncStatementExecution_transaction, MultipleWriteStatements) -{ +TEST(storage_asyncStatementExecution_transaction, MultipleWriteStatements) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -236,8 +231,7 @@ TEST(storage_asyncStatementExecution_transaction, MultipleWriteStatements) * Test that executing a single read-only AsyncStatement doesn't create a * transaction. */ -TEST(storage_asyncStatementExecution_transaction, SingleAsyncReadStatement) -{ +TEST(storage_asyncStatementExecution_transaction, SingleAsyncReadStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -256,8 +250,7 @@ TEST(storage_asyncStatementExecution_transaction, SingleAsyncReadStatement) * Test that executing a single read-only Statement doesn't create a * transaction. */ -TEST(storage_asyncStatementExecution_transaction, SingleReadStatement) -{ +TEST(storage_asyncStatementExecution_transaction, SingleReadStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -276,8 +269,7 @@ TEST(storage_asyncStatementExecution_transaction, SingleReadStatement) * Test that executing a single AsyncStatement causing writes creates a * transaction. */ -TEST(storage_asyncStatementExecution_transaction, SingleAsyncWriteStatement) -{ +TEST(storage_asyncStatementExecution_transaction, SingleAsyncWriteStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -296,8 +288,7 @@ TEST(storage_asyncStatementExecution_transaction, SingleAsyncWriteStatement) /** * Test that executing a single Statement causing writes creates a transaction. */ -TEST(storage_asyncStatementExecution_transaction, SingleWriteStatement) -{ +TEST(storage_asyncStatementExecution_transaction, SingleWriteStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -318,8 +309,7 @@ TEST(storage_asyncStatementExecution_transaction, SingleWriteStatement) * doesn't create a transaction. */ TEST(storage_asyncStatementExecution_transaction, - MultipleParamsAsyncReadStatement) -{ + MultipleParamsAsyncReadStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -351,8 +341,7 @@ TEST(storage_asyncStatementExecution_transaction, * Test that executing a single read-only Statement with multiple params * doesn't create a transaction. */ -TEST(storage_asyncStatementExecution_transaction, MultipleParamsReadStatement) -{ +TEST(storage_asyncStatementExecution_transaction, MultipleParamsReadStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create statements and execute them @@ -384,8 +373,7 @@ TEST(storage_asyncStatementExecution_transaction, MultipleParamsReadStatement) * creates a transaction. */ TEST(storage_asyncStatementExecution_transaction, - MultipleParamsAsyncWriteStatement) -{ + MultipleParamsAsyncWriteStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create a table for writes @@ -425,8 +413,8 @@ TEST(storage_asyncStatementExecution_transaction, * Test that executing a single write Statement with multiple params * creates a transaction. */ -TEST(storage_asyncStatementExecution_transaction, MultipleParamsWriteStatement) -{ +TEST(storage_asyncStatementExecution_transaction, + MultipleParamsWriteStatement) { nsCOMPtr db(getMemoryDatabase()); // -- create a table for writes diff --git a/storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp b/storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp index 4bb3e6318eb8..7ad6f7161c60 100644 --- a/storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp +++ b/storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp @@ -90,8 +90,7 @@ bool UnownedCallback::sError = false; //// Tests TEST(storage_async_callbacks_with_spun_event_loops, - SpinEventsLoopInHandleResult) -{ + SpinEventsLoopInHandleResult) { nsCOMPtr db(getMemoryDatabase()); // Create a test table and populate it. @@ -121,8 +120,8 @@ TEST(storage_async_callbacks_with_spun_event_loops, spin_events_loop_until_true(&UnownedCallback::sResult); } -TEST(storage_async_callbacks_with_spun_event_loops, SpinEventsLoopInHandleError) -{ +TEST(storage_async_callbacks_with_spun_event_loops, + SpinEventsLoopInHandleError) { nsCOMPtr db(getMemoryDatabase()); // Create a test table and populate it. diff --git a/storage/test/gtest/test_binding_params.cpp b/storage/test/gtest/test_binding_params.cpp index aacdec8af585..a702808e26c9 100644 --- a/storage/test/gtest/test_binding_params.cpp +++ b/storage/test/gtest/test_binding_params.cpp @@ -15,8 +15,7 @@ using namespace mozilla; * mozIStorageStatement API. */ -TEST(storage_binding_params, ASCIIString) -{ +TEST(storage_binding_params, ASCIIString) { nsCOMPtr db(getMemoryDatabase()); // Create table with a single string column. @@ -55,8 +54,7 @@ TEST(storage_binding_params, ASCIIString) (void)db->ExecuteSimpleSQL(NS_LITERAL_CSTRING("DELETE FROM test")); } -TEST(storage_binding_params, CString) -{ +TEST(storage_binding_params, CString) { nsCOMPtr db(getMemoryDatabase()); // Create table with a single string column. @@ -99,8 +97,7 @@ TEST(storage_binding_params, CString) (void)db->ExecuteSimpleSQL(NS_LITERAL_CSTRING("DELETE FROM test")); } -TEST(storage_binding_params, UTFStrings) -{ +TEST(storage_binding_params, UTFStrings) { nsCOMPtr db(getMemoryDatabase()); // Create table with a single string column. diff --git a/storage/test/gtest/test_file_perms.cpp b/storage/test/gtest/test_file_perms.cpp index 254a69fa2c22..7e4246a66353 100644 --- a/storage/test/gtest/test_file_perms.cpp +++ b/storage/test/gtest/test_file_perms.cpp @@ -13,8 +13,7 @@ * we request they be */ -TEST(storage_file_perms, Test) -{ +TEST(storage_file_perms, Test) { nsCOMPtr db(getDatabase()); nsCOMPtr dbFile; do_check_success(db->GetDatabaseFile(getter_AddRefs(dbFile))); diff --git a/storage/test/gtest/test_mutex.cpp b/storage/test/gtest/test_mutex.cpp index 906d7c29a5d0..dbd012cccf45 100644 --- a/storage/test/gtest/test_mutex.cpp +++ b/storage/test/gtest/test_mutex.cpp @@ -15,8 +15,7 @@ using namespace mozilla::storage; * This file test our sqlite3_mutex wrapper in SQLiteMutex.h. */ -TEST(storage_mutex, AutoLock) -{ +TEST(storage_mutex, AutoLock) { int lockTypes[] = { SQLITE_MUTEX_FAST, SQLITE_MUTEX_RECURSIVE, @@ -42,8 +41,7 @@ TEST(storage_mutex, AutoLock) } } -TEST(storage_mutex, AutoUnlock) -{ +TEST(storage_mutex, AutoUnlock) { int lockTypes[] = { SQLITE_MUTEX_FAST, SQLITE_MUTEX_RECURSIVE, diff --git a/storage/test/gtest/test_service_init_background_thread.cpp b/storage/test/gtest/test_service_init_background_thread.cpp index 757d6042c613..4d94184c35ac 100644 --- a/storage/test/gtest/test_service_init_background_thread.cpp +++ b/storage/test/gtest/test_service_init_background_thread.cpp @@ -40,8 +40,7 @@ class ServiceInitializer : public mozilla::Runnable { // all non-death tests. By merely using a "DeathTest" suffix here this becomes // a death test -- even though it doesn't use any of the normal death test // features -- which ensures this is the first storage test to run. -TEST(storage_service_init_background_thread_DeathTest, Test) -{ +TEST(storage_service_init_background_thread_DeathTest, Test) { nsCOMPtr event = new ServiceInitializer(); do_check_true(event); diff --git a/storage/test/gtest/test_spinningSynchronousClose.cpp b/storage/test/gtest/test_spinningSynchronousClose.cpp index c7e0234361ae..953fef8bfdeb 100644 --- a/storage/test/gtest/test_spinningSynchronousClose.cpp +++ b/storage/test/gtest/test_spinningSynchronousClose.cpp @@ -32,8 +32,7 @@ class CompletionRunnable final : public Runnable { // Can only run in optimized builds, or it would assert. #ifndef DEBUG -TEST(storage_spinningSynchronousClose, CloseOnAsync) -{ +TEST(storage_spinningSynchronousClose, CloseOnAsync) { nsCOMPtr db(getMemoryDatabase()); // Run an async statement. nsCOMPtr stmt; @@ -52,8 +51,7 @@ TEST(storage_spinningSynchronousClose, CloseOnAsync) } #endif -TEST(storage_spinningSynchronousClose, spinningSynchronousCloseOnAsync) -{ +TEST(storage_spinningSynchronousClose, spinningSynchronousCloseOnAsync) { nsCOMPtr db(getMemoryDatabase()); // Run an async statement. nsCOMPtr stmt; diff --git a/storage/test/gtest/test_statement_scoper.cpp b/storage/test/gtest/test_statement_scoper.cpp index 903d0e0b4af2..a254975ef0df 100644 --- a/storage/test/gtest/test_statement_scoper.cpp +++ b/storage/test/gtest/test_statement_scoper.cpp @@ -12,8 +12,7 @@ * This file test our statement scoper in mozStorageHelper.h. */ -TEST(storage_statement_scoper, automatic_reset) -{ +TEST(storage_statement_scoper, automatic_reset) { nsCOMPtr db(getMemoryDatabase()); // Need to create a table to populate sqlite_master with an entry. @@ -48,8 +47,7 @@ TEST(storage_statement_scoper, automatic_reset) do_check_true(state == mozIStorageStatement::MOZ_STORAGE_STATEMENT_READY); } -TEST(storage_statement_scoper, Abandon) -{ +TEST(storage_statement_scoper, Abandon) { nsCOMPtr db(getMemoryDatabase()); // Need to create a table to populate sqlite_master with an entry. diff --git a/storage/test/gtest/test_transaction_helper.cpp b/storage/test/gtest/test_transaction_helper.cpp index 9aba19ced6b3..a3feababcefe 100644 --- a/storage/test/gtest/test_transaction_helper.cpp +++ b/storage/test/gtest/test_transaction_helper.cpp @@ -20,8 +20,7 @@ bool has_transaction(mozIStorageConnection* aDB) { * This file tests our Transaction helper in mozStorageHelper.h. */ -TEST(storage_transaction_helper, Commit) -{ +TEST(storage_transaction_helper, Commit) { nsCOMPtr db(getMemoryDatabase()); // Create a table in a transaction, call Commit, and make sure that it does @@ -40,8 +39,7 @@ TEST(storage_transaction_helper, Commit) do_check_true(exists); } -TEST(storage_transaction_helper, Rollback) -{ +TEST(storage_transaction_helper, Rollback) { nsCOMPtr db(getMemoryDatabase()); // Create a table in a transaction, call Rollback, and make sure that it does @@ -60,8 +58,7 @@ TEST(storage_transaction_helper, Rollback) do_check_false(exists); } -TEST(storage_transaction_helper, AutoCommit) -{ +TEST(storage_transaction_helper, AutoCommit) { nsCOMPtr db(getMemoryDatabase()); // Create a table in a transaction, and make sure that it exists after the @@ -79,8 +76,7 @@ TEST(storage_transaction_helper, AutoCommit) do_check_true(exists); } -TEST(storage_transaction_helper, AutoRollback) -{ +TEST(storage_transaction_helper, AutoRollback) { nsCOMPtr db(getMemoryDatabase()); // Create a table in a transaction, and make sure that it does not exists @@ -99,8 +95,7 @@ TEST(storage_transaction_helper, AutoRollback) do_check_false(exists); } -TEST(storage_transaction_helper, null_database_connection) -{ +TEST(storage_transaction_helper, null_database_connection) { // We permit the use of the Transaction helper when passing a null database // in, so we need to make sure this still works without crashing. mozStorageTransaction transaction(nullptr, false); @@ -108,8 +103,7 @@ TEST(storage_transaction_helper, null_database_connection) do_check_true(NS_SUCCEEDED(transaction.Rollback())); } -TEST(storage_transaction_helper, async_Commit) -{ +TEST(storage_transaction_helper, async_Commit) { HookSqliteMutex hook; nsCOMPtr db(getMemoryDatabase()); diff --git a/storage/test/gtest/test_true_async.cpp b/storage/test/gtest/test_true_async.cpp index 1e0c33326fe8..aa839cd8a3fe 100644 --- a/storage/test/gtest/test_true_async.cpp +++ b/storage/test/gtest/test_true_async.cpp @@ -9,8 +9,7 @@ //////////////////////////////////////////////////////////////////////////////// //// Tests -TEST(storage_true_async, TrueAsyncStatement) -{ +TEST(storage_true_async, TrueAsyncStatement) { HookSqliteMutex hook; nsCOMPtr db(getMemoryDatabase()); @@ -68,8 +67,7 @@ TEST(storage_true_async, TrueAsyncStatement) * Test that cancellation before a statement is run successfully stops the * statement from executing. */ -TEST(storage_true_async, AsyncCancellation) -{ +TEST(storage_true_async, AsyncCancellation) { HookSqliteMutex hook; nsCOMPtr db(getMemoryDatabase()); @@ -138,8 +136,7 @@ TEST(storage_true_async, AsyncCancellation) * finalization rather than trying to finalize it on the main thread * (and thereby running afoul of our mutex use detector). */ -TEST(storage_true_async, AsyncDestructorFinalizesOnAsyncThread) -{ +TEST(storage_true_async, AsyncDestructorFinalizesOnAsyncThread) { HookSqliteMutex hook; nsCOMPtr db(getMemoryDatabase()); diff --git a/storage/test/gtest/test_unlock_notify.cpp b/storage/test/gtest/test_unlock_notify.cpp index 40bcbc5b297e..a4902ff3dae8 100644 --- a/storage/test/gtest/test_unlock_notify.cpp +++ b/storage/test/gtest/test_unlock_notify.cpp @@ -222,8 +222,7 @@ void test_drop_table_does_not_loop() { tester->Shutdown(); } -TEST(storage_unlock_notify, Test) -{ +TEST(storage_unlock_notify, Test) { // These must execute in order. setup(); test_step_locked_does_not_block_main_thread(); diff --git a/testing/gtest/mozilla/MozGTestBench.h b/testing/gtest/mozilla/MozGTestBench.h index 438b977e4b69..2864ebd75a61 100644 --- a/testing/gtest/mozilla/MozGTestBench.h +++ b/testing/gtest/mozilla/MozGTestBench.h @@ -16,8 +16,7 @@ void GTestBench(const char* aSuite, const char* aName, } // namespace mozilla #define MOZ_GTEST_BENCH(suite, test, lambdaOrFunc) \ - TEST(suite, test) \ - { mozilla::GTestBench(#suite, #test, lambdaOrFunc); } + TEST(suite, test) { mozilla::GTestBench(#suite, #test, lambdaOrFunc); } #define MOZ_GTEST_BENCH_F(suite, test, lambdaOrFunc) \ TEST_F(suite, test) { mozilla::GTestBench(#suite, #test, lambdaOrFunc); } diff --git a/testing/gtest/mozilla/SanityTest.cpp b/testing/gtest/mozilla/SanityTest.cpp index 7274c43932bb..dfbe10a23245 100644 --- a/testing/gtest/mozilla/SanityTest.cpp +++ b/testing/gtest/mozilla/SanityTest.cpp @@ -10,8 +10,7 @@ using ::testing::AtLeast; // Sanity test to make sure that GTest is hooked into // the mozilla build system correctly -TEST(MozillaGTestSanity, Runs) -{ EXPECT_EQ(1, 1); } +TEST(MozillaGTestSanity, Runs) { EXPECT_EQ(1, 1); } namespace { class TestMock { public: @@ -19,8 +18,7 @@ class TestMock { MOCK_METHOD0(MockedCall, void()); }; } // namespace -TEST(MozillaGMockSanity, Runs) -{ +TEST(MozillaGMockSanity, Runs) { TestMock mockedClass; EXPECT_CALL(mockedClass, MockedCall()).Times(AtLeast(3)); diff --git a/toolkit/components/extensions/webrequest/StreamFilter.cpp b/toolkit/components/extensions/webrequest/StreamFilter.cpp index 4dba6aebf10f..861e60924af9 100644 --- a/toolkit/components/extensions/webrequest/StreamFilter.cpp +++ b/toolkit/components/extensions/webrequest/StreamFilter.cpp @@ -79,14 +79,13 @@ void StreamFilter::Connect() { RefPtr self(this); cc->SendInitStreamFilter(mChannelId, addonId) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [=](mozilla::ipc::Endpoint&& aEndpoint) { - self->FinishConnect(std::move(aEndpoint)); - }, - [=](mozilla::ipc::ResponseRejectReason&& aReason) { - self->mActor->RecvInitialized(false); - }); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [=](mozilla::ipc::Endpoint&& aEndpoint) { + self->FinishConnect(std::move(aEndpoint)); + }, + [=](mozilla::ipc::ResponseRejectReason&& aReason) { + self->mActor->RecvInitialized(false); + }); } else { mozilla::ipc::Endpoint endpoint; Unused << StreamFilterParent::Create(nullptr, mChannelId, addonId, diff --git a/toolkit/components/perfmonitoring/PerformanceMetricsCollector.cpp b/toolkit/components/perfmonitoring/PerformanceMetricsCollector.cpp index d77376e5d606..c42c70333b3e 100644 --- a/toolkit/components/perfmonitoring/PerformanceMetricsCollector.cpp +++ b/toolkit/components/perfmonitoring/PerformanceMetricsCollector.cpp @@ -259,14 +259,13 @@ PerformanceMetricsCollector::RequestMetricsInternal() { // collecting the current process PerformanceInfo PerformanceInfoPromise::All(NS_GetCurrentThread(), localPromises) - ->Then( - NS_GetCurrentThread(), __func__, - [uuid](const nsTArray aResult) { - LOG(("[%s] Local CollectPerformanceInfo promise resolved", - nsIDToCString(uuid).get())); - DataReceived(uuid, aResult); - }, - [](const nsresult aResult) {}); + ->Then(NS_GetCurrentThread(), __func__, + [uuid](const nsTArray aResult) { + LOG(("[%s] Local CollectPerformanceInfo promise resolved", + nsIDToCString(uuid).get())); + DataReceived(uuid, aResult); + }, + [](const nsresult aResult) {}); return promise; } diff --git a/toolkit/components/places/tests/gtest/places_test_harness_tail.h b/toolkit/components/places/tests/gtest/places_test_harness_tail.h index e27551f275b7..d1937adf1663 100644 --- a/toolkit/components/places/tests/gtest/places_test_harness_tail.h +++ b/toolkit/components/places/tests/gtest/places_test_harness_tail.h @@ -60,8 +60,7 @@ void disable_idle_service() { idle->SetDisabled(true); } -TEST(IHistory, Test) -{ +TEST(IHistory, Test) { RefPtr spinClose = new WaitForConnectionClosed(); // Tinderboxes are constantly on idle. Since idle tasks can interact with diff --git a/toolkit/components/places/tests/gtest/test_casing.cpp b/toolkit/components/places/tests/gtest/test_casing.cpp index 1668f2f5a6c3..8cae9ca27ae2 100644 --- a/toolkit/components/places/tests/gtest/test_casing.cpp +++ b/toolkit/components/places/tests/gtest/test_casing.cpp @@ -11,8 +11,7 @@ // only non-ASCII characters that lower-case to ASCII ones are: // * U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE // * U+212A KELVIN SIGN -TEST(MatchAutocompleteCasing, CaseAssumption) -{ +TEST(MatchAutocompleteCasing, CaseAssumption) { for (uint32_t c = 128; c < 0x110000; c++) { if (c != 304 && c != 8490) { ASSERT_GE(mozilla::unicode::GetLowercase(c), 128U); @@ -21,8 +20,7 @@ TEST(MatchAutocompleteCasing, CaseAssumption) } // Verify the assertion that all ASCII characters lower-case to ASCII. -TEST(MatchAutocompleteCasing, CaseAssumption2) -{ +TEST(MatchAutocompleteCasing, CaseAssumption2) { for (uint32_t c = 0; c < 128; c++) { ASSERT_LT(mozilla::unicode::GetLowercase(c), 128U); } diff --git a/toolkit/components/reputationservice/test/gtest/TestExecutableLists.cpp b/toolkit/components/reputationservice/test/gtest/TestExecutableLists.cpp index 2d407b0575a7..e1519183c2b8 100644 --- a/toolkit/components/reputationservice/test/gtest/TestExecutableLists.cpp +++ b/toolkit/components/reputationservice/test/gtest/TestExecutableLists.cpp @@ -291,8 +291,7 @@ static const char* const kTestFileExtensions[] = { // duplicates manually, ensures we could start doing more efficient lookups if // we felt that was necessary (e.g. if the lists get much bigger), and that it's // easy for humans to find things... -TEST(TestExecutableLists, ListsAreSorted) -{ +TEST(TestExecutableLists, ListsAreSorted) { CheckListSorted(sExecutableExts); CheckListSorted(ApplicationReputationService::kBinaryFileExtensions); CheckListSorted(ApplicationReputationService::kNonBinaryExecutables); @@ -312,16 +311,14 @@ bool _IsInList(const char* ext, const char* const _list[], const size_t len) { #define IsInList(_ext, _list) \ _IsInList(_ext, _list, mozilla::ArrayLength(_list)) -TEST(TestExecutableLists, NonBinariesInExecutablesList) -{ +TEST(TestExecutableLists, NonBinariesInExecutablesList) { for (auto nonBinary : ApplicationReputationService::kNonBinaryExecutables) { EXPECT_TRUE(IsInList(nonBinary, sExecutableExts)) << "Expected " << nonBinary << " to be part of sExecutableExts list"; } } -TEST(TestExecutableLists, AllExtensionsInTestList) -{ +TEST(TestExecutableLists, AllExtensionsInTestList) { for (auto ext : ApplicationReputationService::kBinaryFileExtensions) { EXPECT_TRUE(IsInList(ext, kTestFileExtensions)) << "Expected binary extension " << ext @@ -341,8 +338,7 @@ TEST(TestExecutableLists, AllExtensionsInTestList) } } -TEST(TestExecutableLists, TestListExtensionsExistSomewhere) -{ +TEST(TestExecutableLists, TestListExtensionsExistSomewhere) { for (auto ext : kTestFileExtensions) { EXPECT_TRUE( IsInList(ext, ApplicationReputationService::kBinaryFileExtensions) != diff --git a/toolkit/components/resistfingerprinting/tests/test_reduceprecision.cpp b/toolkit/components/resistfingerprinting/tests/test_reduceprecision.cpp index 4998cedfb6ad..6a6b10022e7e 100644 --- a/toolkit/components/resistfingerprinting/tests/test_reduceprecision.cpp +++ b/toolkit/components/resistfingerprinting/tests/test_reduceprecision.cpp @@ -79,14 +79,12 @@ void process(double clock, nsRFPService::TimeScale clockUnits, ASSERT_EQ(reduced1, reduced2); } -TEST(ResistFingerprinting, ReducePrecision_Assumptions) -{ +TEST(ResistFingerprinting, ReducePrecision_Assumptions) { ASSERT_EQ(FLT_RADIX, 2); ASSERT_EQ(DBL_MANT_DIG, 53); } -TEST(ResistFingerprinting, ReducePrecision_Reciprocal) -{ +TEST(ResistFingerprinting, ReducePrecision_Reciprocal) { bool jitterEnabled = setupJitter(false); // This one has a rounding error in the Reciprocal case: process(2064.8338460, nsRFPService::TimeScale::MicroSeconds, 20); @@ -96,8 +94,7 @@ TEST(ResistFingerprinting, ReducePrecision_Reciprocal) cleanupJitter(jitterEnabled); } -TEST(ResistFingerprinting, ReducePrecision_KnownGood) -{ +TEST(ResistFingerprinting, ReducePrecision_KnownGood) { bool jitterEnabled = setupJitter(false); process(2064.8338460, nsRFPService::TimeScale::MilliSeconds, 20); process(69027.62, nsRFPService::TimeScale::MilliSeconds, 20); @@ -105,8 +102,7 @@ TEST(ResistFingerprinting, ReducePrecision_KnownGood) cleanupJitter(jitterEnabled); } -TEST(ResistFingerprinting, ReducePrecision_KnownBad) -{ +TEST(ResistFingerprinting, ReducePrecision_KnownBad) { bool jitterEnabled = setupJitter(false); process(1054.842405, nsRFPService::TimeScale::MilliSeconds, 20); process(273.53038600000002, nsRFPService::TimeScale::MilliSeconds, 20); @@ -115,8 +111,7 @@ TEST(ResistFingerprinting, ReducePrecision_KnownBad) cleanupJitter(jitterEnabled); } -TEST(ResistFingerprinting, ReducePrecision_Edge) -{ +TEST(ResistFingerprinting, ReducePrecision_Edge) { bool jitterEnabled = setupJitter(false); process(2611.14, nsRFPService::TimeScale::MilliSeconds, 20); process(2611.16, nsRFPService::TimeScale::MilliSeconds, 20); @@ -127,8 +122,7 @@ TEST(ResistFingerprinting, ReducePrecision_Edge) cleanupJitter(jitterEnabled); } -TEST(ResistFingerprinting, ReducePrecision_Expectations) -{ +TEST(ResistFingerprinting, ReducePrecision_Expectations) { bool jitterEnabled = setupJitter(false); double result; result = nsRFPService::ReduceTimePrecisionImpl( @@ -158,8 +152,7 @@ TEST(ResistFingerprinting, ReducePrecision_Expectations) cleanupJitter(jitterEnabled); } -TEST(ResistFingerprinting, ReducePrecision_ExpectedLossOfPrecision) -{ +TEST(ResistFingerprinting, ReducePrecision_ExpectedLossOfPrecision) { bool jitterEnabled = setupJitter(false); double result; // We lose integer precision at 9007199254740992 - let's confirm that. @@ -193,8 +186,7 @@ TEST(ResistFingerprinting, ReducePrecision_ExpectedLossOfPrecision) // If you're doing logging, you really don't want to run this test. #define RUN_AGGRESSIVE false -TEST(ResistFingerprinting, ReducePrecision_Aggressive) -{ +TEST(ResistFingerprinting, ReducePrecision_Aggressive) { if (!RUN_AGGRESSIVE) { return; } @@ -248,8 +240,7 @@ TEST(ResistFingerprinting, ReducePrecision_Aggressive) cleanupJitter(jitterEnabled); } -TEST(ResistFingerprinting, ReducePrecision_JitterTestVectors) -{ +TEST(ResistFingerprinting, ReducePrecision_JitterTestVectors) { bool jitterEnabled = setupJitter(true); // clang-format off diff --git a/toolkit/components/telemetry/geckoview/gtest/TestGeckoView.cpp b/toolkit/components/telemetry/geckoview/gtest/TestGeckoView.cpp index e95f30467f95..bbf7c5cfd7f9 100644 --- a/toolkit/components/telemetry/geckoview/gtest/TestGeckoView.cpp +++ b/toolkit/components/telemetry/geckoview/gtest/TestGeckoView.cpp @@ -235,7 +235,7 @@ TEST_F(TelemetryGeckoViewFixture, ClearPersistenceFiles) { WritePersistenceFile(nsDependentCString(kSampleData)); CheckPersistenceFileExists(fileExists); ASSERT_TRUE(fileExists) - << "We should have written the test persistence file to disk"; + << "We should have written the test persistence file to disk"; // Init the persistence: this will trigger the measurements to be written // to disk off-the-main thread. @@ -270,7 +270,7 @@ TEST_F(TelemetryGeckoViewFixture, CheckDataLoadedTopic) { WritePersistenceFile(nsDependentCString(kSampleData)); CheckPersistenceFileExists(fileExists); ASSERT_TRUE(fileExists) - << "The persisted measurements must exist on the disk"; + << "The persisted measurements must exist on the disk"; // Check that the data loaded topic is triggered when the measurement file // exists. @@ -321,7 +321,7 @@ TEST_F(TelemetryGeckoViewFixture, PersistScalars) { CheckPersistenceFileExists(fileExists); ASSERT_TRUE(fileExists) - << "The persisted measurements must exist on the disk"; + << "The persisted measurements must exist on the disk"; // Clear the in-memory scalars again. They will be restored from the disk. Unused << mTelemetry->ClearScalars(); @@ -392,7 +392,7 @@ TEST_F(TelemetryGeckoViewFixture, PersistHistograms) { CheckPersistenceFileExists(fileExists); ASSERT_TRUE(fileExists) - << "The persisted measurements must exist on the disk"; + << "The persisted measurements must exist on the disk"; // Clear the in-memory histograms again. They will be restored from the disk. GetAndClearHistogram(cx.GetJSContext(), mTelemetry, @@ -496,7 +496,7 @@ TEST_F(TelemetryGeckoViewFixture, EmptyPendingOperations) { GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot); ASSERT_TRUE(scalarsSnapshot.isUndefined()) - << "Scalars snapshot should not contain any data."; + << "Scalars snapshot should not contain any data."; } TEST_F(TelemetryGeckoViewFixture, SimpleAppendOperation) { diff --git a/toolkit/components/telemetry/tests/gtest/TelemetryTestHelpers.cpp b/toolkit/components/telemetry/tests/gtest/TelemetryTestHelpers.cpp index c6e6b9c13b25..729763e3dfa6 100644 --- a/toolkit/components/telemetry/tests/gtest/TelemetryTestHelpers.cpp +++ b/toolkit/components/telemetry/tests/gtest/TelemetryTestHelpers.cpp @@ -22,13 +22,13 @@ void CheckUintScalar(const char* aName, JSContext* aCx, JS::RootedValue value(aCx); JS::RootedObject scalarObj(aCx, &aSnapshot.toObject()); ASSERT_TRUE(JS_GetProperty(aCx, scalarObj, aName, &value)) - << "The test scalar must be reported."; + << "The test scalar must be reported."; JS_GetProperty(aCx, scalarObj, aName, &value); ASSERT_TRUE(value.isInt32()) - << "The scalar value must be of the correct type."; + << "The scalar value must be of the correct type."; ASSERT_TRUE(value.toInt32() >= 0) - << "The uint scalar type must contain a value >= 0."; + << "The uint scalar type must contain a value >= 0."; ASSERT_EQ(static_cast(value.toInt32()), expectedValue) << "The scalar value must match the expected value."; } @@ -39,9 +39,9 @@ void CheckBoolScalar(const char* aName, JSContext* aCx, JS::RootedValue value(aCx); JS::RootedObject scalarObj(aCx, &aSnapshot.toObject()); ASSERT_TRUE(JS_GetProperty(aCx, scalarObj, aName, &value)) - << "The test scalar must be reported."; + << "The test scalar must be reported."; ASSERT_TRUE(value.isBoolean()) - << "The scalar value must be of the correct type."; + << "The scalar value must be of the correct type."; ASSERT_EQ(static_cast(value.toBoolean()), expectedValue) << "The scalar value must match the expected value."; } @@ -52,16 +52,15 @@ void CheckStringScalar(const char* aName, JSContext* aCx, JS::RootedValue value(aCx); JS::RootedObject scalarObj(aCx, &aSnapshot.toObject()); ASSERT_TRUE(JS_GetProperty(aCx, scalarObj, aName, &value)) - << "The test scalar must be reported."; + << "The test scalar must be reported."; ASSERT_TRUE(value.isString()) - << "The scalar value must be of the correct type."; + << "The scalar value must be of the correct type."; bool sameString; ASSERT_TRUE( JS_StringEqualsAscii(aCx, value.toString(), expectedValue, &sameString)) - << "JS String comparison failed"; - ASSERT_TRUE(sameString) - << "The scalar value must match the expected string"; + << "JS String comparison failed"; + ASSERT_TRUE(sameString) << "The scalar value must match the expected string"; } void CheckKeyedUintScalar(const char* aName, const char* aKey, JSContext* aCx, @@ -70,7 +69,7 @@ void CheckKeyedUintScalar(const char* aName, const char* aKey, JSContext* aCx, JS::RootedObject scalarObj(aCx, &aSnapshot.toObject()); // Get the aName keyed scalar object from the scalars snapshot. ASSERT_TRUE(JS_GetProperty(aCx, scalarObj, aName, &keyedScalar)) - << "The keyed scalar must be reported."; + << "The keyed scalar must be reported."; CheckUintScalar(aKey, aCx, keyedScalar, expectedValue); } @@ -81,7 +80,7 @@ void CheckKeyedBoolScalar(const char* aName, const char* aKey, JSContext* aCx, JS::RootedObject scalarObj(aCx, &aSnapshot.toObject()); // Get the aName keyed scalar object from the scalars snapshot. ASSERT_TRUE(JS_GetProperty(aCx, scalarObj, aName, &keyedScalar)) - << "The keyed scalar must be reported."; + << "The keyed scalar must be reported."; CheckBoolScalar(aKey, aCx, keyedScalar, expectedValue); } @@ -93,12 +92,12 @@ void CheckNumberOfProperties(const char* aName, JSContext* aCx, JS::RootedObject scalarObj(aCx, &aSnapshot.toObject()); // Get the aName keyed scalar object from the scalars snapshot. ASSERT_TRUE(JS_GetProperty(aCx, scalarObj, aName, &keyedScalar)) - << "The keyed scalar must be reported."; + << "The keyed scalar must be reported."; JS::RootedObject keyedScalarObj(aCx, &keyedScalar.toObject()); JS::Rooted ids(aCx, JS::IdVector(aCx)); ASSERT_TRUE(JS_Enumerate(aCx, keyedScalarObj, &ids)) - << "We must be able to get keyed scalar members."; + << "We must be able to get keyed scalar members."; ASSERT_EQ(expectedNumProperties, ids.length()) << "The scalar must report the expected number of properties."; @@ -178,8 +177,7 @@ void GetOriginSnapshot(JSContext* aCx, JS::MutableHandle aResult, nsresult rv; rv = telemetry->GetOriginSnapshot(aClear, aCx, &originSnapshot); ASSERT_EQ(rv, NS_OK) << "Snapshotting origin data must not fail."; - ASSERT_TRUE(originSnapshot.isObject()) - << "The snapshot must be an object."; + ASSERT_TRUE(originSnapshot.isObject()) << "The snapshot must be an object."; aResult.set(originSnapshot); } @@ -210,11 +208,11 @@ void GetEncodedOriginStrings(JSContext* aCx, const nsCString& encoding, JS::RootedObject prioDataObj(aCx, &snapshot.toObject()); bool isArray = false; ASSERT_TRUE(JS_IsArrayObject(aCx, prioDataObj, &isArray) && isArray) - << "The metric's origins must be in an array."; + << "The metric's origins must be in an array."; uint32_t length = 0; ASSERT_TRUE(JS_GetArrayLength(aCx, prioDataObj, &length) && length == 1) - << "Length of returned array must be 1."; + << "Length of returned array must be 1."; JS::RootedValue arrayItem(aCx); ASSERT_TRUE(JS_GetElement(aCx, prioDataObj, 0, &arrayItem)); @@ -229,8 +227,8 @@ void GetEncodedOriginStrings(JSContext* aCx, const nsCString& encoding, nsAutoJSString jsStr; ASSERT_TRUE(jsStr.init(aCx, encodingVal)); ASSERT_TRUE(NS_ConvertUTF16toUTF8(jsStr) == encoding) - << "Actual 'encoding' (" << NS_ConvertUTF16toUTF8(jsStr).get() - << ") must match expected (" << encoding.get(); + << "Actual 'encoding' (" << NS_ConvertUTF16toUTF8(jsStr).get() + << ") must match expected (" << encoding.get(); JS::RootedValue prioVal(aCx); ASSERT_TRUE(JS_GetProperty(aCx, arrayItemObj, "prio", &prioVal)); @@ -261,8 +259,7 @@ void GetEventSnapshot(JSContext* aCx, JS::MutableHandle aResult, 0 /* eventLimit */, aCx, 1 /* argc */, &eventSnapshot); ASSERT_EQ(rv, NS_OK) << "Snapshotting events must not fail."; - ASSERT_TRUE(eventSnapshot.isObject()) - << "The snapshot must be an object."; + ASSERT_TRUE(eventSnapshot.isObject()) << "The snapshot must be an object."; JS::RootedValue processEvents(aCx); JS::RootedObject eventObj(aCx, &eventSnapshot.toObject()); @@ -295,8 +292,7 @@ void GetScalarsSnapshot(bool aKeyed, JSContext* aCx, // Validate the snapshot. ASSERT_EQ(rv, NS_OK) << "Creating a snapshot of the data must not fail."; - ASSERT_TRUE(scalarsSnapshot.isObject()) - << "The snapshot must be an object."; + ASSERT_TRUE(scalarsSnapshot.isObject()) << "The snapshot must be an object."; JS::RootedValue processScalars(aCx); JS::RootedObject scalarObj(aCx, &scalarsSnapshot.toObject()); @@ -323,7 +319,7 @@ void GetAndClearHistogram(JSContext* cx, nsCOMPtr mTelemetry, JS::RootedValue rval(cx); ASSERT_TRUE(JS_CallFunctionName(cx, testHistogramObj, "clear", JS::HandleValueArray::empty(), &rval)) - << "Cannot clear histogram"; + << "Cannot clear histogram"; } void GetProperty(JSContext* cx, const char* name, JS::HandleValue valueIn, @@ -331,7 +327,7 @@ void GetProperty(JSContext* cx, const char* name, JS::HandleValue valueIn, JS::RootedValue property(cx); JS::RootedObject valueInObj(cx, &valueIn.toObject()); ASSERT_TRUE(JS_GetProperty(cx, valueInObj, name, &property)) - << "Cannot get property '" << name << "'"; + << "Cannot get property '" << name << "'"; valueOut.set(property); } @@ -340,7 +336,7 @@ void GetElement(JSContext* cx, uint32_t index, JS::HandleValue valueIn, JS::RootedValue element(cx); JS::RootedObject valueInObj(cx, &valueIn.toObject()); ASSERT_TRUE(JS_GetElement(cx, valueInObj, index, &element)) - << "Cannot get element at index '" << index << "'"; + << "Cannot get element at index '" << index << "'"; valueOut.set(element); } diff --git a/toolkit/components/telemetry/tests/gtest/TestCombinedStacks.cpp b/toolkit/components/telemetry/tests/gtest/TestCombinedStacks.cpp index 930a66e0915a..d59ea4290dad 100644 --- a/toolkit/components/telemetry/tests/gtest/TestCombinedStacks.cpp +++ b/toolkit/components/telemetry/tests/gtest/TestCombinedStacks.cpp @@ -38,7 +38,7 @@ TEST_F(TelemetryTestFixture, CombinedStacks) { ProcessedStack::Module module = stacks.GetModule(frame.mModIndex); nsPrintfCString moduleName("test%hu", frame.mModIndex); ASSERT_TRUE(module.mName.Equals(NS_ConvertUTF8toUTF16(moduleName))) - << "Module should have expected name"; + << "Module should have expected name"; } for (size_t i = 0; i < kMaxStacksKept; ++i) { diff --git a/toolkit/components/telemetry/tests/gtest/TestEvents.cpp b/toolkit/components/telemetry/tests/gtest/TestEvents.cpp index b5108ba17b5a..03314613dc82 100644 --- a/toolkit/components/telemetry/tests/gtest/TestEvents.cpp +++ b/toolkit/components/telemetry/tests/gtest/TestEvents.cpp @@ -74,50 +74,49 @@ TEST_F(TelemetryTestFixture, RecordEventNative) { ASSERT_TRUE(!EventPresent(cx.GetJSContext(), eventsSnapshot, category, method, object)) - << "Test event must not be present when recorded before enabled."; + << "Test event must not be present when recorded before enabled."; ASSERT_TRUE(EventPresent(cx.GetJSContext(), eventsSnapshot, category, method2, object)) - << "Test event must be present."; + << "Test event must be present."; ASSERT_TRUE(EventPresent(cx.GetJSContext(), eventsSnapshot, category, method, object2)) - << "Test event with value and extra must be present."; + << "Test event with value and extra must be present."; ASSERT_TRUE(EventPresent(cx.GetJSContext(), eventsSnapshot, category, method2, object2)) - << "Test event with truncated value and extra must be present."; + << "Test event with truncated value and extra must be present."; // Ensure that the truncations happened appropriately. JSContext* aCx = cx.GetJSContext(); JS::RootedObject arrayObj(aCx, &eventsSnapshot.toObject()); JS::Rooted eventRecord(aCx); ASSERT_TRUE(JS_GetElement(aCx, arrayObj, 2, &eventRecord)) - << "Must be able to get record."; + << "Must be able to get record."; JS::RootedObject recordArray(aCx, &eventRecord.toObject()); uint32_t recordLength; ASSERT_TRUE(JS_GetArrayLength(aCx, recordArray, &recordLength)) - << "Event record array must have length."; - ASSERT_TRUE(recordLength == 6) - << "Event record must have 6 elements."; + << "Event record array must have length."; + ASSERT_TRUE(recordLength == 6) << "Event record must have 6 elements."; JS::Rooted str(aCx); nsAutoJSString jsStr; // The value string is at index 4 ASSERT_TRUE(JS_GetElement(aCx, recordArray, 4, &str)) - << "Must be able to get value."; + << "Must be able to get value."; ASSERT_TRUE(jsStr.init(aCx, str)) - << "Value must be able to be init'd to a jsstring."; + << "Value must be able to be init'd to a jsstring."; ASSERT_EQ(NS_ConvertUTF16toUTF8(jsStr).Length(), (uint32_t)80) << "Value must have been truncated to 80 bytes."; // Extra is at index 5 JS::Rooted obj(aCx); ASSERT_TRUE(JS_GetElement(aCx, recordArray, 5, &obj)) - << "Must be able to get extra."; + << "Must be able to get extra."; JS::RootedObject extraObj(aCx, &obj.toObject()); JS::Rooted extraVal(aCx); ASSERT_TRUE(JS_GetProperty(aCx, extraObj, extraKey.get(), &extraVal)) - << "Must be able to get the extra key's value."; + << "Must be able to get the extra key's value."; ASSERT_TRUE(jsStr.init(aCx, extraVal)) - << "Extra must be able to be init'd to a jsstring."; + << "Extra must be able to be init'd to a jsstring."; ASSERT_EQ(NS_ConvertUTF16toUTF8(jsStr).Length(), (uint32_t)80) << "Extra must have been truncated to 80 bytes."; } diff --git a/toolkit/components/telemetry/tests/gtest/TestHistograms.cpp b/toolkit/components/telemetry/tests/gtest/TestHistograms.cpp index 0740d2578e98..3e845f046f9e 100644 --- a/toolkit/components/telemetry/tests/gtest/TestHistograms.cpp +++ b/toolkit/components/telemetry/tests/gtest/TestHistograms.cpp @@ -121,7 +121,7 @@ TEST_F(TelemetryTestFixture, TestKeyedKeysHistogram) { JS::RootedValue expectedKeyData(cx.GetJSContext()); GetProperty(cx.GetJSContext(), "testkey", histogram, &expectedKeyData); ASSERT_TRUE(!expectedKeyData.isUndefined()) - << "Cannot find the expected key in the histogram data"; + << "Cannot find the expected key in the histogram data"; JS::RootedValue sum(cx.GetJSContext()); GetProperty(cx.GetJSContext(), "sum", expectedKeyData, &sum); uint32_t uSum = 0; @@ -132,7 +132,7 @@ TEST_F(TelemetryTestFixture, TestKeyedKeysHistogram) { // Do the same for the "CommonKey" property. GetProperty(cx.GetJSContext(), "CommonKey", histogram, &expectedKeyData); ASSERT_TRUE(!expectedKeyData.isUndefined()) - << "Cannot find the expected key in the histogram data"; + << "Cannot find the expected key in the histogram data"; GetProperty(cx.GetJSContext(), "sum", expectedKeyData, &sum); JS::ToUint32(cx.GetJSContext(), sum, &uSum); ASSERT_EQ(uSum, 1U) @@ -140,7 +140,7 @@ TEST_F(TelemetryTestFixture, TestKeyedKeysHistogram) { GetProperty(cx.GetJSContext(), "not-allowed", histogram, &expectedKeyData); ASSERT_TRUE(expectedKeyData.isUndefined()) - << "Unallowed keys must not be recorded in the histogram data"; + << "Unallowed keys must not be recorded in the histogram data"; // The 'not-allowed' key accumulation for 'TELEMETRY_TESTED_KEYED_KEYS' was // attemtped twice, so we expect the count of @@ -472,7 +472,7 @@ TEST_F(TelemetryTestFixture, TestKeyedLinearHistogram_MultipleSamples) { JS::RootedValue expectedKeyData(cx.GetJSContext()); GetProperty(cx.GetJSContext(), "testkey", histogram, &expectedKeyData); ASSERT_TRUE(!expectedKeyData.isUndefined()) - << "Cannot find the expected key in the histogram data"; + << "Cannot find the expected key in the histogram data"; // Get values object from 'testkey' histogram. JS::RootedValue values(cx.GetJSContext()); @@ -542,7 +542,7 @@ TEST_F(TelemetryTestFixture, TestKeyedKeysHistogram_MultipleSamples) { JS::RootedValue testKeyData(cx.GetJSContext()); GetProperty(cx.GetJSContext(), "testkey", histogram, &testKeyData); ASSERT_TRUE(!testKeyData.isUndefined()) - << "Cannot find the key 'testkey' in the histogram data"; + << "Cannot find the key 'testkey' in the histogram data"; JS::RootedValue values(cx.GetJSContext()); GetProperty(cx.GetJSContext(), "values", testKeyData, &values); @@ -588,8 +588,8 @@ TEST_F(TelemetryTestFixture, TestKeyedKeysHistogram_MultipleSamples) { JS::RootedValue commonKeyData(cx.GetJSContext()); GetProperty(cx.GetJSContext(), "CommonKey", histogram, &commonKeyData); ASSERT_TRUE(commonKeyData.isUndefined()) - << "Found data in key 'CommonKey' even though we accumulated no data to " - "it"; + << "Found data in key 'CommonKey' even though we accumulated no data to " + "it"; // Here we check that our function does not allow accumulation into unallowed // keys. Get 'not-allowed' property from histogram and check that this also @@ -597,8 +597,8 @@ TEST_F(TelemetryTestFixture, TestKeyedKeysHistogram_MultipleSamples) { JS::RootedValue notAllowedKeyData(cx.GetJSContext()); GetProperty(cx.GetJSContext(), "not-allowed", histogram, ¬AllowedKeyData); ASSERT_TRUE(notAllowedKeyData.isUndefined()) - << "Found data in key 'not-allowed' even though accumuling data to it is " - "not allowed"; + << "Found data in key 'not-allowed' even though accumuling data to it is " + "not allowed"; // The 'not-allowed' key accumulation for 'TELEMETRY_TESTED_KEYED_KEYS' was // attemtped once, so we expect the count of diff --git a/toolkit/components/telemetry/tests/gtest/TestOrigins.cpp b/toolkit/components/telemetry/tests/gtest/TestOrigins.cpp index 8c0ce2c551bc..1b561e212c25 100644 --- a/toolkit/components/telemetry/tests/gtest/TestOrigins.cpp +++ b/toolkit/components/telemetry/tests/gtest/TestOrigins.cpp @@ -41,13 +41,13 @@ TEST_F(TelemetryTestFixture, RecordOrigin) { JS::RootedValue origins(aCx); JS::RootedObject snapshotObj(aCx, &originSnapshot.toObject()); ASSERT_TRUE(JS_GetProperty(aCx, snapshotObj, telemetryTest1.get(), &origins)) - << "telemetry.test_test1 must be in the snapshot."; + << "telemetry.test_test1 must be in the snapshot."; JS::RootedObject originsObj(aCx, &origins.toObject()); JS::RootedValue count(aCx); ASSERT_TRUE(JS_GetProperty(aCx, originsObj, doubleclick.get(), &count)); ASSERT_TRUE(count.isInt32() && count.toInt32() == 1) - << "Must have recorded the origin exactly once."; + << "Must have recorded the origin exactly once."; // Now test that the snapshot didn't clear things out. GetOriginSnapshot(aCx, &originSnapshot); @@ -79,13 +79,13 @@ TEST_F(TelemetryTestFixture, RecordOriginTwiceAndClear) { JS::RootedValue origins(aCx); JS::RootedObject snapshotObj(aCx, &originSnapshot.toObject()); ASSERT_TRUE(JS_GetProperty(aCx, snapshotObj, telemetryTest1.get(), &origins)) - << "telemetry.test_test1 must be in the snapshot."; + << "telemetry.test_test1 must be in the snapshot."; JS::RootedObject originsObj(aCx, &origins.toObject()); JS::RootedValue count(aCx); ASSERT_TRUE(JS_GetProperty(aCx, originsObj, doubleclick.get(), &count)); ASSERT_TRUE(count.isInt32() && count.toInt32() == 2) - << "Must have recorded the origin exactly twice."; + << "Must have recorded the origin exactly twice."; // Now check that snapshotting with clear actually cleared it. GetOriginSnapshot(aCx, &originSnapshot); @@ -117,13 +117,13 @@ TEST_F(TelemetryTestFixture, RecordUnknownOrigin) { JS::RootedValue origins(aCx); JS::RootedObject snapshotObj(aCx, &originSnapshot.toObject()); ASSERT_TRUE(JS_GetProperty(aCx, snapshotObj, telemetryTest1.get(), &origins)) - << "telemetry.test_test1 must be in the snapshot."; + << "telemetry.test_test1 must be in the snapshot."; JS::RootedObject originsObj(aCx, &origins.toObject()); JS::RootedValue count(aCx); ASSERT_TRUE(JS_GetProperty(aCx, originsObj, "__UNKNOWN__", &count)); ASSERT_TRUE(count.isInt32() && count.toInt32() == 1) - << "Must have recorded the unknown origin exactly once."; + << "Must have recorded the unknown origin exactly once."; // Record a second, different unknown origin and ensure only one is stored. Telemetry::RecordOrigin(OriginMetricID::TelemetryTest_Test1, unknown2); @@ -135,13 +135,13 @@ TEST_F(TelemetryTestFixture, RecordUnknownOrigin) { JS::RootedObject snapshotObj2(aCx, &originSnapshot.toObject()); ASSERT_TRUE(JS_GetProperty(aCx, snapshotObj2, telemetryTest1.get(), &origins)) - << "telemetry.test_test1 must be in the snapshot."; + << "telemetry.test_test1 must be in the snapshot."; JS::RootedObject originsObj2(aCx, &origins.toObject()); JS::RootedValue count2(aCx); ASSERT_TRUE(JS_GetProperty(aCx, originsObj2, "__UNKNOWN__", &count2)); ASSERT_TRUE(count2.isInt32() && count2.toInt32() == 1) - << "Must have recorded the unknown origin exactly once."; + << "Must have recorded the unknown origin exactly once."; } TEST_F(TelemetryTestFixture, EncodedSnapshot) { @@ -176,13 +176,13 @@ TEST_F(TelemetryTestFixture, EncodedSnapshot) { secondAStr, secondBStr); ASSERT_TRUE(aStr != secondAStr) - << "aStr (" << NS_ConvertUTF16toUTF8(aStr).get() - << ") must not equal secondAStr (" << NS_ConvertUTF16toUTF8(secondAStr).get() - << ")"; + << "aStr (" << NS_ConvertUTF16toUTF8(aStr).get() + << ") must not equal secondAStr (" + << NS_ConvertUTF16toUTF8(secondAStr).get() << ")"; ASSERT_TRUE(bStr != secondBStr) - << "bStr (" << NS_ConvertUTF16toUTF8(bStr).get() - << ") must not equal secondBStr (" << NS_ConvertUTF16toUTF8(secondBStr).get() - << ")"; + << "bStr (" << NS_ConvertUTF16toUTF8(bStr).get() + << ") must not equal secondBStr (" + << NS_ConvertUTF16toUTF8(secondBStr).get() << ")"; } class MockObserver final : public nsIObserver { diff --git a/toolkit/components/telemetry/tests/gtest/TestScalars.cpp b/toolkit/components/telemetry/tests/gtest/TestScalars.cpp index f2c94dbe5691..460feabba02e 100644 --- a/toolkit/components/telemetry/tests/gtest/TestScalars.cpp +++ b/toolkit/components/telemetry/tests/gtest/TestScalars.cpp @@ -259,8 +259,7 @@ TEST_F(TelemetryTestFixture, ScalarUnknownID) { // Make sure that nothing was recorded in the plain scalars. JS::RootedValue scalarsSnapshot(cx.GetJSContext()); GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot); - ASSERT_TRUE(scalarsSnapshot.isUndefined()) - << "No scalar must be recorded"; + ASSERT_TRUE(scalarsSnapshot.isUndefined()) << "No scalar must be recorded"; // Same for the keyed scalars. Telemetry::ScalarSet(scalarId, NS_LITERAL_STRING("key1"), @@ -273,7 +272,7 @@ TEST_F(TelemetryTestFixture, ScalarUnknownID) { JS::RootedValue keyedSnapshot(cx.GetJSContext()); GetScalarsSnapshot(true, cx.GetJSContext(), &keyedSnapshot); ASSERT_TRUE(keyedSnapshot.isUndefined()) - << "No keyed scalar must be recorded"; + << "No keyed scalar must be recorded"; } #endif } diff --git a/toolkit/components/url-classifier/tests/gtest/TestCaching.cpp b/toolkit/components/url-classifier/tests/gtest/TestCaching.cpp index 2a259e7fdd36..6dfc7bd24df8 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestCaching.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestCaching.cpp @@ -96,24 +96,21 @@ void TestCache(const _Fragment& aFragment, bool aExpectedHas, // This testcase check the returned result of |Has| API if fullhash cannot match // any prefix in the local database. -TEST(UrlClassifierCaching, NotFound) -{ +TEST(UrlClassifierCaching, NotFound) { TestCache(_Fragment("nomatch.com/"), false, false, false); TestCache(_Fragment("nomatch.com/"), false, false, false); } // This testcase check the returned result of |Has| API if fullhash find a match // in the local database but not in the cache. -TEST(UrlClassifierCaching, NotInCache) -{ +TEST(UrlClassifierCaching, NotInCache) { TestCache(_Fragment("gound.com/"), true, false, false); TestCache(_Fragment("gound.com/"), true, false, false); } // This testcase check the returned result of |Has| API if fullhash matches // a cache entry in positive cache. -TEST(UrlClassifierCaching, InPositiveCacheNotExpired) -{ +TEST(UrlClassifierCaching, InPositiveCacheNotExpired) { TestCache(_Fragment("cache.notexpired.com/"), true, true, true); TestCache(_Fragment("cache.notexpired.com/"), true, true, @@ -122,16 +119,14 @@ TEST(UrlClassifierCaching, InPositiveCacheNotExpired) // This testcase check the returned result of |Has| API if fullhash matches // a cache entry in positive cache but that it is expired. -TEST(UrlClassifierCaching, InPositiveCacheExpired) -{ +TEST(UrlClassifierCaching, InPositiveCacheExpired) { TestCache(_Fragment("cache.expired.com/"), true, false, true); TestCache(_Fragment("cache.expired.com/"), true, false, true); } // This testcase check the returned result of |Has| API if fullhash matches // a cache entry in negative cache. -TEST(UrlClassifierCaching, InNegativeCacheNotExpired) -{ +TEST(UrlClassifierCaching, InNegativeCacheNotExpired) { // Create a fullhash whose prefix matches the prefix in negative cache // but completion doesn't match any fullhash in positive cache. @@ -153,8 +148,7 @@ TEST(UrlClassifierCaching, InNegativeCacheNotExpired) // This testcase check the returned result of |Has| API if fullhash matches // a cache entry in negative cache but that entry is expired. -TEST(UrlClassifierCaching, InNegativeCacheExpired) -{ +TEST(UrlClassifierCaching, InNegativeCacheExpired) { // Create a fullhash whose prefix is in the cache. Completion prefix; @@ -215,17 +209,18 @@ void TestInvalidateExpiredCacheEntry() { TestCache(POS_CACHE_EXPIRED_URL, true, false, true, cache.get()); } -TEST(UrlClassifierCaching, InvalidateExpiredCacheEntryV2) -{ TestInvalidateExpiredCacheEntry(); } +TEST(UrlClassifierCaching, InvalidateExpiredCacheEntryV2) { + TestInvalidateExpiredCacheEntry(); +} -TEST(UrlClassifierCaching, InvalidateExpiredCacheEntryV4) -{ TestInvalidateExpiredCacheEntry(); } +TEST(UrlClassifierCaching, InvalidateExpiredCacheEntryV4) { + TestInvalidateExpiredCacheEntry(); +} // This testcase check if an cache entry whose negative cache time is expired // and it doesn't have any postive cache entries in it, it should be removed // from cache after calling |Has|. -TEST(UrlClassifierCaching, NegativeCacheExpireV2) -{ +TEST(UrlClassifierCaching, NegativeCacheExpireV2) { _PrefixArray array = {GeneratePrefix(NEG_CACHE_EXPIRED_URL, 8)}; RefPtr cache = SetupLookupCache(array); @@ -247,8 +242,7 @@ TEST(UrlClassifierCaching, NegativeCacheExpireV2) cache.get()); } -TEST(UrlClassifierCaching, NegativeCacheExpireV4) -{ +TEST(UrlClassifierCaching, NegativeCacheExpireV4) { _PrefixArray array = {GeneratePrefix(NEG_CACHE_EXPIRED_URL, 8)}; RefPtr cache = SetupLookupCache(array); diff --git a/toolkit/components/url-classifier/tests/gtest/TestChunkSet.cpp b/toolkit/components/url-classifier/tests/gtest/TestChunkSet.cpp index 8a10c97692f6..c8da973edb23 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestChunkSet.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestChunkSet.cpp @@ -11,8 +11,7 @@ #include "ChunkSet.h" #include "mozilla/ArrayUtils.h" -TEST(UrlClassifierChunkSet, Empty) -{ +TEST(UrlClassifierChunkSet, Empty) { mozilla::safebrowsing::ChunkSet chunkSet; mozilla::safebrowsing::ChunkSet removeSet; @@ -32,8 +31,7 @@ TEST(UrlClassifierChunkSet, Empty) ASSERT_TRUE(chunkSet.Length() == 0); } -TEST(UrlClassifierChunkSet, Main) -{ +TEST(UrlClassifierChunkSet, Main) { static int testVals[] = {2, 1, 5, 6, 8, 7, 14, 10, 12, 13}; mozilla::safebrowsing::ChunkSet chunkSet; @@ -54,8 +52,7 @@ TEST(UrlClassifierChunkSet, Main) ASSERT_TRUE(chunkSet.Length() == MOZ_ARRAY_LENGTH(testVals)); } -TEST(UrlClassifierChunkSet, Merge) -{ +TEST(UrlClassifierChunkSet, Merge) { static int testVals[] = {2, 1, 5, 6, 8, 7, 14, 10, 12, 13}; static int mergeVals[] = {9, 3, 4, 20, 14, 16}; @@ -90,8 +87,7 @@ TEST(UrlClassifierChunkSet, Merge) ASSERT_FALSE(chunkSet.Has(19)); } -TEST(UrlClassifierChunkSet, Merge2) -{ +TEST(UrlClassifierChunkSet, Merge2) { static int testVals[] = {2, 1, 5, 6, 8, 7, 14, 10, 12, 13}; static int mergeVals[] = {9, 3, 4, 20, 14, 16}; static int mergeVals2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; @@ -130,8 +126,7 @@ TEST(UrlClassifierChunkSet, Merge2) ASSERT_FALSE(chunkSet.Has(19)); } -TEST(UrlClassifierChunkSet, Stress) -{ +TEST(UrlClassifierChunkSet, Stress) { mozilla::safebrowsing::ChunkSet chunkSet; mozilla::safebrowsing::ChunkSet mergeSet; std::set refSet; @@ -215,8 +210,7 @@ TEST(UrlClassifierChunkSet, Stress) } } -TEST(UrlClassifierChunkSet, RemoveClear) -{ +TEST(UrlClassifierChunkSet, RemoveClear) { static int testVals[] = {2, 1, 5, 6, 8, 7, 14, 10, 12, 13}; static int mergeVals[] = {3, 4, 9, 16, 20}; @@ -250,8 +244,7 @@ TEST(UrlClassifierChunkSet, RemoveClear) } } -TEST(UrlClassifierChunkSet, Serialize) -{ +TEST(UrlClassifierChunkSet, Serialize) { static int testVals[] = {2, 1, 5, 6, 8, 7, 14, 10, 12, 13}; static int mergeVals[] = {3, 4, 9, 16, 20}; diff --git a/toolkit/components/url-classifier/tests/gtest/TestClassifier.cpp b/toolkit/components/url-classifier/tests/gtest/TestClassifier.cpp index 2d1985399043..fb371ed9ba2d 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestClassifier.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestClassifier.cpp @@ -93,8 +93,7 @@ static void TestReadNoiseEntries(RefPtr classifier, } } -TEST(UrlClassifier, ReadNoiseEntriesV4) -{ +TEST(UrlClassifier, ReadNoiseEntriesV4) { RefPtr classifier = GetClassifier(); _PrefixArray array = { GeneratePrefix(_Fragment("bravo.com/"), 5), @@ -115,8 +114,7 @@ TEST(UrlClassifier, ReadNoiseEntriesV4) _Fragment("gound.com/")); } -TEST(UrlClassifier, ReadNoiseEntriesV2) -{ +TEST(UrlClassifier, ReadNoiseEntriesV2) { RefPtr classifier = GetClassifier(); _PrefixArray array = { GeneratePrefix(_Fragment("helloworld.com/"), 4), diff --git a/toolkit/components/url-classifier/tests/gtest/TestFailUpdate.cpp b/toolkit/components/url-classifier/tests/gtest/TestFailUpdate.cpp index 59cc40c0aa70..db8bbb40f730 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestFailUpdate.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestFailUpdate.cpp @@ -32,8 +32,7 @@ void CheckFileExist(const char* table, const T (&files)[N], bool expectExists) { } } -TEST(UrlClassifierFailUpdate, CheckTableReset) -{ +TEST(UrlClassifierFailUpdate, CheckTableReset) { const bool FULL_UPDATE = true; const bool PARTIAL_UPDATE = false; diff --git a/toolkit/components/url-classifier/tests/gtest/TestFindFullHash.cpp b/toolkit/components/url-classifier/tests/gtest/TestFindFullHash.cpp index 2aec10c510f3..4a7712c1bafb 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestFindFullHash.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestFindFullHash.cpp @@ -36,8 +36,7 @@ Base64EncodedStringArray MakeBase64EncodedStringArray(nsCString (&aArray)[N]) { } // end of unnamed namespace. -TEST(UrlClassifierFindFullHash, Request) -{ +TEST(UrlClassifierFindFullHash, Request) { nsUrlClassifierUtils* urlUtil = nsUrlClassifierUtils::GetInstance(); const char* listNames[] = {"test-phish-proto", "test-unwanted-proto"}; @@ -189,8 +188,7 @@ NS_IMPL_ISUPPORTS(MyParseCallback, nsIUrlClassifierParseFindFullHashCallback) } // end of unnamed namespace. -TEST(UrlClassifierFindFullHash, ParseRequest) -{ +TEST(UrlClassifierFindFullHash, ParseRequest) { // Build response. FindFullHashesResponse r; diff --git a/toolkit/components/url-classifier/tests/gtest/TestLookupCacheV4.cpp b/toolkit/components/url-classifier/tests/gtest/TestLookupCacheV4.cpp index 602bd0a6603c..837e2873859b 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestLookupCacheV4.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestLookupCacheV4.cpp @@ -32,18 +32,20 @@ void TestHasPrefix(const _Fragment& aFragment, bool aExpectedHas, }); } -TEST(UrlClassifierLookupCacheV4, HasComplete) -{ TestHasPrefix(_Fragment("bravo.com/"), true, true); } +TEST(UrlClassifierLookupCacheV4, HasComplete) { + TestHasPrefix(_Fragment("bravo.com/"), true, true); +} -TEST(UrlClassifierLookupCacheV4, HasPrefix) -{ TestHasPrefix(_Fragment("browsing.com/"), true, false); } +TEST(UrlClassifierLookupCacheV4, HasPrefix) { + TestHasPrefix(_Fragment("browsing.com/"), true, false); +} -TEST(UrlClassifierLookupCacheV4, Nomatch) -{ TestHasPrefix(_Fragment("nomatch.com/"), false, false); } +TEST(UrlClassifierLookupCacheV4, Nomatch) { + TestHasPrefix(_Fragment("nomatch.com/"), false, false); +} // Test an existing .pset should be removed after .vlpset is written -TEST(UrlClassifierLookupCacheV4, RemoveOldPset) -{ +TEST(UrlClassifierLookupCacheV4, RemoveOldPset) { nsCOMPtr oldPsetFile; NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(oldPsetFile)); @@ -88,8 +90,7 @@ TEST(UrlClassifierLookupCacheV4, RemoveOldPset) } // Test the legacy load -TEST(UrlClassifierLookupCacheV4, LoadOldPset) -{ +TEST(UrlClassifierLookupCacheV4, LoadOldPset) { nsCOMPtr oldPsetFile; _PrefixArray array = {GeneratePrefix(_Fragment("entry.com/"), 4)}; diff --git a/toolkit/components/url-classifier/tests/gtest/TestPerProviderDirectory.cpp b/toolkit/components/url-classifier/tests/gtest/TestPerProviderDirectory.cpp index c3f9553a35f7..48b3bbb52211 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestPerProviderDirectory.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestPerProviderDirectory.cpp @@ -58,8 +58,7 @@ void VerifyPrivateStorePath(T* target, const nsCString& aTableName, ASSERT_TRUE(privateStorePath == expectedPrivateStorePath); } -TEST(UrlClassifierPerProviderDirectory, LookupCache) -{ +TEST(UrlClassifierPerProviderDirectory, LookupCache) { RunTestInNewThread([]() -> void { nsCOMPtr rootDir; NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(rootDir)); @@ -92,8 +91,7 @@ TEST(UrlClassifierPerProviderDirectory, LookupCache) }); } -TEST(UrlClassifierPerProviderDirectory, HashStore) -{ +TEST(UrlClassifierPerProviderDirectory, HashStore) { RunTestInNewThread([]() -> void { nsCOMPtr rootDir; NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(rootDir)); diff --git a/toolkit/components/url-classifier/tests/gtest/TestProtocolParser.cpp b/toolkit/components/url-classifier/tests/gtest/TestProtocolParser.cpp index b84420e789b8..2b2a603095eb 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestProtocolParser.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestProtocolParser.cpp @@ -18,8 +18,7 @@ static bool InitUpdateResponse(ListUpdateResponse* aUpdateResponse, static void DumpBinary(const nsACString& aBinary); -TEST(UrlClassifierProtocolParser, UpdateWait) -{ +TEST(UrlClassifierProtocolParser, UpdateWait) { // Top level response which contains a list of update response // for different lists. FetchThreatListUpdatesResponse response; @@ -46,8 +45,7 @@ TEST(UrlClassifierProtocolParser, UpdateWait) delete p; } -TEST(UrlClassifierProtocolParser, SingleValueEncoding) -{ +TEST(UrlClassifierProtocolParser, SingleValueEncoding) { // Top level response which contains a list of update response // for different lists. FetchThreatListUpdatesResponse response; diff --git a/toolkit/components/url-classifier/tests/gtest/TestRiceDeltaDecoder.cpp b/toolkit/components/url-classifier/tests/gtest/TestRiceDeltaDecoder.cpp index b41080720e0f..e88377b6e29e 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestRiceDeltaDecoder.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestRiceDeltaDecoder.cpp @@ -16,8 +16,7 @@ struct TestingData { static bool runOneTest(TestingData& aData); -TEST(UrlClassifierRiceDeltaDecoder, SingleEncodedValue) -{ +TEST(UrlClassifierRiceDeltaDecoder, SingleEncodedValue) { TestingData td = {{99}, {99}, 0}; ASSERT_TRUE(runOneTest(td)); @@ -26,8 +25,7 @@ TEST(UrlClassifierRiceDeltaDecoder, SingleEncodedValue) // In this batch of tests, the encoded data would be like // what we originally receive from the network. See comment // in |runOneTest| for more detail. -TEST(UrlClassifierRiceDeltaDecoder, Empty) -{ +TEST(UrlClassifierRiceDeltaDecoder, Empty) { // The following structure and testing data is copied from Chromium source // code: // diff --git a/toolkit/components/url-classifier/tests/gtest/TestSafeBrowsingProtobuf.cpp b/toolkit/components/url-classifier/tests/gtest/TestSafeBrowsingProtobuf.cpp index e38be00fe742..cd8864e22e75 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestSafeBrowsingProtobuf.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestSafeBrowsingProtobuf.cpp @@ -1,8 +1,7 @@ #include "safebrowsing.pb.h" #include "gtest/gtest.h" -TEST(UrlClassifierProtobuf, Empty) -{ +TEST(UrlClassifierProtobuf, Empty) { using namespace mozilla::safebrowsing; const std::string CLIENT_ID = "firefox"; diff --git a/toolkit/components/url-classifier/tests/gtest/TestSafebrowsingHash.cpp b/toolkit/components/url-classifier/tests/gtest/TestSafebrowsingHash.cpp index 27eca5fd494e..f09f846111e2 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestSafebrowsingHash.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestSafebrowsingHash.cpp @@ -1,8 +1,7 @@ #include "Entries.h" #include "mozilla/EndianUtils.h" -TEST(UrlClassifierHash, ToFromUint32) -{ +TEST(UrlClassifierHash, ToFromUint32) { using namespace mozilla::safebrowsing; // typedef SafebrowsingHash Prefix; @@ -20,8 +19,7 @@ TEST(UrlClassifierHash, ToFromUint32) ASSERT_EQ(memcmp(PREFIX_RAW, p.buf, 4), 0); } -TEST(UrlClassifierHash, Compare) -{ +TEST(UrlClassifierHash, Compare) { using namespace mozilla; using namespace mozilla::safebrowsing; diff --git a/toolkit/components/url-classifier/tests/gtest/TestTable.cpp b/toolkit/components/url-classifier/tests/gtest/TestTable.cpp index bfb27bbd7293..dec4c34a0804 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestTable.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestTable.cpp @@ -8,8 +8,7 @@ void TestResponseCode(const char* table, nsresult result) { ASSERT_EQ(TablesToResponse(tableName), result); } -TEST(UrlClassifierTable, ResponseCode) -{ +TEST(UrlClassifierTable, ResponseCode) { // malware URIs. TestResponseCode("goog-malware-shavar", NS_ERROR_MALWARE_URI); TestResponseCode("test-malware-simple", NS_ERROR_MALWARE_URI); diff --git a/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierTableUpdateV4.cpp b/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierTableUpdateV4.cpp index 9f1bb2d4fa2f..cfffef4b8c44 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierTableUpdateV4.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierTableUpdateV4.cpp @@ -234,8 +234,7 @@ static void testOpenLookupCache() { } // Tests start from here. -TEST(UrlClassifierTableUpdateV4, FixLengthPSetFullUpdate) -{ +TEST(UrlClassifierTableUpdateV4, FixLengthPSetFullUpdate) { srand(time(NULL)); _PrefixArray array; @@ -251,8 +250,7 @@ TEST(UrlClassifierTableUpdateV4, FixLengthPSetFullUpdate) Clear(); } -TEST(UrlClassifierTableUpdateV4, VariableLengthPSetFullUpdate) -{ +TEST(UrlClassifierTableUpdateV4, VariableLengthPSetFullUpdate) { _PrefixArray array; PrefixStringMap map; nsCString sha256; @@ -267,8 +265,7 @@ TEST(UrlClassifierTableUpdateV4, VariableLengthPSetFullUpdate) } // This test contain both variable length prefix set and fixed-length prefix set -TEST(UrlClassifierTableUpdateV4, MixedPSetFullUpdate) -{ +TEST(UrlClassifierTableUpdateV4, MixedPSetFullUpdate) { _PrefixArray array; PrefixStringMap map; nsCString sha256; @@ -283,8 +280,7 @@ TEST(UrlClassifierTableUpdateV4, MixedPSetFullUpdate) Clear(); } -TEST(UrlClassifierTableUpdateV4, PartialUpdateWithRemoval) -{ +TEST(UrlClassifierTableUpdateV4, PartialUpdateWithRemoval) { _PrefixArray fArray; // Apply a full update first. @@ -327,8 +323,7 @@ TEST(UrlClassifierTableUpdateV4, PartialUpdateWithRemoval) Clear(); } -TEST(UrlClassifierTableUpdateV4, PartialUpdateWithoutRemoval) -{ +TEST(UrlClassifierTableUpdateV4, PartialUpdateWithoutRemoval) { _PrefixArray fArray; // Apply a full update first. @@ -368,8 +363,7 @@ TEST(UrlClassifierTableUpdateV4, PartialUpdateWithoutRemoval) // Expect failure because partial update contains prefix already // in old prefix set. -TEST(UrlClassifierTableUpdateV4, PartialUpdatePrefixAlreadyExist) -{ +TEST(UrlClassifierTableUpdateV4, PartialUpdatePrefixAlreadyExist) { _PrefixArray fArray; // Apply a full update fist. @@ -405,8 +399,7 @@ TEST(UrlClassifierTableUpdateV4, PartialUpdatePrefixAlreadyExist) } // Test apply partial update directly without applying an full update first. -TEST(UrlClassifierTableUpdateV4, OnlyPartialUpdate) -{ +TEST(UrlClassifierTableUpdateV4, OnlyPartialUpdate) { _PrefixArray pArray; PrefixStringMap pMap; nsCString sha256; @@ -422,8 +415,7 @@ TEST(UrlClassifierTableUpdateV4, OnlyPartialUpdate) } // Test partial update without any ADD prefixes, only removalIndices. -TEST(UrlClassifierTableUpdateV4, PartialUpdateOnlyRemoval) -{ +TEST(UrlClassifierTableUpdateV4, PartialUpdateOnlyRemoval) { _PrefixArray fArray; // Apply a full update first. @@ -460,8 +452,7 @@ TEST(UrlClassifierTableUpdateV4, PartialUpdateOnlyRemoval) } // Test one tableupdate array contains full update and multiple partial updates. -TEST(UrlClassifierTableUpdateV4, MultipleTableUpdates) -{ +TEST(UrlClassifierTableUpdateV4, MultipleTableUpdates) { _PrefixArray fArray, pArray, mergedArray; PrefixStringMap fMap, pMap, mergedMap; nsCString sha256; @@ -514,8 +505,7 @@ TEST(UrlClassifierTableUpdateV4, MultipleTableUpdates) // Test apply full update first, and then apply multiple partial updates // in one tableupdate array. -TEST(UrlClassifierTableUpdateV4, MultiplePartialUpdateTableUpdates) -{ +TEST(UrlClassifierTableUpdateV4, MultiplePartialUpdateTableUpdates) { _PrefixArray fArray; // Apply a full update first @@ -583,8 +573,7 @@ TEST(UrlClassifierTableUpdateV4, MultiplePartialUpdateTableUpdates) } // Test removal indices are larger than the original prefix set. -TEST(UrlClassifierTableUpdateV4, RemovalIndexTooLarge) -{ +TEST(UrlClassifierTableUpdateV4, RemovalIndexTooLarge) { _PrefixArray fArray; // Apply a full update first @@ -622,8 +611,7 @@ TEST(UrlClassifierTableUpdateV4, RemovalIndexTooLarge) Clear(); } -TEST(UrlClassifierTableUpdateV4, ChecksumMismatch) -{ +TEST(UrlClassifierTableUpdateV4, ChecksumMismatch) { // Apply a full update first { _PrefixArray fArray; @@ -659,8 +647,7 @@ TEST(UrlClassifierTableUpdateV4, ChecksumMismatch) Clear(); } -TEST(UrlClassifierTableUpdateV4, ApplyUpdateThenLoad) -{ +TEST(UrlClassifierTableUpdateV4, ApplyUpdateThenLoad) { // Apply update with sha256 { _PrefixArray fArray; @@ -696,8 +683,7 @@ TEST(UrlClassifierTableUpdateV4, ApplyUpdateThenLoad) } // This test is used to avoid an eror from nsICryptoHash -TEST(UrlClassifierTableUpdateV4, ApplyUpdateWithFixedChecksum) -{ +TEST(UrlClassifierTableUpdateV4, ApplyUpdateWithFixedChecksum) { _PrefixArray fArray = {_Prefix("enus"), _Prefix("apollo"), _Prefix("mars"), @@ -737,8 +723,7 @@ TEST(UrlClassifierTableUpdateV4, ApplyUpdateWithFixedChecksum) // This test ensure that an empty update works correctly. Empty update // should be skipped by CheckValidUpdate in Classifier::UpdateTableV4. -TEST(UrlClassifierTableUpdateV4, EmptyUpdate) -{ +TEST(UrlClassifierTableUpdateV4, EmptyUpdate) { PrefixStringMap emptyAddition; nsTArray emptyRemoval; @@ -771,8 +756,7 @@ TEST(UrlClassifierTableUpdateV4, EmptyUpdate) // This test ensure applying an empty update directly through update algorithm // should be correct. -TEST(UrlClassifierTableUpdateV4, EmptyUpdate2) -{ +TEST(UrlClassifierTableUpdateV4, EmptyUpdate2) { // Setup LookupCache with initial data _PrefixArray array; CreateRandomSortedPrefixArray(100, 4, 4, array); diff --git a/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierUtils.cpp b/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierUtils.cpp index 57f6c684bbd3..025263cc2822 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierUtils.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestUrlClassifierUtils.cpp @@ -29,8 +29,7 @@ void TestUnescapeHelper(const char* in, const char* expected) { } // Make sure Unescape from nsEncode.h's unescape does what the server does. -TEST(UrlClassifierUtils, Unescape) -{ +TEST(UrlClassifierUtils, Unescape) { // test empty string TestUnescapeHelper("\0", "\0"); @@ -81,8 +80,7 @@ void TestEncodeHelper(const char* in, const char* expected) { CheckEquals(strExp, out); } -TEST(UrlClassifierUtils, Enc) -{ +TEST(UrlClassifierUtils, Enc) { // Test empty string TestEncodeHelper("", ""); @@ -121,8 +119,7 @@ void TestCanonicalizeHelper(const char* in, const char* expected) { CheckEquals(strExp, out); } -TEST(UrlClassifierUtils, Canonicalize) -{ +TEST(UrlClassifierUtils, Canonicalize) { // Test repeated %-decoding. Note: %25 --> %, %32 --> 2, %35 --> 5 TestCanonicalizeHelper("%25", "%25"); TestCanonicalizeHelper("%25%32%35", "%25"); @@ -155,8 +152,7 @@ void TestParseIPAddressHelper(const char* in, const char* expected) { CheckEquals(strExp, out); } -TEST(UrlClassifierUtils, ParseIPAddress) -{ +TEST(UrlClassifierUtils, ParseIPAddress) { TestParseIPAddressHelper("123.123.0.0.1", ""); TestParseIPAddressHelper("255.0.0.1", "255.0.0.1"); TestParseIPAddressHelper("12.0x12.01234", "12.18.2.156"); @@ -185,8 +181,7 @@ void TestCanonicalNumHelper(const char* in, uint32_t bytes, bool allowOctal, CheckEquals(strExp, out); } -TEST(UrlClassifierUtils, CanonicalNum) -{ +TEST(UrlClassifierUtils, CanonicalNum) { TestCanonicalNumHelper("", 1, true, ""); TestCanonicalNumHelper("10", 0, true, ""); TestCanonicalNumHelper("45", 1, true, "45"); @@ -209,8 +204,7 @@ void TestHostnameHelper(const char* in, const char* expected) { CheckEquals(strExp, out); } -TEST(UrlClassifierUtils, Hostname) -{ +TEST(UrlClassifierUtils, Hostname) { TestHostnameHelper("abcd123;[]", "abcd123;[]"); TestHostnameHelper("abc.123", "abc.123"); TestHostnameHelper("abc..123", "abc.123"); @@ -233,8 +227,7 @@ TEST(UrlClassifierUtils, Hostname) TestHostnameHelper("%00", "%00"); } -TEST(UrlClassifierUtils, LongHostname) -{ +TEST(UrlClassifierUtils, LongHostname) { static const int kTestSize = 1024 * 150; char* str = static_cast(malloc(kTestSize + 1)); memset(str, 'x', kTestSize); diff --git a/toolkit/components/url-classifier/tests/gtest/TestVariableLengthPrefixSet.cpp b/toolkit/components/url-classifier/tests/gtest/TestVariableLengthPrefixSet.cpp index bb7c804c9840..1166d570f7bc 100644 --- a/toolkit/components/url-classifier/tests/gtest/TestVariableLengthPrefixSet.cpp +++ b/toolkit/components/url-classifier/tests/gtest/TestVariableLengthPrefixSet.cpp @@ -171,8 +171,7 @@ static already_AddRefed SetupLookupCache( } // Test setting prefix set with only 4-bytes prefixes -TEST(UrlClassifierVLPrefixSet, FixedLengthSet) -{ +TEST(UrlClassifierVLPrefixSet, FixedLengthSet) { srand(time(nullptr)); RefPtr cache = SetupLookupCache(NS_LITERAL_CSTRING("test")); @@ -205,8 +204,7 @@ TEST(UrlClassifierVLPrefixSet, FixedLengthSet) } // Test setting prefix set with only 5~32 bytes prefixes -TEST(UrlClassifierVLPrefixSet, VariableLengthSet) -{ +TEST(UrlClassifierVLPrefixSet, VariableLengthSet) { RefPtr cache = SetupLookupCache(NS_LITERAL_CSTRING("test")); PrefixStringMap map; @@ -242,8 +240,7 @@ TEST(UrlClassifierVLPrefixSet, VariableLengthSet) } // Test setting prefix set with both 4-bytes prefixes and 5~32 bytes prefixes -TEST(UrlClassifierVLPrefixSet, MixedPrefixSet) -{ +TEST(UrlClassifierVLPrefixSet, MixedPrefixSet) { RefPtr cache = SetupLookupCache(NS_LITERAL_CSTRING("test")); PrefixStringMap map; @@ -288,8 +285,7 @@ TEST(UrlClassifierVLPrefixSet, MixedPrefixSet) } // Test resetting prefix set -TEST(UrlClassifierVLPrefixSet, ResetPrefix) -{ +TEST(UrlClassifierVLPrefixSet, ResetPrefix) { RefPtr cache = SetupLookupCache(NS_LITERAL_CSTRING("test")); // First prefix set @@ -339,8 +335,7 @@ TEST(UrlClassifierVLPrefixSet, ResetPrefix) } // Test only set one 4-bytes prefix and one full-length prefix -TEST(UrlClassifierVLPrefixSet, TinyPrefixSet) -{ +TEST(UrlClassifierVLPrefixSet, TinyPrefixSet) { RefPtr cache = SetupLookupCache(NS_LITERAL_CSTRING("test")); PrefixStringMap map; @@ -358,8 +353,7 @@ TEST(UrlClassifierVLPrefixSet, TinyPrefixSet) } // Test empty prefix set and IsEmpty function -TEST(UrlClassifierVLPrefixSet, EmptyPrefixSet) -{ +TEST(UrlClassifierVLPrefixSet, EmptyPrefixSet) { RefPtr cache = SetupLookupCache(NS_LITERAL_CSTRING("test")); bool empty = cache->IsEmpty(); @@ -390,8 +384,7 @@ TEST(UrlClassifierVLPrefixSet, EmptyPrefixSet) } // Test prefix size should only between 4~32 bytes -TEST(UrlClassifierVLPrefixSet, MinMaxPrefixSet) -{ +TEST(UrlClassifierVLPrefixSet, MinMaxPrefixSet) { RefPtr cache = SetupLookupCache(NS_LITERAL_CSTRING("test")); PrefixStringMap map; @@ -424,8 +417,7 @@ TEST(UrlClassifierVLPrefixSet, MinMaxPrefixSet) } // Test save then load prefix set with only 4-bytes prefixes -TEST(UrlClassifierVLPrefixSet, LoadSaveFixedLengthPrefixSet) -{ +TEST(UrlClassifierVLPrefixSet, LoadSaveFixedLengthPrefixSet) { nsCOMPtr file; _PrefixArray array; PrefixStringMap map; @@ -464,8 +456,7 @@ TEST(UrlClassifierVLPrefixSet, LoadSaveFixedLengthPrefixSet) } // Test save then load prefix set with only 5~32 bytes prefixes -TEST(UrlClassifierVLPrefixSet, LoadSaveVariableLengthPrefixSet) -{ +TEST(UrlClassifierVLPrefixSet, LoadSaveVariableLengthPrefixSet) { nsCOMPtr file; _PrefixArray array; PrefixStringMap map; @@ -504,8 +495,7 @@ TEST(UrlClassifierVLPrefixSet, LoadSaveVariableLengthPrefixSet) } // Test save then load prefix with both 4 bytes prefixes and 5~32 bytes prefixes -TEST(UrlClassifierVLPrefixSet, LoadSavePrefixSet) -{ +TEST(UrlClassifierVLPrefixSet, LoadSavePrefixSet) { nsCOMPtr file; _PrefixArray array; PrefixStringMap map; @@ -546,8 +536,7 @@ TEST(UrlClassifierVLPrefixSet, LoadSavePrefixSet) } // This is for fixed-length prefixset -TEST(UrlClassifierVLPrefixSet, LoadSaveNoDelta) -{ +TEST(UrlClassifierVLPrefixSet, LoadSaveNoDelta) { nsCOMPtr file; _PrefixArray array; PrefixStringMap map; diff --git a/toolkit/crashreporter/minidump-analyzer/Win64ModuleUnwindMetadata.cpp b/toolkit/crashreporter/minidump-analyzer/Win64ModuleUnwindMetadata.cpp index 22e08ed1af5c..544a95944c8e 100644 --- a/toolkit/crashreporter/minidump-analyzer/Win64ModuleUnwindMetadata.cpp +++ b/toolkit/crashreporter/minidump-analyzer/Win64ModuleUnwindMetadata.cpp @@ -184,9 +184,7 @@ bool ModuleUnwindParser::GenerateCFIForFunction( rip_offset += 80; break; } - default: { - return false; - } + default: { return false; } } } diff --git a/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp b/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp index fad719a79b22..76544b42496f 100644 --- a/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp +++ b/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp @@ -22,14 +22,12 @@ using mozilla::UniquePtr; namespace CrashReporter { namespace { -TEST(TestCrashThreadAnnotation, TestInitShutdown) -{ +TEST(TestCrashThreadAnnotation, TestInitShutdown) { InitThreadAnnotation(); ShutdownThreadAnnotation(); } -TEST(TestCrashThreadAnnotation, TestNestedInitShutdown) -{ +TEST(TestCrashThreadAnnotation, TestNestedInitShutdown) { // No bad things should happen in case we have extra init/shutdown calls. InitThreadAnnotation(); InitThreadAnnotation(); @@ -37,32 +35,28 @@ TEST(TestCrashThreadAnnotation, TestNestedInitShutdown) ShutdownThreadAnnotation(); } -TEST(TestCrashThreadAnnotation, TestUnbalancedInit) -{ +TEST(TestCrashThreadAnnotation, TestUnbalancedInit) { // No bad things should happen in case we have unbalanced init/shutdown calls. InitThreadAnnotation(); InitThreadAnnotation(); ShutdownThreadAnnotation(); } -TEST(TestCrashThreadAnnotation, TestUnbalancedShutdown) -{ +TEST(TestCrashThreadAnnotation, TestUnbalancedShutdown) { // No bad things should happen in case we have unbalanced init/shutdown calls. InitThreadAnnotation(); ShutdownThreadAnnotation(); ShutdownThreadAnnotation(); } -TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_BeforeInit) -{ +TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_BeforeInit) { // GetFlatThreadAnnotation() should not return anything before init. std::function getThreadAnnotationCB = [&](const char* aAnnotation) -> void { ASSERT_STREQ(aAnnotation, ""); }; GetFlatThreadAnnotation(getThreadAnnotationCB); } -TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_AfterShutdown) -{ +TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_AfterShutdown) { // GetFlatThreadAnnotation() should not return anything after shutdown. InitThreadAnnotation(); ShutdownThreadAnnotation(); @@ -88,8 +82,7 @@ already_AddRefed CreateTestThread(const char* aName, return thread.forget(); } -TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_OneThread) -{ +TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_OneThread) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); @@ -116,8 +109,7 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_OneThread) thread->Shutdown(); } -TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_SetNameTwice) -{ +TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_SetNameTwice) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); @@ -157,8 +149,7 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_SetNameTwice) thread->Shutdown(); } -TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_TwoThreads) -{ +TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_TwoThreads) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); @@ -194,8 +185,7 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_TwoThreads) thread2->Shutdown(); } -TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_ShutdownOneThread) -{ +TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_ShutdownOneThread) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); @@ -233,8 +223,8 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_ShutdownOneThread) thread2->Shutdown(); } -TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_ShutdownBothThreads) -{ +TEST(TestCrashThreadAnnotation, + TestGetFlatThreadAnnotation_ShutdownBothThreads) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); @@ -273,8 +263,7 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_ShutdownBothThreads) } TEST(TestCrashThreadAnnotation, - TestGetFlatThreadAnnotation_TestNameOfBaseThread) -{ + TestGetFlatThreadAnnotation_TestNameOfBaseThread) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); @@ -301,8 +290,7 @@ TEST(TestCrashThreadAnnotation, } TEST(TestCrashThreadAnnotation, - TestGetFlatThreadAnnotation_TestShutdownBaseThread) -{ + TestGetFlatThreadAnnotation_TestShutdownBaseThread) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); @@ -330,8 +318,7 @@ TEST(TestCrashThreadAnnotation, } TEST(TestCrashThreadAnnotation, - TestGetFlatThreadAnnotation_TestShutdownBothBaseThreads) -{ + TestGetFlatThreadAnnotation_TestShutdownBothBaseThreads) { InitThreadAnnotation(); Monitor monitor("TestCrashThreadAnnotation"); diff --git a/toolkit/profile/gtest/TestProfileLock.cpp b/toolkit/profile/gtest/TestProfileLock.cpp index 918a41bf7dcc..3226c90fd476 100644 --- a/toolkit/profile/gtest/TestProfileLock.cpp +++ b/toolkit/profile/gtest/TestProfileLock.cpp @@ -11,8 +11,7 @@ #include "nsString.h" #include "nsDirectoryServiceDefs.h" -TEST(ProfileLock, BasicLock) -{ +TEST(ProfileLock, BasicLock) { char tmpExt[] = "profilebasiclocktest"; nsProfileLock myLock; diff --git a/toolkit/profile/gtest/TestProfileLockRetry.cpp b/toolkit/profile/gtest/TestProfileLockRetry.cpp index 4e2bc8d2ea38..9b01ead61e54 100644 --- a/toolkit/profile/gtest/TestProfileLockRetry.cpp +++ b/toolkit/profile/gtest/TestProfileLockRetry.cpp @@ -13,8 +13,7 @@ #include "nsProfileLock.h" #include "nsString.h" -TEST(ProfileLock, RetryLock) -{ +TEST(ProfileLock, RetryLock) { char templ[] = "/tmp/profilelocktest.XXXXXX"; char* tmpdir = mkdtemp(templ); ASSERT_NE(tmpdir, nullptr); diff --git a/toolkit/recordreplay/HashTable.cpp b/toolkit/recordreplay/HashTable.cpp index 8eefd5d1e8f6..941637e6b60f 100644 --- a/toolkit/recordreplay/HashTable.cpp +++ b/toolkit/recordreplay/HashTable.cpp @@ -396,12 +396,11 @@ static uint32_t PLHashComputeHash(void* aKey, PLHashTableInfo* aInfo) { MOZ_RELEASE_ASSERT(!aInfo->IsDestroyed()); uint32_t originalHash = aInfo->mKeyHash(aKey); HashNumber newHash; - if (aInfo->HasMatchingKey( - originalHash, - [=](const void* aExistingKey) { - return aInfo->mKeyCompare(aKey, aExistingKey); - }, - &newHash)) { + if (aInfo->HasMatchingKey(originalHash, + [=](const void* aExistingKey) { + return aInfo->mKeyCompare(aKey, aExistingKey); + }, + &newHash)) { return newHash; } return aInfo->SetLastKey(aKey); @@ -481,13 +480,12 @@ static PLDHashNumber PLDHashTableComputeHash(const void* aKey, MOZ_RELEASE_ASSERT(!aInfo->IsDestroyed()); uint32_t originalHash = aInfo->mOps->hashKey(aKey); HashNumber newHash; - if (aInfo->HasMatchingKey( - originalHash, - [=](const void* aExistingKey) { - return aInfo->mOps->matchEntry((PLDHashEntryHdr*)aExistingKey, - aKey); - }, - &newHash)) { + if (aInfo->HasMatchingKey(originalHash, + [=](const void* aExistingKey) { + return aInfo->mOps->matchEntry( + (PLDHashEntryHdr*)aExistingKey, aKey); + }, + &newHash)) { return newHash; } return aInfo->SetLastKey(aKey); diff --git a/toolkit/system/osxproxy/tests/gtest/TestProxyBypassRules.cpp b/toolkit/system/osxproxy/tests/gtest/TestProxyBypassRules.cpp index 4ca88094e454..52d9ee3c49a4 100644 --- a/toolkit/system/osxproxy/tests/gtest/TestProxyBypassRules.cpp +++ b/toolkit/system/osxproxy/tests/gtest/TestProxyBypassRules.cpp @@ -9,8 +9,7 @@ using namespace mozilla::toolkit::system; -TEST(OSXProxy, TestProxyBypassRules) -{ +TEST(OSXProxy, TestProxyBypassRules) { EXPECT_TRUE(IsHostProxyEntry(NS_LITERAL_CSTRING("mozilla.org"), NS_LITERAL_CSTRING("mozilla.org"))); EXPECT_TRUE(IsHostProxyEntry(NS_LITERAL_CSTRING("mozilla.org"), @@ -27,8 +26,7 @@ TEST(OSXProxy, TestProxyBypassRules) NS_LITERAL_CSTRING("*.mozilla.*"))); } -TEST(OSXProxy, TestProxyBypassRulesIPv4) -{ +TEST(OSXProxy, TestProxyBypassRulesIPv4) { EXPECT_TRUE(IsHostProxyEntry(NS_LITERAL_CSTRING("192.168.1.1"), NS_LITERAL_CSTRING("192.168.1.*"))); EXPECT_FALSE(IsHostProxyEntry(NS_LITERAL_CSTRING("192.168.1.1"), @@ -46,8 +44,7 @@ TEST(OSXProxy, TestProxyBypassRulesIPv4) NS_LITERAL_CSTRING("192.168.1.1/32"))); } -TEST(OSXProxy, TestProxyBypassRulesIPv6) -{ +TEST(OSXProxy, TestProxyBypassRulesIPv6) { EXPECT_TRUE(IsHostProxyEntry( NS_LITERAL_CSTRING("2001:0DB8:ABCD:0012:0123:4567:89AB:CDEF"), NS_LITERAL_CSTRING("2001:db8:abcd:0012::0/64"))); diff --git a/toolkit/system/windowsproxy/tests/gtest/TestProxyBypassRules.cpp b/toolkit/system/windowsproxy/tests/gtest/TestProxyBypassRules.cpp index 2ac193823cc8..be663ff35ae8 100644 --- a/toolkit/system/windowsproxy/tests/gtest/TestProxyBypassRules.cpp +++ b/toolkit/system/windowsproxy/tests/gtest/TestProxyBypassRules.cpp @@ -9,8 +9,7 @@ using namespace mozilla::toolkit::system; -TEST(WindowsProxy, TestProxyBypassRules) -{ +TEST(WindowsProxy, TestProxyBypassRules) { EXPECT_TRUE(IsHostProxyEntry(NS_LITERAL_CSTRING("mozilla.org"), NS_LITERAL_CSTRING("mozilla.org"))); EXPECT_TRUE(IsHostProxyEntry(NS_LITERAL_CSTRING("mozilla.org"), @@ -27,8 +26,7 @@ TEST(WindowsProxy, TestProxyBypassRules) NS_LITERAL_CSTRING("*.mozilla.*"))); } -TEST(WindowsProxy, TestProxyBypassRulesIPv4) -{ +TEST(WindowsProxy, TestProxyBypassRulesIPv4) { EXPECT_TRUE(IsHostProxyEntry(NS_LITERAL_CSTRING("192.168.1.1"), NS_LITERAL_CSTRING("192.168.1.*"))); EXPECT_FALSE(IsHostProxyEntry(NS_LITERAL_CSTRING("192.168.1.1"), @@ -46,8 +44,7 @@ TEST(WindowsProxy, TestProxyBypassRulesIPv4) NS_LITERAL_CSTRING("192.168.1.1/32"))); } -TEST(WindowsProxy, TestProxyBypassRulesIPv6) -{ +TEST(WindowsProxy, TestProxyBypassRulesIPv6) { EXPECT_TRUE(IsHostProxyEntry( NS_LITERAL_CSTRING("2001:0DB8:ABCD:0012:0123:4567:89AB:CDEF"), NS_LITERAL_CSTRING("2001:db8:abcd:0012::0/64"))); diff --git a/tools/fuzzing/interface/FuzzingInterfaceStream.h b/tools/fuzzing/interface/FuzzingInterfaceStream.h index 7cd87f54c800..64ad2a8efd28 100644 --- a/tools/fuzzing/interface/FuzzingInterfaceStream.h +++ b/tools/fuzzing/interface/FuzzingInterfaceStream.h @@ -52,8 +52,7 @@ void afl_interface_stream(const char* testFile, FuzzingTestFuncStream testFunc); std::string testFile(testFilePtr); # define MOZ_AFL_INTERFACE_STREAM(initFunc, testFunc, moduleName) \ - TEST(AFL, moduleName) \ - { \ + TEST(AFL, moduleName) { \ MOZ_AFL_INTERFACE_COMMON(initFunc); \ ::mozilla::afl_interface_stream(testFile.c_str(), testFunc); \ } diff --git a/tools/profiler/gecko/nsProfiler.cpp b/tools/profiler/gecko/nsProfiler.cpp index 70e8ca0cc0f1..a3ce6dcbf2c4 100644 --- a/tools/profiler/gecko/nsProfiler.cpp +++ b/tools/profiler/gecko/nsProfiler.cpp @@ -249,42 +249,41 @@ nsProfiler::GetProfileDataAsync(double aSinceTime, JSContext* aCx, } StartGathering(aSinceTime) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [promise](nsCString aResult) { - AutoJSAPI jsapi; - if (NS_WARN_IF(!jsapi.Init(promise->GlobalJSObject()))) { - // We're really hosed if we can't get a JS context for some - // reason. - promise->MaybeReject(NS_ERROR_DOM_UNKNOWN_ERR); - return; - } + ->Then(GetMainThreadSerialEventTarget(), __func__, + [promise](nsCString aResult) { + AutoJSAPI jsapi; + if (NS_WARN_IF(!jsapi.Init(promise->GlobalJSObject()))) { + // We're really hosed if we can't get a JS context for some + // reason. + promise->MaybeReject(NS_ERROR_DOM_UNKNOWN_ERR); + return; + } - JSContext* cx = jsapi.cx(); + JSContext* cx = jsapi.cx(); - // Now parse the JSON so that we resolve with a JS Object. - JS::RootedValue val(cx); - { - NS_ConvertUTF8toUTF16 js_string(aResult); - if (!JS_ParseJSON(cx, - static_cast(js_string.get()), - js_string.Length(), &val)) { - if (!jsapi.HasException()) { - promise->MaybeReject(NS_ERROR_DOM_UNKNOWN_ERR); - } else { - JS::RootedValue exn(cx); - DebugOnly gotException = jsapi.StealException(&exn); - MOZ_ASSERT(gotException); + // Now parse the JSON so that we resolve with a JS Object. + JS::RootedValue val(cx); + { + NS_ConvertUTF8toUTF16 js_string(aResult); + if (!JS_ParseJSON( + cx, static_cast(js_string.get()), + js_string.Length(), &val)) { + if (!jsapi.HasException()) { + promise->MaybeReject(NS_ERROR_DOM_UNKNOWN_ERR); + } else { + JS::RootedValue exn(cx); + DebugOnly gotException = jsapi.StealException(&exn); + MOZ_ASSERT(gotException); - jsapi.ClearException(); - promise->MaybeReject(cx, exn); - } - } else { - promise->MaybeResolve(val); - } - } - }, - [promise](nsresult aRv) { promise->MaybeReject(aRv); }); + jsapi.ClearException(); + promise->MaybeReject(cx, exn); + } + } else { + promise->MaybeResolve(val); + } + } + }, + [promise](nsresult aRv) { promise->MaybeReject(aRv); }); promise.forget(aPromise); return NS_OK; @@ -315,29 +314,28 @@ nsProfiler::GetProfileDataAsArrayBuffer(double aSinceTime, JSContext* aCx, } StartGathering(aSinceTime) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [promise](nsCString aResult) { - AutoJSAPI jsapi; - if (NS_WARN_IF(!jsapi.Init(promise->GlobalJSObject()))) { - // We're really hosed if we can't get a JS context for some - // reason. - promise->MaybeReject(NS_ERROR_DOM_UNKNOWN_ERR); - return; - } + ->Then(GetMainThreadSerialEventTarget(), __func__, + [promise](nsCString aResult) { + AutoJSAPI jsapi; + if (NS_WARN_IF(!jsapi.Init(promise->GlobalJSObject()))) { + // We're really hosed if we can't get a JS context for some + // reason. + promise->MaybeReject(NS_ERROR_DOM_UNKNOWN_ERR); + return; + } - JSContext* cx = jsapi.cx(); - JSObject* typedArray = dom::ArrayBuffer::Create( - cx, aResult.Length(), - reinterpret_cast(aResult.Data())); - if (typedArray) { - JS::RootedValue val(cx, JS::ObjectValue(*typedArray)); - promise->MaybeResolve(val); - } else { - promise->MaybeReject(NS_ERROR_OUT_OF_MEMORY); - } - }, - [promise](nsresult aRv) { promise->MaybeReject(aRv); }); + JSContext* cx = jsapi.cx(); + JSObject* typedArray = dom::ArrayBuffer::Create( + cx, aResult.Length(), + reinterpret_cast(aResult.Data())); + if (typedArray) { + JS::RootedValue val(cx, JS::ObjectValue(*typedArray)); + promise->MaybeResolve(val); + } else { + promise->MaybeReject(NS_ERROR_OUT_OF_MEMORY); + } + }, + [promise](nsresult aRv) { promise->MaybeReject(aRv); }); promise.forget(aPromise); return NS_OK; @@ -371,25 +369,24 @@ nsProfiler::DumpProfileToFileAsync(const nsACString& aFilename, nsCString filename(aFilename); StartGathering(aSinceTime) - ->Then( - GetMainThreadSerialEventTarget(), __func__, - [filename, promise](const nsCString& aResult) { - nsCOMPtr file = - do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); - nsresult rv = file->InitWithNativePath(filename); - if (NS_FAILED(rv)) { - MOZ_CRASH(); - } - nsCOMPtr of = - do_CreateInstance("@mozilla.org/network/file-output-stream;1"); - of->Init(file, -1, -1, 0); - uint32_t sz; - of->Write(aResult.get(), aResult.Length(), &sz); - of->Close(); + ->Then(GetMainThreadSerialEventTarget(), __func__, + [filename, promise](const nsCString& aResult) { + nsCOMPtr file = + do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); + nsresult rv = file->InitWithNativePath(filename); + if (NS_FAILED(rv)) { + MOZ_CRASH(); + } + nsCOMPtr of = do_CreateInstance( + "@mozilla.org/network/file-output-stream;1"); + of->Init(file, -1, -1, 0); + uint32_t sz; + of->Write(aResult.get(), aResult.Length(), &sz); + of->Close(); - promise->MaybeResolveWithUndefined(); - }, - [promise](nsresult aRv) { promise->MaybeReject(aRv); }); + promise->MaybeResolveWithUndefined(); + }, + [promise](nsresult aRv) { promise->MaybeReject(aRv); }); promise.forget(aPromise); return NS_OK; @@ -623,16 +620,15 @@ RefPtr nsProfiler::StartGathering( mPendingProfiles = profiles.Length(); RefPtr self = this; for (auto profile : profiles) { - profile->Then( - GetMainThreadSerialEventTarget(), __func__, - [self](mozilla::ipc::Shmem&& aResult) { - const nsDependentCSubstring profileString(aResult.get(), - aResult.Size() - 1); - self->GatheredOOPProfile(profileString); - }, - [self](ipc::ResponseRejectReason&& aReason) { - self->GatheredOOPProfile(NS_LITERAL_CSTRING("")); - }); + profile->Then(GetMainThreadSerialEventTarget(), __func__, + [self](mozilla::ipc::Shmem&& aResult) { + const nsDependentCSubstring profileString( + aResult.get(), aResult.Size() - 1); + self->GatheredOOPProfile(profileString); + }, + [self](ipc::ResponseRejectReason&& aReason) { + self->GatheredOOPProfile(NS_LITERAL_CSTRING("")); + }); } if (!mPendingProfiles) { FinishGathering(); diff --git a/tools/profiler/tests/gtest/GeckoProfiler.cpp b/tools/profiler/tests/gtest/GeckoProfiler.cpp index 2adbc137e5f3..1651b31ea2a8 100644 --- a/tools/profiler/tests/gtest/GeckoProfiler.cpp +++ b/tools/profiler/tests/gtest/GeckoProfiler.cpp @@ -77,8 +77,7 @@ static void ActiveParamsCheck(int aEntries, double aInterval, } } -TEST(GeckoProfiler, FeaturesAndParams) -{ +TEST(GeckoProfiler, FeaturesAndParams) { InactiveFeaturesAndParamsCheck(); // Try a couple of features and filters. @@ -196,8 +195,7 @@ TEST(GeckoProfiler, FeaturesAndParams) } } -TEST(GeckoProfiler, EnsureStarted) -{ +TEST(GeckoProfiler, EnsureStarted) { InactiveFeaturesAndParamsCheck(); uint32_t features = ProfilerFeature::JS | ProfilerFeature::Threads; @@ -267,8 +265,7 @@ TEST(GeckoProfiler, EnsureStarted) } } -TEST(GeckoProfiler, DifferentThreads) -{ +TEST(GeckoProfiler, DifferentThreads) { InactiveFeaturesAndParamsCheck(); nsCOMPtr thread; @@ -340,8 +337,7 @@ TEST(GeckoProfiler, DifferentThreads) thread->Shutdown(); } -TEST(GeckoProfiler, GetBacktrace) -{ +TEST(GeckoProfiler, GetBacktrace) { ASSERT_TRUE(!profiler_get_backtrace()); { @@ -387,8 +383,7 @@ TEST(GeckoProfiler, GetBacktrace) ASSERT_TRUE(!profiler_get_backtrace()); } -TEST(GeckoProfiler, Pause) -{ +TEST(GeckoProfiler, Pause) { uint32_t features = ProfilerFeature::StackWalk; const char* filters[] = {"GeckoMain"}; @@ -457,8 +452,7 @@ int GTestMarkerPayload::sNumCreated = 0; int GTestMarkerPayload::sNumStreamed = 0; int GTestMarkerPayload::sNumDestroyed = 0; -TEST(GeckoProfiler, Markers) -{ +TEST(GeckoProfiler, Markers) { uint32_t features = ProfilerFeature::StackWalk; const char* filters[] = {"GeckoMain"}; @@ -562,8 +556,7 @@ TEST(GeckoProfiler, Markers) ASSERT_TRUE(GTestMarkerPayload::sNumDestroyed == 20); } -TEST(GeckoProfiler, DurationLimit) -{ +TEST(GeckoProfiler, DurationLimit) { uint32_t features = ProfilerFeature::StackWalk; const char* filters[] = {"GeckoMain"}; @@ -599,8 +592,7 @@ TEST(GeckoProfiler, DurationLimit) PROFILER_DEFINE_COUNT_TOTAL(TestCounter, COUNTER_NAME, COUNTER_DESCRIPTION); PROFILER_DEFINE_COUNT_TOTAL(TestCounter2, COUNTER_NAME2, COUNTER_DESCRIPTION2); -TEST(GeckoProfiler, Counters) -{ +TEST(GeckoProfiler, Counters) { uint32_t features = ProfilerFeature::Threads; const char* filters[] = {"GeckoMain", "Compositor"}; @@ -641,8 +633,7 @@ TEST(GeckoProfiler, Counters) profiler_stop(); } -TEST(GeckoProfiler, Time) -{ +TEST(GeckoProfiler, Time) { uint32_t features = ProfilerFeature::StackWalk; const char* filters[] = {"GeckoMain"}; @@ -665,8 +656,7 @@ TEST(GeckoProfiler, Time) ASSERT_TRUE(t4 <= t5 && t1 <= t6); } -TEST(GeckoProfiler, GetProfile) -{ +TEST(GeckoProfiler, GetProfile) { uint32_t features = ProfilerFeature::StackWalk; const char* filters[] = {"GeckoMain"}; @@ -704,8 +694,7 @@ static void JSONOutputCheck(const char* aOutput) { ASSERT_TRUE(strstr(aOutput, "\"stringTable\"")); } -TEST(GeckoProfiler, StreamJSONForThisProcess) -{ +TEST(GeckoProfiler, StreamJSONForThisProcess) { uint32_t features = ProfilerFeature::StackWalk; const char* filters[] = {"GeckoMain"}; @@ -728,8 +717,7 @@ TEST(GeckoProfiler, StreamJSONForThisProcess) ASSERT_TRUE(!profiler_stream_json_for_this_process(w)); } -TEST(GeckoProfiler, StreamJSONForThisProcessThreaded) -{ +TEST(GeckoProfiler, StreamJSONForThisProcessThreaded) { // Same as the previous test, but calling some things on background threads. nsCOMPtr thread; nsresult rv = NS_NewNamedThread("GeckoProfGTest", getter_AddRefs(thread)); @@ -776,8 +764,7 @@ TEST(GeckoProfiler, StreamJSONForThisProcessThreaded) ASSERT_TRUE(!profiler_stream_json_for_this_process(w)); } -TEST(GeckoProfiler, ProfilingStack) -{ +TEST(GeckoProfiler, ProfilingStack) { uint32_t features = ProfilerFeature::StackWalk; const char* filters[] = {"GeckoMain"}; @@ -807,8 +794,7 @@ TEST(GeckoProfiler, ProfilingStack) ASSERT_TRUE(!profiler_get_profile()); } -TEST(GeckoProfiler, Bug1355807) -{ +TEST(GeckoProfiler, Bug1355807) { uint32_t features = ProfilerFeature::JS; const char* manyThreadsFilter[] = {""}; const char* fewThreadsFilter[] = {"GeckoMain"}; @@ -860,8 +846,7 @@ void DoSuspendAndSample(int aTid, nsIThread* aThread) { NS_DISPATCH_SYNC); } -TEST(GeckoProfiler, SuspendAndSample) -{ +TEST(GeckoProfiler, SuspendAndSample) { nsCOMPtr thread; nsresult rv = NS_NewNamedThread("GeckoProfGTest", getter_AddRefs(thread)); ASSERT_TRUE(NS_SUCCEEDED(rv)); diff --git a/tools/profiler/tests/gtest/LulTest.cpp b/tools/profiler/tests/gtest/LulTest.cpp index 94a0b2fd29c1..35f67697c855 100644 --- a/tools/profiler/tests/gtest/LulTest.cpp +++ b/tools/profiler/tests/gtest/LulTest.cpp @@ -31,8 +31,7 @@ static void gtest_logging_sink_for_LulIntegration(const char* str) { } } -TEST(LulIntegration, unwind_consistency) -{ +TEST(LulIntegration, unwind_consistency) { // Set up LUL and get it to read unwind info for libxul.so, which is // all we care about here, plus (incidentally) practically every // other object in the process too. diff --git a/tools/profiler/tests/gtest/ThreadProfileTest.cpp b/tools/profiler/tests/gtest/ThreadProfileTest.cpp index 425cd1a1efdf..ed14b620b038 100644 --- a/tools/profiler/tests/gtest/ThreadProfileTest.cpp +++ b/tools/profiler/tests/gtest/ThreadProfileTest.cpp @@ -10,8 +10,7 @@ #include "gtest/gtest.h" // Make sure we can record one entry and read it -TEST(ThreadProfile, InsertOneEntry) -{ +TEST(ThreadProfile, InsertOneEntry) { auto pb = MakeUnique(10); pb->AddEntry(ProfileBufferEntry::Time(123.1)); ASSERT_TRUE(pb->GetEntry(pb->mRangeStart).IsTime()); @@ -19,8 +18,7 @@ TEST(ThreadProfile, InsertOneEntry) } // See if we can insert some entries -TEST(ThreadProfile, InsertEntriesNoWrap) -{ +TEST(ThreadProfile, InsertEntriesNoWrap) { auto pb = MakeUnique(100); int test_size = 50; for (int i = 0; i < test_size; i++) { @@ -35,8 +33,7 @@ TEST(ThreadProfile, InsertEntriesNoWrap) } // See if evicting works as it should in the basic case -TEST(ThreadProfile, InsertEntriesWrap) -{ +TEST(ThreadProfile, InsertEntriesWrap) { int entries = 32; auto pb = MakeUnique(entries); ASSERT_TRUE(pb->mRangeStart == 0); diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 9b0ddb74e2b4..f5ad1fc59b81 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -772,14 +772,13 @@ nsresult PuppetWidget::NotifyIMEOfFocusChange( IMENotificationRequests(IMENotificationRequests::NOTIFY_ALL); RefPtr self = this; mTabChild->SendNotifyIMEFocus(mContentCache, aIMENotification) - ->Then( - mTabChild->TabGroup()->EventTargetFor(TaskCategory::UI), __func__, - [self](IMENotificationRequests&& aRequests) { - self->mIMENotificationRequestsOfParent = aRequests; - }, - [self](mozilla::ipc::ResponseRejectReason&& aReason) { - NS_WARNING("SendNotifyIMEFocus got rejected."); - }); + ->Then(mTabChild->TabGroup()->EventTargetFor(TaskCategory::UI), __func__, + [self](IMENotificationRequests&& aRequests) { + self->mIMENotificationRequestsOfParent = aRequests; + }, + [self](mozilla::ipc::ResponseRejectReason&& aReason) { + NS_WARNING("SendNotifyIMEFocus got rejected."); + }); return NS_OK; } diff --git a/widget/cocoa/nsPrintDialogX.mm b/widget/cocoa/nsPrintDialogX.mm index 7e2ab57cedcf..c7547080b04c 100644 --- a/widget/cocoa/nsPrintDialogX.mm +++ b/widget/cocoa/nsPrintDialogX.mm @@ -51,7 +51,8 @@ nsPrintDialogServiceX::Show(nsPIDOMWindowOuter* aParent, nsIPrintSettings* aSett // from prefs. Reading printer-specific prefs requires the printer // name to be set. settingsX->SetPrinterNameFromPrintInfo(); - printSettingsSvc->InitPrintSettingsFromPrefs(settingsX, true, nsIPrintSettings::kInitSaveAll); + printSettingsSvc->InitPrintSettingsFromPrefs(settingsX, true, + nsIPrintSettings::kInitSaveAll); // Set the print job title char16_t** docTitles; uint32_t titleCount; diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp index 12e38f26bf3b..f50ae4e426e9 100644 --- a/widget/gtk/nsFilePicker.cpp +++ b/widget/gtk/nsFilePicker.cpp @@ -420,15 +420,15 @@ nsFilePicker::Open(nsIFilePickerShownCallback *aCallback) { if (GTK_IS_DIALOG(file_chooser)) { GtkDialog *dialog = GTK_DIALOG(file_chooser); GtkContainer *area = GTK_CONTAINER(gtk_dialog_get_content_area(dialog)); - gtk_container_forall( - area, - [](GtkWidget *widget, gpointer data) { - if (GTK_IS_FILE_CHOOSER_WIDGET(widget)) { - auto result = static_cast(data); - *result = GTK_FILE_CHOOSER_WIDGET(widget); - } - }, - &mFileChooserDelegate); + gtk_container_forall(area, + [](GtkWidget *widget, gpointer data) { + if (GTK_IS_FILE_CHOOSER_WIDGET(widget)) { + auto result = + static_cast(data); + *result = GTK_FILE_CHOOSER_WIDGET(widget); + } + }, + &mFileChooserDelegate); if (mFileChooserDelegate != nullptr) { g_object_ref(mFileChooserDelegate); diff --git a/widget/gtk/nsNativeThemeGTK.cpp b/widget/gtk/nsNativeThemeGTK.cpp index 46fc869b5844..1ecc9f6cd81a 100644 --- a/widget/gtk/nsNativeThemeGTK.cpp +++ b/widget/gtk/nsNativeThemeGTK.cpp @@ -1355,9 +1355,7 @@ LayoutDeviceIntMargin nsNativeThemeGTK::GetWidgetBorder( // will need to fall through and use the default case as before. if (IsRegularMenuItem(aFrame)) break; MOZ_FALLTHROUGH; - default: { - GetCachedWidgetBorder(aFrame, aAppearance, direction, &result); - } + default: { GetCachedWidgetBorder(aFrame, aAppearance, direction, &result); } } gint scale = GetMonitorScaleFactor(aFrame); diff --git a/widget/windows/ToastNotificationHandler.cpp b/widget/windows/ToastNotificationHandler.cpp index e1e36d6c4003..6416021a0266 100644 --- a/widget/windows/ToastNotificationHandler.cpp +++ b/widget/windows/ToastNotificationHandler.cpp @@ -350,7 +350,8 @@ bool ToastNotificationHandler::CreateWindowsNotificationFromXml( Callback([self](IToastNotification* aNotification, IInspectable* aInspectable) { return self->OnActivate(aNotification, aInspectable); - }).Get(), + }) + .Get(), &mActivatedToken); if (NS_WARN_IF(FAILED(hr))) { return false; @@ -360,7 +361,8 @@ bool ToastNotificationHandler::CreateWindowsNotificationFromXml( Callback([self](IToastNotification* aNotification, IToastDismissedEventArgs* aArgs) { return self->OnDismiss(aNotification, aArgs); - }).Get(), + }) + .Get(), &mDismissedToken); if (NS_WARN_IF(FAILED(hr))) { return false; @@ -370,7 +372,8 @@ bool ToastNotificationHandler::CreateWindowsNotificationFromXml( Callback([self](IToastNotification* aNotification, IToastFailedEventArgs* aArgs) { return self->OnFail(aNotification, aArgs); - }).Get(), + }) + .Get(), &mFailedToken); if (NS_WARN_IF(FAILED(hr))) { return false; diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp index c942cedefa20..ec48b441d784 100644 --- a/widget/windows/nsClipboard.cpp +++ b/widget/windows/nsClipboard.cpp @@ -287,8 +287,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void** aData, nsresult result = NS_ERROR_FAILURE; if (aHGBL != nullptr) { LPSTR lpStr = (LPSTR)GlobalLock(aHGBL); - CheckedInt allocSize = - CheckedInt(GlobalSize(aHGBL)) + 3; + CheckedInt allocSize = CheckedInt(GlobalSize(aHGBL)) + 3; if (!allocSize.isValid()) { return NS_ERROR_INVALID_ARG; } diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index 05b9f0f62381..708c0174453c 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -733,9 +733,9 @@ nsresult nsSystemInfo::Init() { #ifdef XP_WIN // IsWow64Process2 is only available on Windows 10+, so we have to dynamically // check for its existence. - typedef BOOL(WINAPI * LPFN_IWP2)(HANDLE, USHORT*, USHORT*); - LPFN_IWP2 iwp2 = reinterpret_cast( - GetProcAddress(GetModuleHandle(L"kernel32"), "IsWow64Process2")); + typedef BOOL(WINAPI* LPFN_IWP2)(HANDLE, USHORT*, USHORT*); + LPFN_IWP2 iwp2 = reinterpret_cast(GetProcAddress( + GetModuleHandle(L"kernel32"), "IsWow64Process2")); BOOL isWow64 = false; USHORT processMachine = IMAGE_FILE_MACHINE_UNKNOWN; USHORT nativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; diff --git a/xpcom/ds/PLDHashTable.cpp b/xpcom/ds/PLDHashTable.cpp index 002699a9fe48..37b21f9ea2ad 100644 --- a/xpcom/ds/PLDHashTable.cpp +++ b/xpcom/ds/PLDHashTable.cpp @@ -555,12 +555,12 @@ PLDHashEntryHdr* PLDHashTable::Add(const void* aKey, // Look for entry after possibly growing, so we don't have to add it, // then skip it while growing the table and re-add it after. PLDHashNumber keyHash = ComputeKeyHash(aKey); - Slot slot = SearchTable( - aKey, keyHash, [&](Slot& found) -> Slot { return found; }, - [&]() -> Slot { - MOZ_CRASH("Nope"); - return Slot(nullptr, nullptr); - }); + Slot slot = SearchTable(aKey, keyHash, + [&](Slot& found) -> Slot { return found; }, + [&]() -> Slot { + MOZ_CRASH("Nope"); + return Slot(nullptr, nullptr); + }); if (!slot.IsLive()) { // Initialize the slot, indicating that it's no longer free. if (slot.IsRemoved()) { @@ -606,15 +606,14 @@ void PLDHashTable::Remove(const void* aKey) { } PLDHashNumber keyHash = ComputeKeyHash(aKey); - SearchTable( - aKey, keyHash, - [&](Slot& slot) { - RawRemove(slot); - ShrinkIfAppropriate(); - }, - [&]() { - // Do nothing. - }); + SearchTable(aKey, keyHash, + [&](Slot& slot) { + RawRemove(slot); + ShrinkIfAppropriate(); + }, + [&]() { + // Do nothing. + }); } void PLDHashTable::RemoveEntry(PLDHashEntryHdr* aEntry) { diff --git a/xpcom/ds/nsTArray.h b/xpcom/ds/nsTArray.h index e299fa4c9ac5..b7d371a4d18c 100644 --- a/xpcom/ds/nsTArray.h +++ b/xpcom/ds/nsTArray.h @@ -1131,8 +1131,8 @@ class nsTArray_Impl // @return true if the element was found. template bool Contains(const Item& aItem, const Comparator& aComp) const { - return ApplyIf( - aItem, 0, aComp, []() { return true; }, []() { return false; }); + return ApplyIf(aItem, 0, aComp, []() { return true; }, + []() { return false; }); } // Like Contains(), but assumes a sorted array. @@ -1513,12 +1513,11 @@ class nsTArray_Impl ::detail::CompareWrapper comp(aComp); size_t index; - BinarySearchIf( - Elements(), 0, Length(), - [&](const elem_type& aElement) { - return comp.Compare(aElement, aItem) <= 0 ? 1 : -1; - }, - &index); + BinarySearchIf(Elements(), 0, Length(), + [&](const elem_type& aElement) { + return comp.Compare(aElement, aItem) <= 0 ? 1 : -1; + }, + &index); return index; } diff --git a/xpcom/reflect/xptinfo/xptinfo.h b/xpcom/reflect/xptinfo/xptinfo.h index a9ae321f891c..555c08ad03ff 100644 --- a/xpcom/reflect/xptinfo/xptinfo.h +++ b/xpcom/reflect/xptinfo/xptinfo.h @@ -213,9 +213,7 @@ struct nsXPTType { private: // Helper for reading 16-bit data values split between mData1 and mData2. - uint16_t Data16() const { - return static_cast(mData1 << 8) | mData2; - } + uint16_t Data16() const { return static_cast(mData1 << 8) | mData2; } public: // Get the type of the element in the current array or sequence. Arrays only diff --git a/xpcom/rust/gtest/nsstring/Test.cpp b/xpcom/rust/gtest/nsstring/Test.cpp index b0adec7c528c..8e74bd31ce3f 100644 --- a/xpcom/rust/gtest/nsstring/Test.cpp +++ b/xpcom/rust/gtest/nsstring/Test.cpp @@ -11,8 +11,7 @@ void GTest_ExpectFailure(const char* aMessage) { EXPECT_STREQ(aMessage, ""); } #define SIZE_ALIGN_CHECK(Clazz) \ extern "C" void Rust_Test_ReprSizeAlign_##Clazz(size_t* size, \ size_t* align); \ - TEST(RustNsString, ReprSizeAlign_##Clazz) \ - { \ + TEST(RustNsString, ReprSizeAlign_##Clazz) { \ size_t size, align; \ Rust_Test_ReprSizeAlign_##Clazz(&size, &align); \ EXPECT_EQ(size, sizeof(Clazz)); \ @@ -25,8 +24,7 @@ SIZE_ALIGN_CHECK(nsCString) #define MEMBER_CHECK(Clazz, Member) \ extern "C" void Rust_Test_Member_##Clazz##_##Member( \ size_t* size, size_t* align, size_t* offset); \ - TEST(RustNsString, ReprMember_##Clazz##_##Member) \ - { \ + TEST(RustNsString, ReprMember_##Clazz##_##Member) { \ class Hack : public Clazz { \ public: \ static void RunTest() { \ @@ -54,8 +52,7 @@ extern "C" void Rust_Test_NsStringFlags( uint16_t* f_terminated, uint16_t* f_voided, uint16_t* f_refcounted, uint16_t* f_owned, uint16_t* f_inline, uint16_t* f_literal, uint16_t* f_class_inline, uint16_t* f_class_null_terminated); -TEST(RustNsString, NsStringFlags) -{ +TEST(RustNsString, NsStringFlags) { uint16_t f_terminated, f_voided, f_refcounted, f_owned, f_inline, f_literal, f_class_inline, f_class_null_terminated; Rust_Test_NsStringFlags(&f_terminated, &f_voided, &f_refcounted, &f_owned, @@ -83,8 +80,7 @@ TEST(RustNsString, NsStringFlags) extern "C" void Rust_StringFromCpp(const nsACString* aCStr, const nsAString* aStr); -TEST(RustNsString, StringFromCpp) -{ +TEST(RustNsString, StringFromCpp) { nsAutoCString foo; foo.AssignASCII("Hello, World!"); @@ -95,8 +91,7 @@ TEST(RustNsString, StringFromCpp) } extern "C" void Rust_AssignFromRust(nsACString* aCStr, nsAString* aStr); -TEST(RustNsString, AssignFromRust) -{ +TEST(RustNsString, AssignFromRust) { nsAutoCString cs; nsAutoString s; Rust_AssignFromRust(&cs, &s); @@ -111,22 +106,18 @@ void Cpp_AssignFromCpp(nsACString* aCStr, nsAString* aStr) { } } extern "C" void Rust_AssignFromCpp(); -TEST(RustNsString, AssignFromCpp) -{ Rust_AssignFromCpp(); } +TEST(RustNsString, AssignFromCpp) { Rust_AssignFromCpp(); } extern "C" void Rust_StringWrite(); -TEST(RustNsString, StringWrite) -{ Rust_StringWrite(); } +TEST(RustNsString, StringWrite) { Rust_StringWrite(); } extern "C" void Rust_FromEmptyRustString(); -TEST(RustNsString, FromEmptyRustString) -{ Rust_FromEmptyRustString(); } +TEST(RustNsString, FromEmptyRustString) { Rust_FromEmptyRustString(); } extern "C" void Rust_WriteToBufferFromRust(nsACString* aCStr, nsAString* aStr, nsACString* aFallibleCStr, nsAString* aFallibleStr); -TEST(RustNsString, WriteToBufferFromRust) -{ +TEST(RustNsString, WriteToBufferFromRust) { nsAutoCString cStr; nsAutoString str; nsAutoCString fallibleCStr; @@ -149,8 +140,7 @@ extern "C" void Rust_InlineCapacityFromRust(const nsACString* aCStr, const nsAString* aStr, size_t* aCStrCapacity, size_t* aStrCapacity); -TEST(RustNsString, InlineCapacityFromRust) -{ +TEST(RustNsString, InlineCapacityFromRust) { size_t cStrCapacity; size_t strCapacity; nsAutoCStringN<93> cs; diff --git a/xpcom/rust/gtest/xpcom/Test.cpp b/xpcom/rust/gtest/xpcom/Test.cpp index 4c2a6fb117ff..1e8d3e5af2b4 100644 --- a/xpcom/rust/gtest/xpcom/Test.cpp +++ b/xpcom/rust/gtest/xpcom/Test.cpp @@ -10,8 +10,7 @@ extern "C" nsIObserverService* Rust_ObserveFromRust(); -TEST(RustXpcom, ObserverFromRust) -{ +TEST(RustXpcom, ObserverFromRust) { nsCOMPtr rust = Rust_ObserveFromRust(); nsCOMPtr cpp = mozilla::services::GetObserverService(); EXPECT_EQ(rust, cpp); @@ -20,8 +19,7 @@ TEST(RustXpcom, ObserverFromRust) extern "C" void Rust_ImplementRunnableInRust(bool* aItWorked, nsIRunnable** aRunnable); -TEST(RustXpcom, ImplementRunnableInRust) -{ +TEST(RustXpcom, ImplementRunnableInRust) { bool itWorked = false; nsCOMPtr runnable; Rust_ImplementRunnableInRust(&itWorked, getter_AddRefs(runnable)); diff --git a/xpcom/tests/gtest/TestAllocReplacement.cpp b/xpcom/tests/gtest/TestAllocReplacement.cpp index 70a27cbc3c7f..725b7245ad2f 100644 --- a/xpcom/tests/gtest/TestAllocReplacement.cpp +++ b/xpcom/tests/gtest/TestAllocReplacement.cpp @@ -112,27 +112,23 @@ static MOZ_NEVER_INLINE bool ValidateHookedAllocation( // See // // for more information about death tests in the GTest framework. -TEST(AllocReplacementDeathTest, malloc_check) -{ +TEST(AllocReplacementDeathTest, malloc_check) { ASSERT_ALLOCATION_HAPPENED([] { return malloc(kAllocAmount); }); } // See above for an explanation of the "*DeathTest" suffix used here. -TEST(AllocReplacementDeathTest, calloc_check) -{ +TEST(AllocReplacementDeathTest, calloc_check) { ASSERT_ALLOCATION_HAPPENED([] { return calloc(1, kAllocAmount); }); } // See above for an explanation of the "*DeathTest" suffix used here. -TEST(AllocReplacementDeathTest, realloc_check) -{ +TEST(AllocReplacementDeathTest, realloc_check) { ASSERT_ALLOCATION_HAPPENED([] { return realloc(nullptr, kAllocAmount); }); } #if defined(HAVE_POSIX_MEMALIGN) // See above for an explanation of the "*DeathTest" suffix used here. -TEST(AllocReplacementDeathTest, posix_memalign_check) -{ +TEST(AllocReplacementDeathTest, posix_memalign_check) { ASSERT_ALLOCATION_HAPPENED([] { void* p = nullptr; int result = posix_memalign(&p, sizeof(void*), kAllocAmount); @@ -153,8 +149,7 @@ TEST(AllocReplacementDeathTest, posix_memalign_check) lambda, [](void* p) { HeapFree(GetProcessHeap(), 0, p); })); // See above for an explanation of the "*DeathTest" suffix used here. -TEST(AllocReplacementDeathTest, HeapAlloc_check) -{ +TEST(AllocReplacementDeathTest, HeapAlloc_check) { ASSERT_ALLOCATION_HAPPENED([] { HANDLE h = GetProcessHeap(); return HeapAlloc(h, 0, kAllocAmount); @@ -162,8 +157,7 @@ TEST(AllocReplacementDeathTest, HeapAlloc_check) } // See above for an explanation of the "*DeathTest" suffix used here. -TEST(AllocReplacementDeathTest, HeapReAlloc_check) -{ +TEST(AllocReplacementDeathTest, HeapReAlloc_check) { ASSERT_ALLOCATION_HAPPENED([] { HANDLE h = GetProcessHeap(); void* p = HeapAlloc(h, 0, kAllocAmount / 2); diff --git a/xpcom/tests/gtest/TestArenaAllocator.cpp b/xpcom/tests/gtest/TestArenaAllocator.cpp index fdb9ba8af3cd..26b313879c2d 100644 --- a/xpcom/tests/gtest/TestArenaAllocator.cpp +++ b/xpcom/tests/gtest/TestArenaAllocator.cpp @@ -12,11 +12,9 @@ using mozilla::ArenaAllocator; -TEST(ArenaAllocator, Constructor) -{ ArenaAllocator<4096, 4> a; } +TEST(ArenaAllocator, Constructor) { ArenaAllocator<4096, 4> a; } -TEST(ArenaAllocator, DefaultAllocate) -{ +TEST(ArenaAllocator, DefaultAllocate) { // Test default 1-byte alignment. ArenaAllocator<1024> a; void* x = a.Allocate(101); @@ -27,8 +25,7 @@ TEST(ArenaAllocator, DefaultAllocate) EXPECT_EQ(uintptr_t(x) + 101, uintptr_t(y)); } -TEST(ArenaAllocator, AllocateAlignment) -{ +TEST(ArenaAllocator, AllocateAlignment) { // Test non-default 8-byte alignment. static const size_t kAlignment = 8; ArenaAllocator<1024, kAlignment> a; @@ -74,8 +71,7 @@ TEST(ArenaAllocator, BadAlignment) } #endif -TEST(ArenaAllocator, AllocateMultipleSizes) -{ +TEST(ArenaAllocator, AllocateMultipleSizes) { // Test non-default 4-byte alignment. ArenaAllocator<4096, 4> a; @@ -94,8 +90,7 @@ TEST(ArenaAllocator, AllocateMultipleSizes) } } -TEST(ArenaAllocator, AllocateInDifferentChunks) -{ +TEST(ArenaAllocator, AllocateInDifferentChunks) { // Test default 1-byte alignment. ArenaAllocator<4096> a; void* x = a.Allocate(4000); @@ -103,8 +98,7 @@ TEST(ArenaAllocator, AllocateInDifferentChunks) EXPECT_NE(uintptr_t(x) + 4000, uintptr_t(y)); } -TEST(ArenaAllocator, AllocateLargerThanArenaSize) -{ +TEST(ArenaAllocator, AllocateLargerThanArenaSize) { // Test default 1-byte alignment. ArenaAllocator<256> a; void* x = a.Allocate(4000); @@ -119,8 +113,7 @@ TEST(ArenaAllocator, AllocateLargerThanArenaSize) } #ifndef MOZ_CODE_COVERAGE -TEST(ArenaAllocator, AllocationsPerChunk) -{ +TEST(ArenaAllocator, AllocationsPerChunk) { // Test that expected number of allocations fit in one chunk. // We use an alignment of 64-bytes to avoid worrying about differences in // the header size on 32 and 64-bit platforms. @@ -147,8 +140,7 @@ TEST(ArenaAllocator, AllocationsPerChunk) EXPECT_NE(uintptr_t(x) + kAlignment, uintptr_t(y)); } -TEST(ArenaAllocator, MemoryIsValid) -{ +TEST(ArenaAllocator, MemoryIsValid) { // Make multiple allocations and actually access the memory. This is // expected to trip up ASAN or valgrind if out of bounds memory is // accessed. @@ -196,8 +188,7 @@ TEST(ArenaAllocator, MemoryIsValid) MOZ_DEFINE_MALLOC_SIZE_OF(TestSizeOf); -TEST(ArenaAllocator, SizeOf) -{ +TEST(ArenaAllocator, SizeOf) { // This tests the sizeof functionality. We can't test for equality as we // can't reliably guarantee what sizes the underlying allocator is going to // choose, so we just test that things grow (or not) as expected. @@ -233,8 +224,7 @@ TEST(ArenaAllocator, SizeOf) EXPECT_GT(sz, prev_sz); } -TEST(ArenaAllocator, Clear) -{ +TEST(ArenaAllocator, Clear) { // Tests that the Clear function works as expected. The best proxy for // checking if a clear is successful is to measure the size. If it's empty we // expect the size to be 0. @@ -279,8 +269,7 @@ TEST(ArenaAllocator, Clear) EXPECT_GT(sz, prev_sz); } -TEST(ArenaAllocator, Extensions) -{ +TEST(ArenaAllocator, Extensions) { ArenaAllocator<4096, 8> a; // Test with raw strings. diff --git a/xpcom/tests/gtest/TestAtoms.cpp b/xpcom/tests/gtest/TestAtoms.cpp index 57cc22f5c3f4..d064fdc96820 100644 --- a/xpcom/tests/gtest/TestAtoms.cpp +++ b/xpcom/tests/gtest/TestAtoms.cpp @@ -20,8 +20,7 @@ int32_t NS_GetUnusedAtomCount(void); namespace TestAtoms { -TEST(Atoms, Basic) -{ +TEST(Atoms, Basic) { for (unsigned int i = 0; i < ArrayLength(ValidStrings); ++i) { nsDependentString str16(ValidStrings[i].m16); nsDependentCString str8(ValidStrings[i].m8); @@ -45,8 +44,7 @@ TEST(Atoms, Basic) } } -TEST(Atoms, 16vs8) -{ +TEST(Atoms, 16vs8) { for (unsigned int i = 0; i < ArrayLength(ValidStrings); ++i) { RefPtr atom16 = NS_Atomize(ValidStrings[i].m16); RefPtr atom8 = NS_Atomize(ValidStrings[i].m8); @@ -54,8 +52,7 @@ TEST(Atoms, 16vs8) } } -TEST(Atoms, Null) -{ +TEST(Atoms, Null) { nsAutoString str(NS_LITERAL_STRING("string with a \0 char")); nsDependentString strCut(str.get()); @@ -70,8 +67,7 @@ TEST(Atoms, Null) EXPECT_TRUE(atomCut->Equals(strCut)); } -TEST(Atoms, Invalid) -{ +TEST(Atoms, Invalid) { for (unsigned int i = 0; i < ArrayLength(Invalid16Strings); ++i) { nsrefcnt count = NS_GetNumberOfAtoms(); @@ -129,8 +125,7 @@ static bool isStaticAtom(nsAtom* atom) { return rv; } -TEST(Atoms, Table) -{ +TEST(Atoms, Table) { nsrefcnt count = NS_GetNumberOfAtoms(); RefPtr thirdDynamic = NS_Atomize(THIRD_ATOM_STR); @@ -158,8 +153,7 @@ class nsAtomRunner final : public nsIRunnable { NS_IMPL_ISUPPORTS(nsAtomRunner, nsIRunnable) -TEST(Atoms, ConcurrentAccessing) -{ +TEST(Atoms, ConcurrentAccessing) { static const size_t kThreadCount = 4; // Force a GC before so that we don't have any unused atom. NS_GetNumberOfAtoms(); diff --git a/xpcom/tests/gtest/TestAutoPtr.cpp b/xpcom/tests/gtest/TestAutoPtr.cpp index d0f13673feea..7559c8fd13da 100644 --- a/xpcom/tests/gtest/TestAutoPtr.cpp +++ b/xpcom/tests/gtest/TestAutoPtr.cpp @@ -61,8 +61,7 @@ static void DoSomethingWithConstTestObjectBaseB(const TestObjectBaseB *aIn) { TestObject::last_ptr = static_cast(aIn); } -TEST(AutoPtr, Assignment) -{ +TEST(AutoPtr, Assignment) { TestObject::destructed = 0; { nsAutoPtr pobj(new TestObject()); } @@ -78,8 +77,7 @@ TEST(AutoPtr, Assignment) ASSERT_EQ(3, TestObject::destructed); } -TEST(AutoPtr, getter_Transfers) -{ +TEST(AutoPtr, getter_Transfers) { TestObject::destructed = 0; { @@ -90,8 +88,7 @@ TEST(AutoPtr, getter_Transfers) ASSERT_EQ(1, TestObject::destructed); } -TEST(AutoPtr, Casting) -{ +TEST(AutoPtr, Casting) { // This comparison is always false, as it should be. The extra parens // suppress a -Wunreachable-code warning about printf being unreachable. ASSERT_NE(((void *)(TestObject *)0x1000), @@ -117,8 +114,7 @@ TEST(AutoPtr, Casting) } } -TEST(AutoPtr, Forget) -{ +TEST(AutoPtr, Forget) { TestObject::destructed = 0; { @@ -130,8 +126,7 @@ TEST(AutoPtr, Forget) ASSERT_EQ(1, TestObject::destructed); } -TEST(AutoPtr, Construction) -{ +TEST(AutoPtr, Construction) { TestObject::destructed = 0; { nsAutoPtr pobj(new TestObject()); } @@ -139,8 +134,7 @@ TEST(AutoPtr, Construction) ASSERT_EQ(1, TestObject::destructed); } -TEST(AutoPtr, ImplicitConversion) -{ +TEST(AutoPtr, ImplicitConversion) { // This test is basically successful if it builds. We add a few assertions // to make gtest happy. TestObject::destructed = 0; @@ -178,8 +172,7 @@ TEST(AutoPtr, ImplicitConversion) ASSERT_EQ(4, TestObject::destructed); } -TEST(AutoPtr, ArrowOperator) -{ +TEST(AutoPtr, ArrowOperator) { // This test is basically successful if it builds. We add a few assertions // to make gtest happy. TestObject::destructed = 0; diff --git a/xpcom/tests/gtest/TestAutoRef.cpp b/xpcom/tests/gtest/TestAutoRef.cpp index cfc611db07c6..42644609d140 100644 --- a/xpcom/tests/gtest/TestAutoRef.cpp +++ b/xpcom/tests/gtest/TestAutoRef.cpp @@ -34,8 +34,7 @@ class nsAutoRefTraits : public nsPointerRefTraits { int nsAutoRefTraits::mTotalRefsCnt = 0; -TEST(AutoRef, Assignment) -{ +TEST(AutoRef, Assignment) { { nsCountedRef a(new TestObjectA()); ASSERT_EQ(a->mRefCnt, 1); diff --git a/xpcom/tests/gtest/TestAutoRefCnt.cpp b/xpcom/tests/gtest/TestAutoRefCnt.cpp index f426466d4037..6b8ee73f8c79 100644 --- a/xpcom/tests/gtest/TestAutoRefCnt.cpp +++ b/xpcom/tests/gtest/TestAutoRefCnt.cpp @@ -47,8 +47,7 @@ Atomic nsThreadSafeAutoRefCntRunner::sDecToZero(0); // want to release the object after last reference gets released. In // this pattern, the cache may rely on the balance of increment to one // and decrement to zero, so that it can maintain a counter for GC. -TEST(AutoRefCnt, ThreadSafeAutoRefCntBalance) -{ +TEST(AutoRefCnt, ThreadSafeAutoRefCntBalance) { static const size_t kThreadCount = 4; nsCOMPtr threads[kThreadCount]; for (size_t i = 0; i < kThreadCount; i++) { diff --git a/xpcom/tests/gtest/TestBase64.cpp b/xpcom/tests/gtest/TestBase64.cpp index d366876de440..15ac176c74a3 100644 --- a/xpcom/tests/gtest/TestBase64.cpp +++ b/xpcom/tests/gtest/TestBase64.cpp @@ -180,12 +180,11 @@ void FakeInputStream::CheckTest(nsACString& aResult) { void FakeInputStream::CheckTest(nsAString& aResult) { ASSERT_TRUE(aResult.EqualsASCII(mTest->mResult)) - << "Actual: " << aResult.BeginReading() << std::endl - << "Expected: " << mTest->mResult; + << "Actual: " << aResult.BeginReading() << std::endl + << "Expected: " << mTest->mResult; } -TEST(Base64, StreamEncoder) -{ +TEST(Base64, StreamEncoder) { nsCOMPtr encoder = do_CreateInstance("@mozilla.org/scriptablebase64encoder;1"); ASSERT_TRUE(encoder); @@ -224,8 +223,7 @@ static EncodeDecodeTestCase sRFC4648TestCases[] = { {"foobar", "Zm9vYmFy"}, }; -TEST(Base64, RFC4648Encoding) -{ +TEST(Base64, RFC4648Encoding) { for (auto& testcase : sRFC4648TestCases) { nsDependentCString in(testcase.mInput); nsAutoCString out; @@ -243,8 +241,7 @@ TEST(Base64, RFC4648Encoding) } } -TEST(Base64, RFC4648Decoding) -{ +TEST(Base64, RFC4648Decoding) { for (auto& testcase : sRFC4648TestCases) { nsDependentCString out(testcase.mOutput); nsAutoCString in; @@ -262,8 +259,7 @@ TEST(Base64, RFC4648Decoding) } } -TEST(Base64, RFC4648DecodingRawPointers) -{ +TEST(Base64, RFC4648DecodingRawPointers) { for (auto& testcase : sRFC4648TestCases) { size_t outputLength = strlen(testcase.mOutput); size_t inputLength = strlen(testcase.mInput); @@ -293,8 +289,7 @@ static EncodeDecodeTestCase sNonASCIITestCases[] = { {"\xff\xff\xff\xff", "/////w=="}, }; -TEST(Base64, NonASCIIEncoding) -{ +TEST(Base64, NonASCIIEncoding) { for (auto& testcase : sNonASCIITestCases) { nsDependentCString in(testcase.mInput); nsAutoCString out; @@ -304,8 +299,7 @@ TEST(Base64, NonASCIIEncoding) } } -TEST(Base64, NonASCIIEncodingWideString) -{ +TEST(Base64, NonASCIIEncodingWideString) { for (auto& testcase : sNonASCIITestCases) { nsAutoString in, out; // XXX Handles Latin1 despite the name @@ -316,8 +310,7 @@ TEST(Base64, NonASCIIEncodingWideString) } } -TEST(Base64, NonASCIIDecoding) -{ +TEST(Base64, NonASCIIDecoding) { for (auto& testcase : sNonASCIITestCases) { nsDependentCString out(testcase.mOutput); nsAutoCString in; @@ -327,8 +320,7 @@ TEST(Base64, NonASCIIDecoding) } } -TEST(Base64, NonASCIIDecodingWideString) -{ +TEST(Base64, NonASCIIDecodingWideString) { for (auto& testcase : sNonASCIITestCases) { nsAutoString in, out; // XXX Handles Latin1 despite the name @@ -346,8 +338,7 @@ TEST(Base64, NonASCIIDecodingWideString) // For historical reasons, our wide string base64 encode routines mask off // the high bits of non-latin1 wide strings. -TEST(Base64, EncodeNon8BitWideString) -{ +TEST(Base64, EncodeNon8BitWideString) { { const nsAutoString non8Bit(u"\x1ff"); nsAutoString out; @@ -366,8 +357,7 @@ TEST(Base64, EncodeNon8BitWideString) // For historical reasons, our wide string base64 decode routines mask off // the high bits of non-latin1 wide strings. -TEST(Base64, DecodeNon8BitWideString) -{ +TEST(Base64, DecodeNon8BitWideString) { { // This would be "/w==" in a nsCString const nsAutoString non8Bit(u"\x12f\x177=="); @@ -388,8 +378,7 @@ TEST(Base64, DecodeNon8BitWideString) } } -TEST(Base64, TruncateOnInvalidDecodeCString) -{ +TEST(Base64, TruncateOnInvalidDecodeCString) { NS_NAMED_LITERAL_CSTRING(invalid, "@@=="); nsAutoCString out("I should be truncated!"); nsresult rv = mozilla::Base64Decode(invalid, out); @@ -397,8 +386,7 @@ TEST(Base64, TruncateOnInvalidDecodeCString) ASSERT_EQ(out.Length(), 0u); } -TEST(Base64, TruncateOnInvalidDecodeWideString) -{ +TEST(Base64, TruncateOnInvalidDecodeWideString) { NS_NAMED_LITERAL_STRING(invalid, "@@=="); nsAutoString out(u"I should be truncated!"); nsresult rv = mozilla::Base64Decode(invalid, out); diff --git a/xpcom/tests/gtest/TestCOMArray.cpp b/xpcom/tests/gtest/TestCOMArray.cpp index 8c487541675e..81bf8ca64f09 100644 --- a/xpcom/tests/gtest/TestCOMArray.cpp +++ b/xpcom/tests/gtest/TestCOMArray.cpp @@ -112,8 +112,7 @@ Bar::Release(void) { return mRefCnt; } -TEST(COMArray, Sizing) -{ +TEST(COMArray, Sizing) { nsCOMArray arr; for (int32_t i = 0; i < 20; ++i) { @@ -143,8 +142,7 @@ TEST(COMArray, Sizing) } } -TEST(COMArray, ObjectFunctions) -{ +TEST(COMArray, ObjectFunctions) { int32_t base; { nsCOMArray arr2; @@ -202,8 +200,7 @@ TEST(COMArray, ObjectFunctions) } } -TEST(COMArray, ElementFunctions) -{ +TEST(COMArray, ElementFunctions) { int32_t base; { nsCOMArray arr2; @@ -261,8 +258,7 @@ TEST(COMArray, ElementFunctions) } } -TEST(COMArray, Destructor) -{ +TEST(COMArray, Destructor) { int32_t base; Bar::sReleaseCalled = 0; diff --git a/xpcom/tests/gtest/TestCOMPtr.cpp b/xpcom/tests/gtest/TestCOMPtr.cpp index 98b6bc4794fb..61b1604a8410 100644 --- a/xpcom/tests/gtest/TestCOMPtr.cpp +++ b/xpcom/tests/gtest/TestCOMPtr.cpp @@ -182,8 +182,7 @@ static void AnISupportsPtrPtrContext(nsISupports**) {} using namespace TestCOMPtr; -TEST(COMPtr, Bloat_Raw_Unsafe) -{ +TEST(COMPtr, Bloat_Raw_Unsafe) { // ER: I'm not sure what this is testing... IBar* barP = 0; nsresult rv = CreateIBar(reinterpret_cast(&barP)); @@ -199,8 +198,7 @@ TEST(COMPtr, Bloat_Raw_Unsafe) NS_RELEASE(barP); } -TEST(COMPtr, Bloat_Smart) -{ +TEST(COMPtr, Bloat_Smart) { // ER: I'm not sure what this is testing... nsCOMPtr barP; nsresult rv = CreateIBar(getter_AddRefs(barP)); @@ -212,8 +210,7 @@ TEST(COMPtr, Bloat_Smart) ASSERT_TRUE(fooP); } -TEST(COMPtr, AddRefAndRelease) -{ +TEST(COMPtr, AddRefAndRelease) { IFoo::total_constructions_ = 0; IFoo::total_destructions_ = 0; IBar::total_destructions_ = 0; @@ -263,8 +260,7 @@ TEST(COMPtr, AddRefAndRelease) ASSERT_EQ(IBar::total_destructions_, 1); } -TEST(COMPtr, Comparison) -{ +TEST(COMPtr, Comparison) { IFoo::total_constructions_ = 0; IFoo::total_destructions_ = 0; @@ -299,8 +295,7 @@ TEST(COMPtr, Comparison) ASSERT_EQ(IFoo::total_destructions_, 2); } -TEST(COMPtr, DontAddRef) -{ +TEST(COMPtr, DontAddRef) { { auto* raw_foo1p = new IFoo; raw_foo1p->AddRef(); @@ -319,8 +314,7 @@ TEST(COMPtr, DontAddRef) } } -TEST(COMPtr, AssignmentHelpers) -{ +TEST(COMPtr, AssignmentHelpers) { IFoo::total_constructions_ = 0; IFoo::total_destructions_ = 0; @@ -381,8 +375,7 @@ TEST(COMPtr, AssignmentHelpers) ASSERT_EQ(IFoo::total_destructions_, 5); } -TEST(COMPtr, QueryInterface) -{ +TEST(COMPtr, QueryInterface) { IFoo::total_queries_ = 0; IBar::total_queries_ = 0; @@ -414,8 +407,7 @@ TEST(COMPtr, QueryInterface) } } -TEST(COMPtr, GetterConversions) -{ +TEST(COMPtr, GetterConversions) { // This is just a compilation test. We add a few asserts to keep gtest happy. { nsCOMPtr fooP; diff --git a/xpcom/tests/gtest/TestCOMPtrEq.cpp b/xpcom/tests/gtest/TestCOMPtrEq.cpp index 2056ce136805..97482a212f84 100644 --- a/xpcom/tests/gtest/TestCOMPtrEq.cpp +++ b/xpcom/tests/gtest/TestCOMPtrEq.cpp @@ -25,8 +25,7 @@ class nsICOMPtrEqTestFoo : public nsISupports { NS_DEFINE_STATIC_IID_ACCESSOR(nsICOMPtrEqTestFoo, NS_ICOMPTREQTESTFOO_IID) -TEST(COMPtrEq, NullEquality) -{ +TEST(COMPtrEq, NullEquality) { nsCOMPtr s; nsICOMPtrEqTestFoo* r = nullptr; const nsCOMPtr sc; diff --git a/xpcom/tests/gtest/TestCRT.cpp b/xpcom/tests/gtest/TestCRT.cpp index 22e161fcddd1..cbcc375bd1dd 100644 --- a/xpcom/tests/gtest/TestCRT.cpp +++ b/xpcom/tests/gtest/TestCRT.cpp @@ -79,8 +79,7 @@ static Test tests[] = { }; #define NUM_TESTS int((sizeof(tests) / sizeof(tests[0]))) -TEST(CRT, main) -{ +TEST(CRT, main) { TestCRT::Test* tp = tests; for (int i = 0; i < NUM_TESTS; i++, tp++) { Check(tp->s1, tp->s2, tp->n); diff --git a/xpcom/tests/gtest/TestCloneInputStream.cpp b/xpcom/tests/gtest/TestCloneInputStream.cpp index 0bdae9d4f71a..2d25d35e06f7 100644 --- a/xpcom/tests/gtest/TestCloneInputStream.cpp +++ b/xpcom/tests/gtest/TestCloneInputStream.cpp @@ -14,16 +14,14 @@ #include "nsStringStream.h" #include "nsComponentManagerUtils.h" -TEST(CloneInputStream, InvalidInput) -{ +TEST(CloneInputStream, InvalidInput) { nsCOMPtr clone; nsresult rv = NS_CloneInputStream(nullptr, getter_AddRefs(clone)); ASSERT_TRUE(NS_FAILED(rv)); ASSERT_FALSE(clone); } -TEST(CloneInputStream, CloneableInput) -{ +TEST(CloneInputStream, CloneableInput) { nsTArray inputData; testing::CreateData(4 * 1024, inputData); nsDependentCSubstring inputString(inputData.Elements(), inputData.Length()); @@ -78,8 +76,7 @@ class NonCloneableInputStream final : public nsIInputStream { NS_IMPL_ISUPPORTS(NonCloneableInputStream, nsIInputStream) -TEST(CloneInputStream, NonCloneableInput_NoFallback) -{ +TEST(CloneInputStream, NonCloneableInput_NoFallback) { nsTArray inputData; testing::CreateData(4 * 1024, inputData); nsDependentCSubstring inputString(inputData.Elements(), inputData.Length()); @@ -101,8 +98,7 @@ TEST(CloneInputStream, NonCloneableInput_NoFallback) testing::ConsumeAndValidateStream(stream, inputString); } -TEST(CloneInputStream, NonCloneableInput_Fallback) -{ +TEST(CloneInputStream, NonCloneableInput_Fallback) { nsTArray inputData; testing::CreateData(4 * 1024, inputData); nsDependentCSubstring inputString(inputData.Elements(), inputData.Length()); @@ -142,8 +138,7 @@ TEST(CloneInputStream, NonCloneableInput_Fallback) testing::ConsumeAndValidateStream(clone, inputString); } -TEST(CloneInputStream, CloneMultiplexStream) -{ +TEST(CloneInputStream, CloneMultiplexStream) { nsCOMPtr multiplexStream = do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1"); ASSERT_TRUE(multiplexStream); @@ -184,8 +179,7 @@ TEST(CloneInputStream, CloneMultiplexStream) ASSERT_TRUE(NS_FAILED(rv)); } -TEST(CloneInputStream, CloneMultiplexStreamPartial) -{ +TEST(CloneInputStream, CloneMultiplexStreamPartial) { nsCOMPtr multiplexStream = do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1"); ASSERT_TRUE(multiplexStream); diff --git a/xpcom/tests/gtest/TestDafsa.cpp b/xpcom/tests/gtest/TestDafsa.cpp index 523c74629020..f7aa0cd40523 100644 --- a/xpcom/tests/gtest/TestDafsa.cpp +++ b/xpcom/tests/gtest/TestDafsa.cpp @@ -15,11 +15,9 @@ namespace dafsa_test_1 { #include "dafsa_test_1.inc" // kDafsa } -TEST(Dafsa, Constructor) -{ Dafsa d(dafsa_test_1::kDafsa); } +TEST(Dafsa, Constructor) { Dafsa d(dafsa_test_1::kDafsa); } -TEST(Dafsa, StringsFound) -{ +TEST(Dafsa, StringsFound) { Dafsa d(dafsa_test_1::kDafsa); int tag = d.Lookup(NS_LITERAL_CSTRING("foo.bar.baz")); @@ -35,8 +33,7 @@ TEST(Dafsa, StringsFound) EXPECT_EQ(tag, 4); } -TEST(Dafsa, StringsNotFound) -{ +TEST(Dafsa, StringsNotFound) { Dafsa d(dafsa_test_1::kDafsa); // Matches all but last letter. @@ -60,8 +57,7 @@ TEST(Dafsa, StringsNotFound) EXPECT_EQ(tag, Dafsa::kKeyNotFound); } -TEST(Dafsa, HugeString) -{ +TEST(Dafsa, HugeString) { Dafsa d(dafsa_test_1::kDafsa); int tag = d.Lookup(NS_LITERAL_CSTRING( diff --git a/xpcom/tests/gtest/TestDeadlockDetectorScalability.cpp b/xpcom/tests/gtest/TestDeadlockDetectorScalability.cpp index 40519f43ede4..442ccc9155a1 100644 --- a/xpcom/tests/gtest/TestDeadlockDetectorScalability.cpp +++ b/xpcom/tests/gtest/TestDeadlockDetectorScalability.cpp @@ -27,8 +27,7 @@ static void AllocLockRecurseUnlockFree(int i) { // This test creates a resource dependency chain N elements long, then // frees all the resources in the chain. -TEST(DeadlockDetectorScalability, LengthNDepChain) -{ +TEST(DeadlockDetectorScalability, LengthNDepChain) { const int N = 1 << 14; // 16K AllocLockRecurseUnlockFree(N); ASSERT_TRUE(true); @@ -40,8 +39,7 @@ TEST(DeadlockDetectorScalability, LengthNDepChain) // repeatedly exercises this order k times. // // NB: It takes a minute or two to run so it is disabled by default. -TEST(DeadlockDetectorScalability, DISABLED_OneLockNDeps) -{ +TEST(DeadlockDetectorScalability, DISABLED_OneLockNDeps) { // NB: Using a larger test size to stress our traversal logic. const int N = 1 << 17; // 131k const int K = 100; @@ -82,8 +80,7 @@ TEST(DeadlockDetectorScalability, DISABLED_OneLockNDeps) // It's very difficult to perform well on this test. It's put forth as a // challenge problem. -TEST(DeadlockDetectorScalability, MaxDepsNsq) -{ +TEST(DeadlockDetectorScalability, MaxDepsNsq) { const int N = 1 << 10; // 1k const int K = 10; @@ -117,8 +114,7 @@ TEST(DeadlockDetectorScalability, MaxDepsNsq) // resources are allocated, exercised K times, and deallocated one at // a time. -TEST(DeadlockDetectorScalability, OneLockNDepsUsedSeveralTimes) -{ +TEST(DeadlockDetectorScalability, OneLockNDepsUsedSeveralTimes) { const size_t N = 1 << 17; // 131k const size_t K = 3; @@ -154,8 +150,7 @@ MOZ_DEFINE_MALLOC_SIZE_OF(DeadlockDetectorMallocSizeOf) // This is a simple test that exercises the deadlock detector memory reporting // functionality. -TEST(DeadlockDetectorScalability, SizeOf) -{ +TEST(DeadlockDetectorScalability, SizeOf) { size_t memory_used = mozilla::BlockingResourceBase::SizeOfDeadlockDetector( DeadlockDetectorMallocSizeOf); diff --git a/xpcom/tests/gtest/TestEncoding.cpp b/xpcom/tests/gtest/TestEncoding.cpp index 2abbc5d7086e..4973d2f0b3ab 100644 --- a/xpcom/tests/gtest/TestEncoding.cpp +++ b/xpcom/tests/gtest/TestEncoding.cpp @@ -8,8 +8,7 @@ #include "nsString.h" #include "gtest/gtest.h" -TEST(Encoding, GoodSurrogatePair) -{ +TEST(Encoding, GoodSurrogatePair) { // When this string is decoded, the surrogate pair is U+10302 and the rest of // the string is specified by indexes 2 onward. const char16_t goodPairData[] = {0xD800, 0xDF02, 0x65, 0x78, 0x0}; @@ -32,8 +31,7 @@ TEST(Encoding, GoodSurrogatePair) free(goodPair8); } -TEST(Encoding, BackwardsSurrogatePair) -{ +TEST(Encoding, BackwardsSurrogatePair) { // When this string is decoded, the two surrogates are wrongly ordered and // must each be interpreted as U+FFFD. const char16_t backwardsPairData[] = {0xDDDD, 0xD863, 0x65, 0x78, 0x0}; @@ -57,8 +55,7 @@ TEST(Encoding, BackwardsSurrogatePair) free(backwardsPair8); } -TEST(Encoding, MalformedUTF16OrphanHighSurrogate) -{ +TEST(Encoding, MalformedUTF16OrphanHighSurrogate) { // When this string is decoded, the high surrogate should be replaced and the // rest of the string is specified by indexes 1 onward. const char16_t highSurrogateData[] = {0xD863, 0x74, 0x65, 0x78, 0x74, 0x0}; @@ -82,8 +79,7 @@ TEST(Encoding, MalformedUTF16OrphanHighSurrogate) free(highSurrogate8); } -TEST(Encoding, MalformedUTF16OrphanLowSurrogate) -{ +TEST(Encoding, MalformedUTF16OrphanLowSurrogate) { // When this string is decoded, the low surrogate should be replaced and the // rest of the string is specified by indexes 1 onward. const char16_t lowSurrogateData[] = {0xDDDD, 0x74, 0x65, 0x78, 0x74, 0x0}; diff --git a/xpcom/tests/gtest/TestEscape.cpp b/xpcom/tests/gtest/TestEscape.cpp index e3cd9b55a866..fd4a4e37ec2d 100644 --- a/xpcom/tests/gtest/TestEscape.cpp +++ b/xpcom/tests/gtest/TestEscape.cpp @@ -13,8 +13,7 @@ using namespace mozilla; // Testing for failure here would be somewhat hard in automation. Locally you // could use something like ulimit to create a failure. -TEST(Escape, FallibleNoEscape) -{ +TEST(Escape, FallibleNoEscape) { // Tests the fallible version of NS_EscapeURL works as expected when no // escaping is necessary. nsCString toEscape("data:,Hello%2C%20World!"); @@ -27,8 +26,7 @@ TEST(Escape, FallibleNoEscape) EXPECT_EQ(toEscape.BeginReading(), escaped.BeginReading()); } -TEST(Escape, FallibleEscape) -{ +TEST(Escape, FallibleEscape) { // Tests the fallible version of NS_EscapeURL works as expected when // escaping is necessary. nsCString toEscape("data:,Hello%2C%20World!\xC4\x9F"); @@ -40,8 +38,7 @@ TEST(Escape, FallibleEscape) EXPECT_STREQ(escaped.BeginReading(), kExpected); } -TEST(Escape, BadEscapeSequences) -{ +TEST(Escape, BadEscapeSequences) { { char bad[] = "%s\0fa"; @@ -69,8 +66,7 @@ TEST(Escape, BadEscapeSequences) } } -TEST(Escape, nsAppendEscapedHTML) -{ +TEST(Escape, nsAppendEscapedHTML) { const char* srcs[] = { "a", "bcdefgh", "<", ">", "&", "\"", "'", "'bad'", "Foo& foo", "'\"&> evNormal = @@ -67,8 +66,7 @@ TEST(EventPriorities, IdleAfterNormal) SpinEventLoopUntil([&]() { return normalRan == 3 && idleRan == 3; })); } -TEST(EventPriorities, InterleaveHighNormal) -{ +TEST(EventPriorities, InterleaveHighNormal) { int normalRan = 0, highRan = 0; RefPtr evNormal = new TestEvent( diff --git a/xpcom/tests/gtest/TestEventTargetQI.cpp b/xpcom/tests/gtest/TestEventTargetQI.cpp index 6de1d8abfc21..25f1a063105f 100644 --- a/xpcom/tests/gtest/TestEventTargetQI.cpp +++ b/xpcom/tests/gtest/TestEventTargetQI.cpp @@ -27,8 +27,7 @@ bool TestQITo(SourcePtr& aPtr1) { return (bool)aPtr2; } -TEST(TestEventTargetQI, ThreadPool) -{ +TEST(TestEventTargetQI, ThreadPool) { nsCOMPtr thing = new nsThreadPool(); EXPECT_FALSE(TestQITo(thing)); @@ -38,8 +37,7 @@ TEST(TestEventTargetQI, ThreadPool) thing->Shutdown(); } -TEST(TestEventTargetQI, SharedThreadPool) -{ +TEST(TestEventTargetQI, SharedThreadPool) { nsCOMPtr thing = SharedThreadPool::Get(NS_LITERAL_CSTRING("TestPool"), 1); EXPECT_TRUE(thing); @@ -49,8 +47,7 @@ TEST(TestEventTargetQI, SharedThreadPool) EXPECT_TRUE(TestQITo(thing)); } -TEST(TestEventTargetQI, Thread) -{ +TEST(TestEventTargetQI, Thread) { nsCOMPtr thing = do_GetCurrentThread(); EXPECT_TRUE(thing); @@ -59,8 +56,7 @@ TEST(TestEventTargetQI, Thread) EXPECT_TRUE(TestQITo(thing)); } -TEST(TestEventTargetQI, ThrottledEventQueue) -{ +TEST(TestEventTargetQI, ThrottledEventQueue) { nsCOMPtr thread = do_GetCurrentThread(); RefPtr thing = ThrottledEventQueue::Create(thread); EXPECT_TRUE(thing); @@ -70,8 +66,7 @@ TEST(TestEventTargetQI, ThrottledEventQueue) EXPECT_TRUE(TestQITo(thing)); } -TEST(TestEventTargetQI, LazyIdleThread) -{ +TEST(TestEventTargetQI, LazyIdleThread) { nsCOMPtr thing = new LazyIdleThread(0, NS_LITERAL_CSTRING("TestThread")); EXPECT_TRUE(thing); @@ -83,8 +78,7 @@ TEST(TestEventTargetQI, LazyIdleThread) thing->Shutdown(); } -TEST(TestEventTargetQI, SchedulerGroup) -{ +TEST(TestEventTargetQI, SchedulerGroup) { nsCOMPtr thing = SystemGroup::EventTargetFor(TaskCategory::Other); EXPECT_TRUE(thing); diff --git a/xpcom/tests/gtest/TestExpirationTracker.cpp b/xpcom/tests/gtest/TestExpirationTracker.cpp index 09e462a29435..603e0233ab97 100644 --- a/xpcom/tests/gtest/TestExpirationTracker.cpp +++ b/xpcom/tests/gtest/TestExpirationTracker.cpp @@ -183,8 +183,7 @@ static const struct Test { DECL_TEST(test_random8), {nullptr, nullptr}}; -TEST(ExpirationTracker, main) -{ +TEST(ExpirationTracker, main) { for (const TestExpirationTracker::Test* t = tests; t->name != nullptr; ++t) { EXPECT_TRUE(t->func()); } diff --git a/xpcom/tests/gtest/TestFile.cpp b/xpcom/tests/gtest/TestFile.cpp index 0f5b3c12ce35..a2930354ab79 100644 --- a/xpcom/tests/gtest/TestFile.cpp +++ b/xpcom/tests/gtest/TestFile.cpp @@ -365,8 +365,7 @@ static bool TestNormalizeNativePath(nsIFile* aBase, nsIFile* aStart) { return true; } -TEST(TestFile, Tests) -{ +TEST(TestFile, Tests) { nsCOMPtr base; nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(base)); ASSERT_TRUE(VerifyResult(rv, "Getting temp directory")); diff --git a/xpcom/tests/gtest/TestFilePreferencesUnix.cpp b/xpcom/tests/gtest/TestFilePreferencesUnix.cpp index ba73e130bde2..1f9a5ff09284 100644 --- a/xpcom/tests/gtest/TestFilePreferencesUnix.cpp +++ b/xpcom/tests/gtest/TestFilePreferencesUnix.cpp @@ -10,8 +10,7 @@ using namespace mozilla; -TEST(TestFilePreferencesUnix, Parsing) -{ +TEST(TestFilePreferencesUnix, Parsing) { #define kBlacklisted "/tmp/blacklisted" #define kBlacklistedDir "/tmp/blacklisted/" #define kBlacklistedFile "/tmp/blacklisted/file" @@ -67,8 +66,7 @@ TEST(TestFilePreferencesUnix, Parsing) false); } -TEST(TestFilePreferencesUnix, Simple) -{ +TEST(TestFilePreferencesUnix, Simple) { nsAutoCString tempPath; // This is the directory we will blacklist diff --git a/xpcom/tests/gtest/TestFilePreferencesWin.cpp b/xpcom/tests/gtest/TestFilePreferencesWin.cpp index e11126bba40d..e14c351fa57b 100644 --- a/xpcom/tests/gtest/TestFilePreferencesWin.cpp +++ b/xpcom/tests/gtest/TestFilePreferencesWin.cpp @@ -4,8 +4,7 @@ #include "nsIFile.h" #include "nsXPCOMCID.h" -TEST(FilePreferencesWin, Normalization) -{ +TEST(FilePreferencesWin, Normalization) { nsAutoString normalized; mozilla::FilePreferences::testing::NormalizePath(NS_LITERAL_STRING("foo"), @@ -115,8 +114,7 @@ TEST(FilePreferencesWin, Normalization) ASSERT_FALSE(result); } -TEST(FilePreferencesWin, AccessUNC) -{ +TEST(FilePreferencesWin, AccessUNC) { nsCOMPtr lf = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); nsresult rv; diff --git a/xpcom/tests/gtest/TestGCPostBarriers.cpp b/xpcom/tests/gtest/TestGCPostBarriers.cpp index f10427225138..6628bc99b3be 100644 --- a/xpcom/tests/gtest/TestGCPostBarriers.cpp +++ b/xpcom/tests/gtest/TestGCPostBarriers.cpp @@ -112,8 +112,7 @@ static void CreateGlobalAndRunTest(JSContext* cx) { JS::LeaveRealm(cx, oldRealm); } -TEST(GCPostBarriers, nsTArray) -{ +TEST(GCPostBarriers, nsTArray) { CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get(); ASSERT_TRUE(ccjscx != nullptr); JSContext* cx = ccjscx->Context(); diff --git a/xpcom/tests/gtest/TestHashtables.cpp b/xpcom/tests/gtest/TestHashtables.cpp index 26779f0fbd4d..c954b3e066d4 100644 --- a/xpcom/tests/gtest/TestHashtables.cpp +++ b/xpcom/tests/gtest/TestHashtables.cpp @@ -217,8 +217,7 @@ static nsresult CreateIFoo(IFoo** result) using namespace TestHashtables; -TEST(Hashtable, THashtable) -{ +TEST(Hashtable, THashtable) { // check an nsTHashtable nsTHashtable EntityToUnicode(ENTITY_COUNT); @@ -238,8 +237,7 @@ TEST(Hashtable, THashtable) ASSERT_EQ(count, uint32_t(0)); } -TEST(Hashtable, Move) -{ +TEST(Hashtable, Move) { const void* kPtr = reinterpret_cast(static_cast(0xbadc0de)); nsTHashtable> table; @@ -253,8 +251,7 @@ TEST(Hashtable, Move) EXPECT_FALSE(table.Contains(kPtr)); } -TEST(Hashtables, DataHashtable) -{ +TEST(Hashtables, DataHashtable) { // check a data-hashtable nsDataHashtable UniToEntity(ENTITY_COUNT); @@ -286,8 +283,7 @@ TEST(Hashtables, DataHashtable) ASSERT_EQ(count, uint32_t(0)); } -TEST(Hashtables, ClassHashtable) -{ +TEST(Hashtables, ClassHashtable) { // check a class-hashtable nsClassHashtable EntToUniClass(ENTITY_COUNT); @@ -319,8 +315,7 @@ TEST(Hashtables, ClassHashtable) ASSERT_EQ(count, uint32_t(0)); } -TEST(Hashtables, DataHashtableWithInterfaceKey) -{ +TEST(Hashtables, DataHashtableWithInterfaceKey) { // check a data-hashtable with an interface key nsDataHashtable EntToUniClass2(ENTITY_COUNT); @@ -365,8 +360,7 @@ TEST(Hashtables, DataHashtableWithInterfaceKey) ASSERT_EQ(count, uint32_t(0)); } -TEST(Hashtables, InterfaceHashtable) -{ +TEST(Hashtables, InterfaceHashtable) { // check an interface-hashtable with an uint32_t key nsInterfaceHashtable UniToEntClass2(ENTITY_COUNT); @@ -408,8 +402,7 @@ TEST(Hashtables, InterfaceHashtable) ASSERT_EQ(count, uint32_t(0)); } -TEST(Hashtables, DataHashtable_LookupForAdd) -{ +TEST(Hashtables, DataHashtable_LookupForAdd) { // check LookupForAdd/OrInsert nsDataHashtable UniToEntity(ENTITY_COUNT); @@ -474,8 +467,7 @@ TEST(Hashtables, DataHashtable_LookupForAdd) ASSERT_TRUE(0 == UniToEntity.Count()); } -TEST(Hashtables, ClassHashtable_LookupForAdd) -{ +TEST(Hashtables, ClassHashtable_LookupForAdd) { // check a class-hashtable LookupForAdd with null values nsClassHashtable EntToUniClass(ENTITY_COUNT); diff --git a/xpcom/tests/gtest/TestID.cpp b/xpcom/tests/gtest/TestID.cpp index d9a712500bed..90fc5fb4c1d1 100644 --- a/xpcom/tests/gtest/TestID.cpp +++ b/xpcom/tests/gtest/TestID.cpp @@ -20,8 +20,7 @@ static const char* const ids[] = { }; #define NUM_IDS ((int)(sizeof(ids) / sizeof(ids[0]))) -TEST(nsID, StringConversion) -{ +TEST(nsID, StringConversion) { nsID id; for (int i = 0; i < NUM_IDS; i++) { const char* idstr = ids[i]; diff --git a/xpcom/tests/gtest/TestInputStreamLengthHelper.cpp b/xpcom/tests/gtest/TestInputStreamLengthHelper.cpp index b562bb59b23d..d2ccc8715194 100644 --- a/xpcom/tests/gtest/TestInputStreamLengthHelper.cpp +++ b/xpcom/tests/gtest/TestInputStreamLengthHelper.cpp @@ -14,8 +14,7 @@ using namespace mozilla; -TEST(TestInputStreamLengthHelper, NonLengthStream) -{ +TEST(TestInputStreamLengthHelper, NonLengthStream) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -92,8 +91,7 @@ NS_INTERFACE_MAP_BEGIN(LengthStream) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream) NS_INTERFACE_MAP_END -TEST(TestInputStreamLengthHelper, LengthStream) -{ +TEST(TestInputStreamLengthHelper, LengthStream) { nsCOMPtr stream = new LengthStream(42, NS_OK, 0, false); bool called = false; @@ -105,8 +103,7 @@ TEST(TestInputStreamLengthHelper, LengthStream) MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() { return called; })); } -TEST(TestInputStreamLengthHelper, InvalidLengthStream) -{ +TEST(TestInputStreamLengthHelper, InvalidLengthStream) { nsCOMPtr stream = new LengthStream(42, NS_ERROR_NOT_AVAILABLE, 0, false); @@ -119,8 +116,7 @@ TEST(TestInputStreamLengthHelper, InvalidLengthStream) MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() { return called; })); } -TEST(TestInputStreamLengthHelper, AsyncLengthStream) -{ +TEST(TestInputStreamLengthHelper, AsyncLengthStream) { nsCOMPtr stream = new LengthStream(22, NS_BASE_STREAM_WOULD_BLOCK, 123, true); @@ -133,8 +129,7 @@ TEST(TestInputStreamLengthHelper, AsyncLengthStream) MOZ_ALWAYS_TRUE(SpinEventLoopUntil([&]() { return called; })); } -TEST(TestInputStreamLengthHelper, FallbackLengthStream) -{ +TEST(TestInputStreamLengthHelper, FallbackLengthStream) { nsCOMPtr stream = new LengthStream(-1, NS_BASE_STREAM_WOULD_BLOCK, 123, false); diff --git a/xpcom/tests/gtest/TestLogCommandLineHandler.cpp b/xpcom/tests/gtest/TestLogCommandLineHandler.cpp index dad8e917aadc..cd91e29d098f 100644 --- a/xpcom/tests/gtest/TestLogCommandLineHandler.cpp +++ b/xpcom/tests/gtest/TestLogCommandLineHandler.cpp @@ -21,8 +21,7 @@ constexpr size_t array_size(T (&)[N]) { return N; } -TEST(LogCommandLineHandler, Empty) -{ +TEST(LogCommandLineHandler, Empty) { bool callbackInvoked = false; auto callback = [&](nsACString const& env) mutable { callbackInvoked = true; @@ -36,8 +35,7 @@ TEST(LogCommandLineHandler, Empty) EXPECT_FALSE(callbackInvoked); } -TEST(LogCommandLineHandler, MOZ_LOG_regular) -{ +TEST(LogCommandLineHandler, MOZ_LOG_regular) { nsTArray results; auto callback = [&](nsACString const& env) mutable { @@ -70,8 +68,7 @@ TEST(LogCommandLineHandler, MOZ_LOG_regular) EXPECT_TRUE(NS_LITERAL_CSTRING("MOZ_LOG=modules").Equals(results[0])); } -TEST(LogCommandLineHandler, MOZ_LOG_and_FILE_regular) -{ +TEST(LogCommandLineHandler, MOZ_LOG_and_FILE_regular) { nsTArray results; auto callback = [&](nsACString const& env) mutable { @@ -117,8 +114,7 @@ TEST(LogCommandLineHandler, MOZ_LOG_and_FILE_regular) EXPECT_TRUE(NS_LITERAL_CSTRING("MOZ_LOG_FILE=file").Equals(results[1])); } -TEST(LogCommandLineHandler, MOZ_LOG_fuzzy) -{ +TEST(LogCommandLineHandler, MOZ_LOG_fuzzy) { nsTArray results; auto callback = [&](nsACString const& env) mutable { @@ -151,8 +147,7 @@ TEST(LogCommandLineHandler, MOZ_LOG_fuzzy) EXPECT_TRUE(results.Length() == 0); } -TEST(LogCommandLineHandler, MOZ_LOG_overlapping) -{ +TEST(LogCommandLineHandler, MOZ_LOG_overlapping) { nsTArray results; auto callback = [&](nsACString const& env) mutable { diff --git a/xpcom/tests/gtest/TestMoveString.cpp b/xpcom/tests/gtest/TestMoveString.cpp index cdfacdbbac42..fb71d0bf43e0 100644 --- a/xpcom/tests/gtest/TestMoveString.cpp +++ b/xpcom/tests/gtest/TestMoveString.cpp @@ -42,8 +42,7 @@ static void ExpectNew(const nsACString& aStr) { EXPECT_TRUE(aStr.EqualsASCII(NEW_VAL)); } -TEST(MoveString, SharedIntoOwned) -{ +TEST(MoveString, SharedIntoOwned) { nsCString out; SetAsOwned(out, OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::OWNED | Df::TERMINATED); @@ -61,8 +60,7 @@ TEST(MoveString, SharedIntoOwned) EXPECT_EQ(out.get(), data); } -TEST(MoveString, OwnedIntoOwned) -{ +TEST(MoveString, OwnedIntoOwned) { nsCString out; SetAsOwned(out, OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::OWNED | Df::TERMINATED); @@ -80,8 +78,7 @@ TEST(MoveString, OwnedIntoOwned) EXPECT_EQ(out.get(), data); } -TEST(MoveString, LiteralIntoOwned) -{ +TEST(MoveString, LiteralIntoOwned) { nsCString out; SetAsOwned(out, OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::OWNED | Df::TERMINATED); @@ -99,8 +96,7 @@ TEST(MoveString, LiteralIntoOwned) EXPECT_EQ(out.get(), data); } -TEST(MoveString, AutoIntoOwned) -{ +TEST(MoveString, AutoIntoOwned) { nsCString out; SetAsOwned(out, OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::OWNED | Df::TERMINATED); @@ -118,8 +114,7 @@ TEST(MoveString, AutoIntoOwned) EXPECT_NE(out.get(), data); } -TEST(MoveString, DepIntoOwned) -{ +TEST(MoveString, DepIntoOwned) { nsCString out; SetAsOwned(out, OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::OWNED | Df::TERMINATED); @@ -134,8 +129,7 @@ TEST(MoveString, DepIntoOwned) EXPECT_EQ(out.GetDataFlags(), Df::REFCOUNTED | Df::TERMINATED); } -TEST(MoveString, VoidIntoOwned) -{ +TEST(MoveString, VoidIntoOwned) { nsCString out; SetAsOwned(out, OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::OWNED | Df::TERMINATED); @@ -151,8 +145,7 @@ TEST(MoveString, VoidIntoOwned) EXPECT_EQ(out.GetDataFlags(), Df::VOIDED | Df::TERMINATED); } -TEST(MoveString, SharedIntoAuto) -{ +TEST(MoveString, SharedIntoAuto) { nsAutoCString out; out.Assign(OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::INLINE | Df::TERMINATED); @@ -170,8 +163,7 @@ TEST(MoveString, SharedIntoAuto) EXPECT_EQ(out.get(), data); } -TEST(MoveString, OwnedIntoAuto) -{ +TEST(MoveString, OwnedIntoAuto) { nsAutoCString out; out.Assign(OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::INLINE | Df::TERMINATED); @@ -189,8 +181,7 @@ TEST(MoveString, OwnedIntoAuto) EXPECT_EQ(out.get(), data); } -TEST(MoveString, LiteralIntoAuto) -{ +TEST(MoveString, LiteralIntoAuto) { nsAutoCString out; out.Assign(OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::INLINE | Df::TERMINATED); @@ -208,8 +199,7 @@ TEST(MoveString, LiteralIntoAuto) EXPECT_EQ(out.get(), data); } -TEST(MoveString, AutoIntoAuto) -{ +TEST(MoveString, AutoIntoAuto) { nsAutoCString out; out.Assign(OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::INLINE | Df::TERMINATED); @@ -227,8 +217,7 @@ TEST(MoveString, AutoIntoAuto) EXPECT_NE(out.get(), data); } -TEST(MoveString, DepIntoAuto) -{ +TEST(MoveString, DepIntoAuto) { nsAutoCString out; out.Assign(OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::INLINE | Df::TERMINATED); @@ -243,8 +232,7 @@ TEST(MoveString, DepIntoAuto) EXPECT_EQ(out.GetDataFlags(), Df::INLINE | Df::TERMINATED); } -TEST(MoveString, VoidIntoAuto) -{ +TEST(MoveString, VoidIntoAuto) { nsAutoCString out; out.Assign(OLD_VAL); EXPECT_EQ(out.GetDataFlags(), Df::INLINE | Df::TERMINATED); diff --git a/xpcom/tests/gtest/TestMozPromise.cpp b/xpcom/tests/gtest/TestMozPromise.cpp index 717469901464..5236cac184c3 100644 --- a/xpcom/tests/gtest/TestMozPromise.cpp +++ b/xpcom/tests/gtest/TestMozPromise.cpp @@ -86,24 +86,21 @@ void RunOnTaskQueue(TaskQueue* aQueue, FunctionType aFun) { return TestPromise::CreateAndReject(0, __func__); \ } -TEST(MozPromise, BasicResolve) -{ +TEST(MozPromise, BasicResolve) { AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue]() -> void { TestPromise::CreateAndResolve(42, __func__) - ->Then( - queue, __func__, - [queue](int aResolveValue) -> void { - EXPECT_EQ(aResolveValue, 42); - queue->BeginShutdown(); - }, - DO_FAIL); + ->Then(queue, __func__, + [queue](int aResolveValue) -> void { + EXPECT_EQ(aResolveValue, 42); + queue->BeginShutdown(); + }, + DO_FAIL); }); } -TEST(MozPromise, BasicReject) -{ +TEST(MozPromise, BasicReject) { AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue]() -> void { @@ -115,8 +112,7 @@ TEST(MozPromise, BasicReject) }); } -TEST(MozPromise, BasicResolveOrRejectResolved) -{ +TEST(MozPromise, BasicResolveOrRejectResolved) { AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue]() -> void { @@ -133,8 +129,7 @@ TEST(MozPromise, BasicResolveOrRejectResolved) }); } -TEST(MozPromise, BasicResolveOrRejectRejected) -{ +TEST(MozPromise, BasicResolveOrRejectRejected) { AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue]() -> void { @@ -151,8 +146,7 @@ TEST(MozPromise, BasicResolveOrRejectRejected) }); } -TEST(MozPromise, AsyncResolve) -{ +TEST(MozPromise, AsyncResolve) { AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue]() -> void { @@ -174,57 +168,51 @@ TEST(MozPromise, AsyncResolve) ref = c.get(); Unused << queue->Dispatch(ref.forget()); - p->Then( - queue, __func__, - [queue, a, b, c](int aResolveValue) -> void { - EXPECT_EQ(aResolveValue, 42); - a->Cancel(); - b->Cancel(); - c->Cancel(); - queue->BeginShutdown(); - }, - DO_FAIL); + p->Then(queue, __func__, + [queue, a, b, c](int aResolveValue) -> void { + EXPECT_EQ(aResolveValue, 42); + a->Cancel(); + b->Cancel(); + c->Cancel(); + queue->BeginShutdown(); + }, + DO_FAIL); }); } -TEST(MozPromise, CompletionPromises) -{ +TEST(MozPromise, CompletionPromises) { bool invokedPass = false; AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue, &invokedPass]() -> void { TestPromise::CreateAndResolve(40, __func__) - ->Then( - queue, __func__, - [](int aVal) -> RefPtr { - return TestPromise::CreateAndResolve(aVal + 10, __func__); - }, - DO_FAIL) - ->Then( - queue, __func__, - [&invokedPass](int aVal) { - invokedPass = true; - return TestPromise::CreateAndResolve(aVal, __func__); - }, - DO_FAIL) - ->Then( - queue, __func__, - [queue](int aVal) -> RefPtr { - RefPtr p = - new TestPromise::Private(__func__); - nsCOMPtr resolver = new DelayedResolveOrReject( - queue, p, RRValue::MakeResolve(aVal - 8), 10); - Unused << queue->Dispatch(resolver.forget()); - return RefPtr(p); - }, - DO_FAIL) - ->Then( - queue, __func__, - [](int aVal) -> RefPtr { - return TestPromise::CreateAndReject(double(aVal - 42) + 42.0, - __func__); - }, - DO_FAIL) + ->Then(queue, __func__, + [](int aVal) -> RefPtr { + return TestPromise::CreateAndResolve(aVal + 10, __func__); + }, + DO_FAIL) + ->Then(queue, __func__, + [&invokedPass](int aVal) { + invokedPass = true; + return TestPromise::CreateAndResolve(aVal, __func__); + }, + DO_FAIL) + ->Then(queue, __func__, + [queue](int aVal) -> RefPtr { + RefPtr p = + new TestPromise::Private(__func__); + nsCOMPtr resolver = new DelayedResolveOrReject( + queue, p, RRValue::MakeResolve(aVal - 8), 10); + Unused << queue->Dispatch(resolver.forget()); + return RefPtr(p); + }, + DO_FAIL) + ->Then(queue, __func__, + [](int aVal) -> RefPtr { + return TestPromise::CreateAndReject(double(aVal - 42) + 42.0, + __func__); + }, + DO_FAIL) ->Then(queue, __func__, DO_FAIL, [queue, &invokedPass](double aVal) -> void { EXPECT_EQ(aVal, 42.0); @@ -234,8 +222,7 @@ TEST(MozPromise, CompletionPromises) }); } -TEST(MozPromise, PromiseAllResolve) -{ +TEST(MozPromise, PromiseAllResolve) { AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue]() -> void { @@ -245,21 +232,19 @@ TEST(MozPromise, PromiseAllResolve) promises.AppendElement(TestPromise::CreateAndResolve(42, __func__)); TestPromise::All(queue, promises) - ->Then( - queue, __func__, - [queue](const nsTArray& aResolveValues) -> void { - EXPECT_EQ(aResolveValues.Length(), 3UL); - EXPECT_EQ(aResolveValues[0], 22); - EXPECT_EQ(aResolveValues[1], 32); - EXPECT_EQ(aResolveValues[2], 42); - queue->BeginShutdown(); - }, - []() { EXPECT_TRUE(false); }); + ->Then(queue, __func__, + [queue](const nsTArray& aResolveValues) -> void { + EXPECT_EQ(aResolveValues.Length(), 3UL); + EXPECT_EQ(aResolveValues[0], 22); + EXPECT_EQ(aResolveValues[1], 32); + EXPECT_EQ(aResolveValues[2], 42); + queue->BeginShutdown(); + }, + []() { EXPECT_TRUE(false); }); }); } -TEST(MozPromise, PromiseAllReject) -{ +TEST(MozPromise, PromiseAllReject) { AutoTaskQueue atq; RefPtr queue = atq.Queue(); RunOnTaskQueue(queue, [queue]() -> void { @@ -271,19 +256,17 @@ TEST(MozPromise, PromiseAllReject) promises.AppendElement(TestPromise::CreateAndReject(52.0, __func__)); TestPromise::All(queue, promises) - ->Then( - queue, __func__, []() { EXPECT_TRUE(false); }, - [queue](float aRejectValue) -> void { - EXPECT_EQ(aRejectValue, 32.0); - queue->BeginShutdown(); - }); + ->Then(queue, __func__, []() { EXPECT_TRUE(false); }, + [queue](float aRejectValue) -> void { + EXPECT_EQ(aRejectValue, 32.0); + queue->BeginShutdown(); + }); }); } // Test we don't hit the assertions in MozPromise when exercising promise // chaining upon task queue shutdown. -TEST(MozPromise, Chaining) -{ +TEST(MozPromise, Chaining) { // We declare this variable before |atq| to ensure // the destructor is run after |holder.Disconnect()|. MozPromiseRequestHolder holder; @@ -295,36 +278,31 @@ TEST(MozPromise, Chaining) auto p = TestPromise::CreateAndResolve(42, __func__); const size_t kIterations = 100; for (size_t i = 0; i < kIterations; ++i) { - p = p->Then( - queue, __func__, - [](int aVal) { - EXPECT_EQ(aVal, 42); - return TestPromise::CreateAndResolve(aVal, __func__); - }, - [](double aVal) { - return TestPromise::CreateAndReject(aVal, __func__); - }); + p = p->Then(queue, __func__, + [](int aVal) { + EXPECT_EQ(aVal, 42); + return TestPromise::CreateAndResolve(aVal, __func__); + }, + [](double aVal) { + return TestPromise::CreateAndReject(aVal, __func__); + }); if (i == kIterations / 2) { - p->Then( - queue, __func__, - [queue, &holder]() { - holder.Disconnect(); - queue->BeginShutdown(); - }, - DO_FAIL); + p->Then(queue, __func__, + [queue, &holder]() { + holder.Disconnect(); + queue->BeginShutdown(); + }, + DO_FAIL); } } // We will hit the assertion if we don't disconnect the leaf Request // in the promise chain. - p->Then( - queue, __func__, []() {}, []() {}) - ->Track(holder); + p->Then(queue, __func__, []() {}, []() {})->Track(holder); }); } -TEST(MozPromise, ResolveOrRejectValue) -{ +TEST(MozPromise, ResolveOrRejectValue) { using MyPromise = MozPromise, bool, false>; using RRValue = MyPromise::ResolveOrRejectValue; @@ -346,8 +324,7 @@ TEST(MozPromise, ResolveOrRejectValue) EXPECT_EQ(val.ResolveValue().get(), nullptr); } -TEST(MozPromise, MoveOnlyType) -{ +TEST(MozPromise, MoveOnlyType) { using MyPromise = MozPromise, bool, true>; using RRValue = MyPromise::ResolveOrRejectValue; @@ -355,9 +332,8 @@ TEST(MozPromise, MoveOnlyType) RefPtr queue = atq.Queue(); MyPromise::CreateAndResolve(MakeUnique(87), __func__) - ->Then( - queue, __func__, [](UniquePtr aVal) { EXPECT_EQ(87, *aVal); }, - []() { EXPECT_TRUE(false); }); + ->Then(queue, __func__, [](UniquePtr aVal) { EXPECT_EQ(87, *aVal); }, + []() { EXPECT_TRUE(false); }); MyPromise::CreateAndResolve(MakeUnique(87), __func__) ->Then(queue, __func__, [queue](RRValue&& aVal) { @@ -376,8 +352,7 @@ TEST(MozPromise, MoveOnlyType) }); } -TEST(MozPromise, HeterogeneousChaining) -{ +TEST(MozPromise, HeterogeneousChaining) { using Promise1 = MozPromise, bool, true>; using Promise2 = MozPromise, bool, true>; using RRValue1 = Promise1::ResolveOrRejectValue; @@ -405,18 +380,16 @@ TEST(MozPromise, HeterogeneousChaining) }); Promise1::CreateAndResolve(MakeUnique(87), __func__) - ->Then( - queue, __func__, - [](UniquePtr aVal) { - EXPECT_EQ(87, *aVal); - return Promise2::CreateAndResolve(MakeUnique(94), __func__); - }, - []() { - return Promise2::CreateAndResolve(MakeUnique(95), __func__); - }) - ->Then( - queue, __func__, [](UniquePtr aVal) { EXPECT_EQ(94, *aVal); }, - []() { EXPECT_FALSE(true); }); + ->Then(queue, __func__, + [](UniquePtr aVal) { + EXPECT_EQ(87, *aVal); + return Promise2::CreateAndResolve(MakeUnique(94), __func__); + }, + []() { + return Promise2::CreateAndResolve(MakeUnique(95), __func__); + }) + ->Then(queue, __func__, [](UniquePtr aVal) { EXPECT_EQ(94, *aVal); }, + []() { EXPECT_FALSE(true); }); Promise1::CreateAndResolve(MakeUnique(87), __func__) ->Then(queue, __func__, @@ -430,25 +403,21 @@ TEST(MozPromise, HeterogeneousChaining) }); } -TEST(MozPromise, XPCOMEventTarget) -{ +TEST(MozPromise, XPCOMEventTarget) { TestPromise::CreateAndResolve(42, __func__) - ->Then( - GetCurrentThreadSerialEventTarget(), __func__, - [](int aResolveValue) -> void { EXPECT_EQ(aResolveValue, 42); }, - DO_FAIL); + ->Then(GetCurrentThreadSerialEventTarget(), __func__, + [](int aResolveValue) -> void { EXPECT_EQ(aResolveValue, 42); }, + DO_FAIL); // Spin the event loop. NS_ProcessPendingEvents(nullptr); } -TEST(MozPromise, MessageLoopEventTarget) -{ +TEST(MozPromise, MessageLoopEventTarget) { TestPromise::CreateAndResolve(42, __func__) - ->Then( - MessageLoop::current()->SerialEventTarget(), __func__, - [](int aResolveValue) -> void { EXPECT_EQ(aResolveValue, 42); }, - DO_FAIL); + ->Then(MessageLoop::current()->SerialEventTarget(), __func__, + [](int aResolveValue) -> void { EXPECT_EQ(aResolveValue, 42); }, + DO_FAIL); // Spin the event loop. NS_ProcessPendingEvents(nullptr); diff --git a/xpcom/tests/gtest/TestMruCache.cpp b/xpcom/tests/gtest/TestMruCache.cpp index 5129c7983654..9b5ccb57a340 100644 --- a/xpcom/tests/gtest/TestMruCache.cpp +++ b/xpcom/tests/gtest/TestMruCache.cpp @@ -55,8 +55,7 @@ static nsCString MakeStringKey(char aKey) { return key; } -TEST(MruCache, TestNullChecker) -{ +TEST(MruCache, TestNullChecker) { using mozilla::detail::EmptyChecker; { @@ -85,8 +84,7 @@ TEST(MruCache, TestNullChecker) } } -TEST(MruCache, TestEmptyCache) -{ +TEST(MruCache, TestEmptyCache) { { // Test a basic empty cache. IntMap mru; @@ -128,8 +126,7 @@ TEST(MruCache, TestEmptyCache) } } -TEST(MruCache, TestPut) -{ +TEST(MruCache, TestPut) { IntMap mru; // Fill it up. @@ -147,8 +144,7 @@ TEST(MruCache, TestPut) } } -TEST(MruCache, TestPutConvertable) -{ +TEST(MruCache, TestPutConvertable) { UintPtrMap mru; // Fill it up. @@ -167,8 +163,7 @@ TEST(MruCache, TestPutConvertable) } } -TEST(MruCache, TestOverwriting) -{ +TEST(MruCache, TestOverwriting) { // Test overwrting IntMap mru; @@ -187,8 +182,7 @@ TEST(MruCache, TestOverwriting) } } -TEST(MruCache, TestRemove) -{ +TEST(MruCache, TestRemove) { { IntMap mru; @@ -259,8 +253,7 @@ TEST(MruCache, TestRemove) } } -TEST(MruCache, TestClear) -{ +TEST(MruCache, TestClear) { IntMap mru; // Fill it up. @@ -280,8 +273,7 @@ TEST(MruCache, TestClear) } } -TEST(MruCache, TestLookupMissingAndSet) -{ +TEST(MruCache, TestLookupMissingAndSet) { IntMap mru; // Value not found. @@ -314,8 +306,7 @@ TEST(MruCache, TestLookupMissingAndSet) EXPECT_EQ(p.Data(), 2); } -TEST(MruCache, TestLookupAndOverwrite) -{ +TEST(MruCache, TestLookupAndOverwrite) { IntMap mru; // Set 1. @@ -340,8 +331,7 @@ TEST(MruCache, TestLookupAndOverwrite) EXPECT_EQ(p.Data(), 32); } -TEST(MruCache, TestLookupAndRemove) -{ +TEST(MruCache, TestLookupAndRemove) { IntMap mru; // Set 1. @@ -359,8 +349,7 @@ TEST(MruCache, TestLookupAndRemove) EXPECT_FALSE(p); } -TEST(MruCache, TestLookupNotMatchedAndRemove) -{ +TEST(MruCache, TestLookupNotMatchedAndRemove) { IntMap mru; // Set 1. @@ -379,8 +368,7 @@ TEST(MruCache, TestLookupNotMatchedAndRemove) EXPECT_EQ(p.Data(), 1); } -TEST(MruCache, TestLookupAndSetWithMove) -{ +TEST(MruCache, TestLookupAndSetWithMove) { StringStructMap mru; const nsCString key = MakeStringKey((char)1); diff --git a/xpcom/tests/gtest/TestMultiplexInputStream.cpp b/xpcom/tests/gtest/TestMultiplexInputStream.cpp index 7c53d0951c90..f3cdd2268b3b 100644 --- a/xpcom/tests/gtest/TestMultiplexInputStream.cpp +++ b/xpcom/tests/gtest/TestMultiplexInputStream.cpp @@ -14,8 +14,7 @@ #include "nsThreadUtils.h" #include "Helpers.h" -TEST(MultiplexInputStream, Seek_SET) -{ +TEST(MultiplexInputStream, Seek_SET) { nsCString buf1; nsCString buf2; nsCString buf3; @@ -131,8 +130,7 @@ static already_AddRefed CreateStreamHelper() { } // AsyncWait - without EventTarget -TEST(TestMultiplexInputStream, AsyncWait_withoutEventTarget) -{ +TEST(TestMultiplexInputStream, AsyncWait_withoutEventTarget) { nsCOMPtr is = CreateStreamHelper(); nsCOMPtr ais = do_QueryInterface(is); @@ -145,8 +143,7 @@ TEST(TestMultiplexInputStream, AsyncWait_withoutEventTarget) } // AsyncWait - with EventTarget -TEST(TestMultiplexInputStream, AsyncWait_withEventTarget) -{ +TEST(TestMultiplexInputStream, AsyncWait_withEventTarget) { nsCOMPtr is = CreateStreamHelper(); nsCOMPtr ais = do_QueryInterface(is); @@ -165,8 +162,7 @@ TEST(TestMultiplexInputStream, AsyncWait_withEventTarget) } // AsyncWait - without EventTarget - closureOnly -TEST(TestMultiplexInputStream, AsyncWait_withoutEventTarget_closureOnly) -{ +TEST(TestMultiplexInputStream, AsyncWait_withoutEventTarget_closureOnly) { nsCOMPtr is = CreateStreamHelper(); nsCOMPtr ais = do_QueryInterface(is); @@ -183,8 +179,7 @@ TEST(TestMultiplexInputStream, AsyncWait_withoutEventTarget_closureOnly) } // AsyncWait - withEventTarget - closureOnly -TEST(TestMultiplexInputStream, AsyncWait_withEventTarget_closureOnly) -{ +TEST(TestMultiplexInputStream, AsyncWait_withEventTarget_closureOnly) { nsCOMPtr is = CreateStreamHelper(); nsCOMPtr ais = do_QueryInterface(is); @@ -299,8 +294,7 @@ class AsyncStream final : public nsIAsyncInputStream { NS_IMPL_ISUPPORTS(AsyncStream, nsIInputStream, nsIAsyncInputStream) -TEST(TestMultiplexInputStream, Available) -{ +TEST(TestMultiplexInputStream, Available) { nsCOMPtr multiplexStream = do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1"); @@ -397,8 +391,7 @@ class NonBufferableStringStream final : public nsIInputStream { NS_IMPL_ISUPPORTS(NonBufferableStringStream, nsIInputStream) -TEST(TestMultiplexInputStream, Bufferable) -{ +TEST(TestMultiplexInputStream, Bufferable) { nsCOMPtr multiplexStream = do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1"); @@ -433,8 +426,7 @@ TEST(TestMultiplexInputStream, Bufferable) ASSERT_TRUE(!strncmp(buf3, "Hello world", size)); } -TEST(TestMultiplexInputStream, QILengthInputStream) -{ +TEST(TestMultiplexInputStream, QILengthInputStream) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -494,8 +486,7 @@ TEST(TestMultiplexInputStream, QILengthInputStream) } } -TEST(TestMultiplexInputStream, LengthInputStream) -{ +TEST(TestMultiplexInputStream, LengthInputStream) { nsCOMPtr multiplexStream = do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1"); diff --git a/xpcom/tests/gtest/TestNSPRLogModulesParser.cpp b/xpcom/tests/gtest/TestNSPRLogModulesParser.cpp index e055aeeea59d..ecc93ddc7fb0 100644 --- a/xpcom/tests/gtest/TestNSPRLogModulesParser.cpp +++ b/xpcom/tests/gtest/TestNSPRLogModulesParser.cpp @@ -10,8 +10,7 @@ using namespace mozilla; -TEST(NSPRLogModulesParser, Empty) -{ +TEST(NSPRLogModulesParser, Empty) { bool callbackInvoked = false; auto callback = [&](const char*, mozilla::LogLevel, int32_t) mutable { callbackInvoked = true; @@ -24,8 +23,7 @@ TEST(NSPRLogModulesParser, Empty) EXPECT_FALSE(callbackInvoked); } -TEST(NSPRLogModulesParser, DefaultLevel) -{ +TEST(NSPRLogModulesParser, DefaultLevel) { bool callbackInvoked = false; auto callback = [&](const char* aName, mozilla::LogLevel aLevel, int32_t) { EXPECT_STREQ("Foo", aName); @@ -41,8 +39,7 @@ TEST(NSPRLogModulesParser, DefaultLevel) EXPECT_TRUE(callbackInvoked); } -TEST(NSPRLogModulesParser, LevelSpecified) -{ +TEST(NSPRLogModulesParser, LevelSpecified) { std::pair expected[] = { {"Foo:0", mozilla::LogLevel::Disabled}, {"Foo:1", mozilla::LogLevel::Error}, @@ -70,8 +67,7 @@ TEST(NSPRLogModulesParser, LevelSpecified) } } -TEST(NSPRLogModulesParser, Multiple) -{ +TEST(NSPRLogModulesParser, Multiple) { std::pair expected[] = { {"timestamp", mozilla::LogLevel::Error}, {"Foo", mozilla::LogLevel::Info}, @@ -98,8 +94,7 @@ TEST(NSPRLogModulesParser, Multiple) EXPECT_EQ(kExpectedCount, count); } -TEST(NSPRLogModulesParser, RawArg) -{ +TEST(NSPRLogModulesParser, RawArg) { bool callbackInvoked = false; auto callback = [&](const char* aName, mozilla::LogLevel aLevel, int32_t aRawValue) { diff --git a/xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp b/xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp index d4c27f59d952..51e99e377eca 100644 --- a/xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp +++ b/xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp @@ -7,8 +7,7 @@ #include "nsStringStream.h" #include "Helpers.h" -TEST(TestNonBlockingAsyncInputStream, Simple) -{ +TEST(TestNonBlockingAsyncInputStream, Simple) { nsCString data; data.Assign("Hello world!"); @@ -70,8 +69,7 @@ static nsresult ReadSegmentsFunction(nsIInputStream* aInStr, void* aClosure, return NS_OK; } -TEST(TestNonBlockingAsyncInputStream, ReadSegments) -{ +TEST(TestNonBlockingAsyncInputStream, ReadSegments) { nsCString data; data.Assign("Hello world!"); @@ -96,8 +94,7 @@ TEST(TestNonBlockingAsyncInputStream, ReadSegments) ASSERT_TRUE(data.Equals(nsCString(buffer, read))); } -TEST(TestNonBlockingAsyncInputStream, AsyncWait_Simple) -{ +TEST(TestNonBlockingAsyncInputStream, AsyncWait_Simple) { nsCString data; data.Assign("Hello world!"); @@ -141,8 +138,8 @@ TEST(TestNonBlockingAsyncInputStream, AsyncWait_Simple) ASSERT_TRUE(data.Equals(nsCString(buffer, read))); } -TEST(TestNonBlockingAsyncInputStream, AsyncWait_ClosureOnly_withoutEventTarget) -{ +TEST(TestNonBlockingAsyncInputStream, + AsyncWait_ClosureOnly_withoutEventTarget) { nsCString data; data.Assign("Hello world!"); @@ -169,8 +166,7 @@ TEST(TestNonBlockingAsyncInputStream, AsyncWait_ClosureOnly_withoutEventTarget) ASSERT_TRUE(cb->Called()); } -TEST(TestNonBlockingAsyncInputStream, AsyncWait_ClosureOnly_withEventTarget) -{ +TEST(TestNonBlockingAsyncInputStream, AsyncWait_ClosureOnly_withEventTarget) { nsCString data; data.Assign("Hello world!"); @@ -201,8 +197,7 @@ TEST(TestNonBlockingAsyncInputStream, AsyncWait_ClosureOnly_withEventTarget) ASSERT_TRUE(cb->Called()); } -TEST(TestNonBlockingAsyncInputStream, Helper) -{ +TEST(TestNonBlockingAsyncInputStream, Helper) { nsCString data; data.Assign("Hello world!"); @@ -319,8 +314,7 @@ NS_INTERFACE_MAP_BEGIN(QIInputStream) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream) NS_INTERFACE_MAP_END -TEST(TestNonBlockingAsyncInputStream, QI) -{ +TEST(TestNonBlockingAsyncInputStream, QI) { // Let's test ::Create() returning error. nsCOMPtr async; diff --git a/xpcom/tests/gtest/TestNsDeque.cpp b/xpcom/tests/gtest/TestNsDeque.cpp index 9e18a9e53151..b6f080f8436b 100644 --- a/xpcom/tests/gtest/TestNsDeque.cpp +++ b/xpcom/tests/gtest/TestNsDeque.cpp @@ -59,8 +59,7 @@ class ForEachAdder : public nsDequeFunctor { using namespace TestNsDeque; -TEST(NsDeque, OriginalTest) -{ +TEST(NsDeque, OriginalTest) { const size_t size = 200; int ints[size]; size_t i = 0; @@ -137,8 +136,7 @@ TEST(NsDeque, OriginalTest) EXPECT_EQ(0u, theDeque.GetSize()) << "Deque should finish empty."; } -TEST(NsDeque, OriginalFlaw) -{ +TEST(NsDeque, OriginalFlaw) { int ints[200]; int i = 0; int temp; @@ -174,8 +172,7 @@ TEST(NsDeque, OriginalFlaw) } } -TEST(NsDeque, TestObjectAt) -{ +TEST(NsDeque, TestObjectAt) { nsDeque d; const int count = 10; int ints[count]; @@ -197,8 +194,7 @@ TEST(NsDeque, TestObjectAt) } } -TEST(NsDeque, TestPushFront) -{ +TEST(NsDeque, TestPushFront) { // PushFront has some interesting corner cases, primarily we're interested in // whether: // - wrapping around works properly @@ -252,8 +248,7 @@ static void CheckIfQueueEmpty(nsDeque& d) { << "Invalid operation should return nullptr"; } -TEST(NsDeque, TestEmpty) -{ +TEST(NsDeque, TestEmpty) { // Make sure nsDeque gives sane results if it's empty. nsDeque d; size_t numberOfEntries = 8; @@ -275,8 +270,7 @@ TEST(NsDeque, TestEmpty) CheckIfQueueEmpty(d); } -TEST(NsDeque, TestEraseMethod) -{ +TEST(NsDeque, TestEraseMethod) { nsDeque d; const size_t numberOfEntries = 8; @@ -292,8 +286,7 @@ TEST(NsDeque, TestEraseMethod) CheckIfQueueEmpty(d); } -TEST(NsDeque, TestEraseShouldCallDeallocator) -{ +TEST(NsDeque, TestEraseShouldCallDeallocator) { nsDeque d(new Deallocator()); const size_t NumTestValues = 8; @@ -315,8 +308,7 @@ TEST(NsDeque, TestEraseShouldCallDeallocator) } } -TEST(NsDeque, TestForEach) -{ +TEST(NsDeque, TestForEach) { nsDeque d(new Deallocator()); const size_t NumTestValues = 8; int sum = 0; @@ -336,8 +328,7 @@ TEST(NsDeque, TestForEach) d.Erase(); } -TEST(NsDeque, TestConstRangeFor) -{ +TEST(NsDeque, TestConstRangeFor) { nsDeque d(new Deallocator()); const size_t NumTestValues = 3; @@ -359,8 +350,7 @@ TEST(NsDeque, TestConstRangeFor) EXPECT_EQ(1 + 2 + 3, sum) << "Const-range-for should iterate over values"; } -TEST(NsDeque, TestRangeFor) -{ +TEST(NsDeque, TestRangeFor) { const size_t NumTestValues = 3; struct Test { size_t runAfterLoopCount; diff --git a/xpcom/tests/gtest/TestNsRefPtr.cpp b/xpcom/tests/gtest/TestNsRefPtr.cpp index 3c70842ce29e..cab656216662 100644 --- a/xpcom/tests/gtest/TestNsRefPtr.cpp +++ b/xpcom/tests/gtest/TestNsRefPtr.cpp @@ -192,8 +192,7 @@ void Bar::VirtualConstMemberFunction(int aArg1, int* aArgPtr, using namespace TestNsRefPtr; -TEST(nsRefPtr, AddRefAndRelease) -{ +TEST(nsRefPtr, AddRefAndRelease) { Foo::total_constructions_ = 0; Foo::total_destructions_ = 0; @@ -240,8 +239,7 @@ TEST(nsRefPtr, AddRefAndRelease) } } -TEST(nsRefPtr, VirtualDestructor) -{ +TEST(nsRefPtr, VirtualDestructor) { Bar::total_destructions_ = 0; { @@ -252,8 +250,7 @@ TEST(nsRefPtr, VirtualDestructor) ASSERT_EQ(Bar::total_destructions_, 1); } -TEST(nsRefPtr, Equality) -{ +TEST(nsRefPtr, Equality) { Foo::total_constructions_ = 0; Foo::total_destructions_ = 0; @@ -290,8 +287,7 @@ TEST(nsRefPtr, Equality) ASSERT_EQ(Foo::total_destructions_, 2); } -TEST(nsRefPtr, AddRefHelpers) -{ +TEST(nsRefPtr, AddRefHelpers) { Foo::total_addrefs_ = 0; { @@ -323,8 +319,7 @@ TEST(nsRefPtr, AddRefHelpers) } } -TEST(nsRefPtr, QueryInterface) -{ +TEST(nsRefPtr, QueryInterface) { Foo::total_queries_ = 0; Bar::total_queries_ = 0; @@ -397,8 +392,7 @@ static void AnFooPtrPtrContext(Foo**) {} static void AVoidPtrPtrContext(void**) {} } // namespace TestNsRefPtr -TEST(nsRefPtr, RefPtrCompilationTests) -{ +TEST(nsRefPtr, RefPtrCompilationTests) { { RefPtr fooP; diff --git a/xpcom/tests/gtest/TestObserverArray.cpp b/xpcom/tests/gtest/TestObserverArray.cpp index c13334dec8c9..87c28a647a99 100644 --- a/xpcom/tests/gtest/TestObserverArray.cpp +++ b/xpcom/tests/gtest/TestObserverArray.cpp @@ -29,8 +29,7 @@ typedef nsTObserverArray IntArray; << "During test " << testNum << ", iterator finished too early"; \ } while (0) -TEST(ObserverArray, Tests) -{ +TEST(ObserverArray, Tests) { IntArray arr; arr.AppendElement(3); arr.AppendElement(4); @@ -81,11 +80,10 @@ TEST(ObserverArray, Tests) // Removals + Appends static int test14Expected[] = {4, 6, 7}; - DO_TEST( - ForwardIterator, test14Expected, if (count == 1) { - arr.RemoveElementAt(1); - arr.AppendElement(7); - }); + DO_TEST(ForwardIterator, test14Expected, if (count == 1) { + arr.RemoveElementAt(1); + arr.AppendElement(7); + }); DO_TEST(ForwardIterator, test14Expected, {/* nothing */}); arr.AppendElement(2); @@ -93,11 +91,10 @@ TEST(ObserverArray, Tests) DO_TEST(ForwardIterator, test16Expected, {/* nothing */}); static int test17Expected[] = {4, 7, 2}; - DO_TEST( - EndLimitedIterator, test17Expected, if (count == 1) { - arr.RemoveElementAt(1); - arr.AppendElement(8); - }); + DO_TEST(EndLimitedIterator, test17Expected, if (count == 1) { + arr.RemoveElementAt(1); + arr.AppendElement(8); + }); static int test18Expected[] = {4, 7, 2, 8}; DO_TEST(ForwardIterator, test18Expected, {/* nothing */}); @@ -110,9 +107,8 @@ TEST(ObserverArray, Tests) arr.PrependElementUnlessExists(7); DO_TEST(ForwardIterator, test19Expected, {/* nothing */}); - DO_TEST( - ForwardIterator, test19Expected, - if (count == 1) { arr.PrependElementUnlessExists(9); }); + DO_TEST(ForwardIterator, test19Expected, + if (count == 1) { arr.PrependElementUnlessExists(9); }); static int test22Expected[] = {9, 3, 4, 7, 2, 8}; DO_TEST(ForwardIterator, test22Expected, {}); diff --git a/xpcom/tests/gtest/TestObserverService.cpp b/xpcom/tests/gtest/TestObserverService.cpp index 1ed00b16c9ba..e5502ba5c0e3 100644 --- a/xpcom/tests/gtest/TestObserverService.cpp +++ b/xpcom/tests/gtest/TestObserverService.cpp @@ -93,8 +93,7 @@ static void TestExpectedCount(nsIObserverService* svc, const char* topic, EXPECT_EQ(count, expected); } -TEST(ObserverService, Creation) -{ +TEST(ObserverService, Creation) { nsresult rv; nsCOMPtr svc = do_CreateInstance("@mozilla.org/observer-service;1", &rv); @@ -103,8 +102,7 @@ TEST(ObserverService, Creation) ASSERT_TRUE(svc); } -TEST(ObserverService, AddObserver) -{ +TEST(ObserverService, AddObserver) { nsCOMPtr svc = do_CreateInstance("@mozilla.org/observer-service;1"); @@ -119,8 +117,7 @@ TEST(ObserverService, AddObserver) testResult(rv); } -TEST(ObserverService, RemoveObserver) -{ +TEST(ObserverService, RemoveObserver) { nsCOMPtr svc = do_CreateInstance("@mozilla.org/observer-service;1"); @@ -146,8 +143,7 @@ TEST(ObserverService, RemoveObserver) ASSERT_TRUE(NS_FAILED(rv)); } -TEST(ObserverService, EnumerateEmpty) -{ +TEST(ObserverService, EnumerateEmpty) { nsCOMPtr svc = do_CreateInstance("@mozilla.org/observer-service;1"); @@ -161,8 +157,7 @@ TEST(ObserverService, EnumerateEmpty) TestExpectedCount(svc, "A", 0); } -TEST(ObserverService, Enumerate) -{ +TEST(ObserverService, Enumerate) { nsCOMPtr svc = do_CreateInstance("@mozilla.org/observer-service;1"); @@ -185,8 +180,7 @@ TEST(ObserverService, Enumerate) TestExpectedCount(svc, "Bar", kBarCount); } -TEST(ObserverService, EnumerateWeakRefs) -{ +TEST(ObserverService, EnumerateWeakRefs) { nsCOMPtr svc = do_CreateInstance("@mozilla.org/observer-service;1"); @@ -224,8 +218,7 @@ TEST(ObserverService, EnumerateWeakRefs) TestExpectedCount(svc, "Foo", kFooCount + 2); } -TEST(ObserverService, TestNotify) -{ +TEST(ObserverService, TestNotify) { nsCString topicA; topicA.Assign("topic-A"); nsCString topicB; diff --git a/xpcom/tests/gtest/TestPLDHash.cpp b/xpcom/tests/gtest/TestPLDHash.cpp index bfd74b2d4827..abea40b96dd8 100644 --- a/xpcom/tests/gtest/TestPLDHash.cpp +++ b/xpcom/tests/gtest/TestPLDHash.cpp @@ -104,8 +104,7 @@ static void InitCapacityOk_EntrySizeTooBig() { PLDHashTable t(PLDHashTable::StubOps(), 256); } -TEST(PLDHashTableTest, InitCapacityOk) -{ +TEST(PLDHashTableTest, InitCapacityOk) { // Try the largest allowed capacity. With kMaxCapacity==1<<26, this // would allocate (if we added an element) 0.5GB of entry store on 32-bit // platforms and 1GB on 64-bit platforms. @@ -135,8 +134,7 @@ TEST(PLDHashTableTest, InitCapacityOk) // platforms, so such a test wouldn't be reliable. } -TEST(PLDHashTableTest, LazyStorage) -{ +TEST(PLDHashTableTest, LazyStorage) { PLDHashTable t(PLDHashTable::StubOps(), sizeof(PLDHashEntryStub)); // PLDHashTable allocates entry storage lazily. Check that all the non-add @@ -176,8 +174,7 @@ static const PLDHashTableOps trivialOps = { TrivialHash, PLDHashTable::MatchEntryStub, PLDHashTable::MoveEntryStub, PLDHashTable::ClearEntryStub, TrivialInitEntry}; -TEST(PLDHashTableTest, MoveSemantics) -{ +TEST(PLDHashTableTest, MoveSemantics) { PLDHashTable t1(&trivialOps, sizeof(PLDHashEntryStub)); t1.Add((const void*)88); PLDHashTable t2(&trivialOps, sizeof(PLDHashEntryStub)); @@ -214,8 +211,7 @@ TEST(PLDHashTableTest, MoveSemantics) PLDHashTable t10(std::move(t9)); // new table constructed with inited } -TEST(PLDHashTableTest, Clear) -{ +TEST(PLDHashTableTest, Clear) { PLDHashTable t1(&trivialOps, sizeof(PLDHashEntryStub)); t1.Clear(); @@ -243,8 +239,7 @@ TEST(PLDHashTableTest, Clear) ASSERT_EQ(t1.EntryCount(), 0u); } -TEST(PLDHashTableTest, Iterator) -{ +TEST(PLDHashTableTest, Iterator) { PLDHashTable t(&trivialOps, sizeof(PLDHashEntryStub)); // Explicitly test the move constructor. We do this because, due to copy @@ -340,8 +335,7 @@ TEST(PLDHashTableTest, Iterator) // // Also, it's slow, and so should always be last. #ifdef HAVE_64BIT_BUILD -TEST(PLDHashTableTest, GrowToMaxCapacity) -{ +TEST(PLDHashTableTest, GrowToMaxCapacity) { // This is infallible. PLDHashTable* t = new PLDHashTable(&trivialOps, sizeof(PLDHashEntryStub), 128); diff --git a/xpcom/tests/gtest/TestPipes.cpp b/xpcom/tests/gtest/TestPipes.cpp index 175b39586e55..9c8e33d373f6 100644 --- a/xpcom/tests/gtest/TestPipes.cpp +++ b/xpcom/tests/gtest/TestPipes.cpp @@ -294,8 +294,7 @@ class nsPump final : public nsIRunnable { NS_IMPL_ISUPPORTS(nsPump, nsIRunnable) -TEST(Pipes, ChainedPipes) -{ +TEST(Pipes, ChainedPipes) { nsresult rv; if (gTrace) { printf("TestChainedPipes\n"); @@ -376,8 +375,7 @@ static void RunTests(uint32_t segSize, uint32_t segCount) { EXPECT_TRUE(NS_SUCCEEDED(rv)); } -TEST(Pipes, Main) -{ +TEST(Pipes, Main) { RunTests(16, 1); RunTests(4096, 16); } @@ -409,14 +407,11 @@ static void TestPipe2(uint32_t aNumBytes, } // namespace -TEST(Pipes, Blocking_32k) -{ TestPipe2(32 * 1024); } +TEST(Pipes, Blocking_32k) { TestPipe2(32 * 1024); } -TEST(Pipes, Blocking_64k) -{ TestPipe2(64 * 1024); } +TEST(Pipes, Blocking_64k) { TestPipe2(64 * 1024); } -TEST(Pipes, Blocking_128k) -{ TestPipe2(128 * 1024); } +TEST(Pipes, Blocking_128k) { TestPipe2(128 * 1024); } //////////////////////////////////////////////////////////////////////////////// @@ -579,8 +574,7 @@ static void TestPipeClone(uint32_t aTotalBytes, uint32_t aNumWrites, } // namespace -TEST(Pipes, Clone_BeforeWrite_ReadAtEnd) -{ +TEST(Pipes, Clone_BeforeWrite_ReadAtEnd) { TestPipeClone(32 * 1024, // total bytes 16, // num writes 3, // num initial clones @@ -589,8 +583,7 @@ TEST(Pipes, Clone_BeforeWrite_ReadAtEnd) 0); // num streams to read after each write } -TEST(Pipes, Clone_BeforeWrite_ReadDuringWrite) -{ +TEST(Pipes, Clone_BeforeWrite_ReadDuringWrite) { // Since this reads all streams on every write, it should trigger the // pipe cursor roll back optimization. Currently we can only verify // this with logging. @@ -603,8 +596,7 @@ TEST(Pipes, Clone_BeforeWrite_ReadDuringWrite) 4); // num streams to read after each write } -TEST(Pipes, Clone_DuringWrite_ReadAtEnd) -{ +TEST(Pipes, Clone_DuringWrite_ReadAtEnd) { TestPipeClone(32 * 1024, // total bytes 16, // num writes 0, // num initial clones @@ -613,8 +605,7 @@ TEST(Pipes, Clone_DuringWrite_ReadAtEnd) 0); // num streams to read after each write } -TEST(Pipes, Clone_DuringWrite_ReadDuringWrite) -{ +TEST(Pipes, Clone_DuringWrite_ReadDuringWrite) { TestPipeClone(32 * 1024, // total bytes 16, // num writes 0, // num initial clones @@ -623,8 +614,7 @@ TEST(Pipes, Clone_DuringWrite_ReadDuringWrite) 1); // num streams to read after each write } -TEST(Pipes, Clone_DuringWrite_ReadDuringWrite_CloseDuringWrite) -{ +TEST(Pipes, Clone_DuringWrite_ReadDuringWrite_CloseDuringWrite) { // Since this reads streams faster than we clone new ones, it should // trigger pipe segment deletion periodically. Currently we can // only verify this with logging. @@ -637,8 +627,7 @@ TEST(Pipes, Clone_DuringWrite_ReadDuringWrite_CloseDuringWrite) 3); // num streams to read after each write } -TEST(Pipes, Write_AsyncWait) -{ +TEST(Pipes, Write_AsyncWait) { nsCOMPtr reader; nsCOMPtr writer; @@ -673,8 +662,7 @@ TEST(Pipes, Write_AsyncWait) ASSERT_TRUE(cb->Called()); } -TEST(Pipes, Write_AsyncWait_Clone) -{ +TEST(Pipes, Write_AsyncWait_Clone) { nsCOMPtr reader; nsCOMPtr writer; @@ -756,8 +744,7 @@ TEST(Pipes, Write_AsyncWait_Clone) testing::ConsumeAndValidateStream(reader, inputData); } -TEST(Pipes, Write_AsyncWait_Clone_CloseOriginal) -{ +TEST(Pipes, Write_AsyncWait_Clone_CloseOriginal) { nsCOMPtr reader; nsCOMPtr writer; @@ -881,8 +868,7 @@ TEST(Pipes, Write_AsyncWait_Clone_CloseOriginal) ASSERT_TRUE(cb->Called()); } -TEST(Pipes, Read_AsyncWait) -{ +TEST(Pipes, Read_AsyncWait) { nsCOMPtr reader; nsCOMPtr writer; @@ -913,8 +899,7 @@ TEST(Pipes, Read_AsyncWait) testing::ConsumeAndValidateStream(reader, inputData); } -TEST(Pipes, Read_AsyncWait_Clone) -{ +TEST(Pipes, Read_AsyncWait_Clone) { nsCOMPtr reader; nsCOMPtr writer; @@ -1021,14 +1006,13 @@ void TestCloseDuringRead(uint32_t aSegmentSize, uint32_t aDataSize) { } // namespace -TEST(Pipes, Close_During_Read_Partial_Segment) -{ TestCloseDuringRead(1024, 512); } +TEST(Pipes, Close_During_Read_Partial_Segment) { + TestCloseDuringRead(1024, 512); +} -TEST(Pipes, Close_During_Read_Full_Segment) -{ TestCloseDuringRead(1024, 1024); } +TEST(Pipes, Close_During_Read_Full_Segment) { TestCloseDuringRead(1024, 1024); } -TEST(Pipes, Interfaces) -{ +TEST(Pipes, Interfaces) { nsCOMPtr reader; nsCOMPtr writer; diff --git a/xpcom/tests/gtest/TestPriorityQueue.cpp b/xpcom/tests/gtest/TestPriorityQueue.cpp index 48b78ccf958d..afcbf69ddc59 100644 --- a/xpcom/tests/gtest/TestPriorityQueue.cpp +++ b/xpcom/tests/gtest/TestPriorityQueue.cpp @@ -31,8 +31,7 @@ class MaxCompare { bool LessThan(const A& a, const A& b) { return a > b; } }; -TEST(PriorityQueue, Main) -{ +TEST(PriorityQueue, Main) { nsTPriorityQueue queue; EXPECT_TRUE(queue.IsEmpty()); diff --git a/xpcom/tests/gtest/TestRWLock.cpp b/xpcom/tests/gtest/TestRWLock.cpp index 2a8078380386..3d15d9ff904e 100644 --- a/xpcom/tests/gtest/TestRWLock.cpp +++ b/xpcom/tests/gtest/TestRWLock.cpp @@ -60,8 +60,7 @@ RWLockRunnable::Run() { return NS_OK; } -TEST(RWLock, SmokeTest) -{ +TEST(RWLock, SmokeTest) { nsCOMPtr threads[sNumThreads]; RWLock rwlock("test lock"); mozilla::Atomic data(0); diff --git a/xpcom/tests/gtest/TestRacingServiceManager.cpp b/xpcom/tests/gtest/TestRacingServiceManager.cpp index cfbb14c32ebc..61cb248461e1 100644 --- a/xpcom/tests/gtest/TestRacingServiceManager.cpp +++ b/xpcom/tests/gtest/TestRacingServiceManager.cpp @@ -222,8 +222,7 @@ static const mozilla::Module::ContractIDEntry kLocalContracts[] = { static const mozilla::Module kLocalModule = {mozilla::Module::kVersion, kLocalCIDs, kLocalContracts}; -TEST(RacingServiceManager, Test) -{ +TEST(RacingServiceManager, Test) { nsresult rv; XRE_AddStaticComponent(&kLocalModule); diff --git a/xpcom/tests/gtest/TestRecursiveMutex.cpp b/xpcom/tests/gtest/TestRecursiveMutex.cpp index 3f0557aed312..063fd460ae55 100644 --- a/xpcom/tests/gtest/TestRecursiveMutex.cpp +++ b/xpcom/tests/gtest/TestRecursiveMutex.cpp @@ -14,8 +14,7 @@ using mozilla::RecursiveMutexAutoLock; // Basic test to make sure the underlying implementation of RecursiveMutex is, // well, actually recursively acquirable. -TEST(RecursiveMutex, SmokeTest) -{ +TEST(RecursiveMutex, SmokeTest) { RecursiveMutex mutex("testing mutex"); RecursiveMutexAutoLock lock1(mutex); diff --git a/xpcom/tests/gtest/TestSlicedInputStream.cpp b/xpcom/tests/gtest/TestSlicedInputStream.cpp index c14856b4d23e..004e3d081a39 100644 --- a/xpcom/tests/gtest/TestSlicedInputStream.cpp +++ b/xpcom/tests/gtest/TestSlicedInputStream.cpp @@ -137,8 +137,7 @@ static SlicedInputStream* CreateNonSeekableStreams(uint32_t aSize, } // Same start, same length. -TEST(TestSlicedInputStream, Simple) -{ +TEST(TestSlicedInputStream, Simple) { const size_t kBufSize = 4096; nsCString buf; @@ -157,8 +156,7 @@ TEST(TestSlicedInputStream, Simple) } // Simple sliced stream - seekable -TEST(TestSlicedInputStream, Sliced) -{ +TEST(TestSlicedInputStream, Sliced) { const size_t kBufSize = 4096; nsCString buf; @@ -176,8 +174,7 @@ TEST(TestSlicedInputStream, Sliced) } // Simple sliced stream - non seekable -TEST(TestSlicedInputStream, SlicedNoSeek) -{ +TEST(TestSlicedInputStream, SlicedNoSeek) { const size_t kBufSize = 4096; nsCString buf; @@ -196,8 +193,7 @@ TEST(TestSlicedInputStream, SlicedNoSeek) } // Big inputStream - seekable -TEST(TestSlicedInputStream, BigSliced) -{ +TEST(TestSlicedInputStream, BigSliced) { const size_t kBufSize = 4096 * 40; nsCString buf; @@ -217,8 +213,7 @@ TEST(TestSlicedInputStream, BigSliced) } // Big inputStream - non seekable -TEST(TestSlicedInputStream, BigSlicedNoSeek) -{ +TEST(TestSlicedInputStream, BigSlicedNoSeek) { const size_t kBufSize = 4096 * 40; nsCString buf; @@ -238,8 +233,7 @@ TEST(TestSlicedInputStream, BigSlicedNoSeek) } // Available size. -TEST(TestSlicedInputStream, Available) -{ +TEST(TestSlicedInputStream, Available) { nsCString buf; RefPtr sis = CreateNonSeekableStreams(500000, 4, 400000, buf); @@ -271,8 +265,7 @@ TEST(TestSlicedInputStream, Available) } // What if start is > then the size of the buffer? -TEST(TestSlicedInputStream, StartBiggerThan) -{ +TEST(TestSlicedInputStream, StartBiggerThan) { nsCString buf; RefPtr sis = CreateNonSeekableStreams(500, 4000, 1, buf); @@ -287,8 +280,7 @@ TEST(TestSlicedInputStream, StartBiggerThan) } // What if the length is > than the size of the buffer? -TEST(TestSlicedInputStream, LengthBiggerThan) -{ +TEST(TestSlicedInputStream, LengthBiggerThan) { nsCString buf; RefPtr sis = CreateNonSeekableStreams(500, 0, 500000, buf); @@ -303,8 +295,7 @@ TEST(TestSlicedInputStream, LengthBiggerThan) } // What if the length is 0? -TEST(TestSlicedInputStream, Length0) -{ +TEST(TestSlicedInputStream, Length0) { nsCString buf; RefPtr sis = CreateNonSeekableStreams(500, 0, 0, buf); @@ -319,8 +310,7 @@ TEST(TestSlicedInputStream, Length0) } // Seek test NS_SEEK_SET -TEST(TestSlicedInputStream, Seek_SET) -{ +TEST(TestSlicedInputStream, Seek_SET) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -345,8 +335,7 @@ TEST(TestSlicedInputStream, Seek_SET) } // Seek test NS_SEEK_CUR -TEST(TestSlicedInputStream, Seek_CUR) -{ +TEST(TestSlicedInputStream, Seek_CUR) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -378,8 +367,7 @@ TEST(TestSlicedInputStream, Seek_CUR) } // Seek test NS_SEEK_END - length > real one -TEST(TestSlicedInputStream, Seek_END_Bigger) -{ +TEST(TestSlicedInputStream, Seek_END_Bigger) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -417,8 +405,7 @@ TEST(TestSlicedInputStream, Seek_END_Bigger) } // Seek test NS_SEEK_END - length < real one -TEST(TestSlicedInputStream, Seek_END_Lower) -{ +TEST(TestSlicedInputStream, Seek_END_Lower) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -444,8 +431,7 @@ TEST(TestSlicedInputStream, Seek_END_Lower) } // Check the nsIAsyncInputStream interface -TEST(TestSlicedInputStream, NoAsyncInputStream) -{ +TEST(TestSlicedInputStream, NoAsyncInputStream) { const size_t kBufSize = 4096; nsCString buf; @@ -457,8 +443,7 @@ TEST(TestSlicedInputStream, NoAsyncInputStream) ASSERT_TRUE(!async); } -TEST(TestSlicedInputStream, AsyncInputStream) -{ +TEST(TestSlicedInputStream, AsyncInputStream) { nsCOMPtr reader; nsCOMPtr writer; @@ -505,8 +490,7 @@ TEST(TestSlicedInputStream, AsyncInputStream) testing::ConsumeAndValidateStream(async, inputData); } -TEST(TestSlicedInputStream, QIInputStreamLength) -{ +TEST(TestSlicedInputStream, QIInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -531,8 +515,7 @@ TEST(TestSlicedInputStream, QIInputStreamLength) } } -TEST(TestSlicedInputStream, InputStreamLength) -{ +TEST(TestSlicedInputStream, InputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -553,8 +536,7 @@ TEST(TestSlicedInputStream, InputStreamLength) ASSERT_EQ(5, size); } -TEST(TestSlicedInputStream, NegativeInputStreamLength) -{ +TEST(TestSlicedInputStream, NegativeInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -575,8 +557,7 @@ TEST(TestSlicedInputStream, NegativeInputStreamLength) ASSERT_EQ(-1, size); } -TEST(TestSlicedInputStream, AsyncInputStreamLength) -{ +TEST(TestSlicedInputStream, AsyncInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -601,8 +582,7 @@ TEST(TestSlicedInputStream, AsyncInputStreamLength) ASSERT_EQ(5, callback->Size()); } -TEST(TestSlicedInputStream, NegativeAsyncInputStreamLength) -{ +TEST(TestSlicedInputStream, NegativeAsyncInputStreamLength) { nsCString buf; buf.AssignLiteral("Hello world"); @@ -627,8 +607,7 @@ TEST(TestSlicedInputStream, NegativeAsyncInputStreamLength) ASSERT_EQ(-1, callback->Size()); } -TEST(TestSlicedInputStream, AbortLengthCallback) -{ +TEST(TestSlicedInputStream, AbortLengthCallback) { nsCString buf; buf.AssignLiteral("Hello world"); diff --git a/xpcom/tests/gtest/TestSnappyStreams.cpp b/xpcom/tests/gtest/TestSnappyStreams.cpp index f105de3f7638..3fe94ba3e7a0 100644 --- a/xpcom/tests/gtest/TestSnappyStreams.cpp +++ b/xpcom/tests/gtest/TestSnappyStreams.cpp @@ -98,56 +98,53 @@ static void TestUncompressCorrupt(const char* aCorruptData, } // namespace -TEST(SnappyStream, Compress_32k) -{ TestCompress(32 * 1024); } +TEST(SnappyStream, Compress_32k) { TestCompress(32 * 1024); } -TEST(SnappyStream, Compress_64k) -{ TestCompress(64 * 1024); } +TEST(SnappyStream, Compress_64k) { TestCompress(64 * 1024); } -TEST(SnappyStream, Compress_128k) -{ TestCompress(128 * 1024); } +TEST(SnappyStream, Compress_128k) { TestCompress(128 * 1024); } -TEST(SnappyStream, CompressUncompress_0) -{ TestCompressUncompress(0); } +TEST(SnappyStream, CompressUncompress_0) { TestCompressUncompress(0); } -TEST(SnappyStream, CompressUncompress_1) -{ TestCompressUncompress(1); } +TEST(SnappyStream, CompressUncompress_1) { TestCompressUncompress(1); } -TEST(SnappyStream, CompressUncompress_32) -{ TestCompressUncompress(32); } +TEST(SnappyStream, CompressUncompress_32) { TestCompressUncompress(32); } -TEST(SnappyStream, CompressUncompress_1k) -{ TestCompressUncompress(1024); } +TEST(SnappyStream, CompressUncompress_1k) { TestCompressUncompress(1024); } -TEST(SnappyStream, CompressUncompress_32k) -{ TestCompressUncompress(32 * 1024); } +TEST(SnappyStream, CompressUncompress_32k) { + TestCompressUncompress(32 * 1024); +} -TEST(SnappyStream, CompressUncompress_64k) -{ TestCompressUncompress(64 * 1024); } +TEST(SnappyStream, CompressUncompress_64k) { + TestCompressUncompress(64 * 1024); +} -TEST(SnappyStream, CompressUncompress_128k) -{ TestCompressUncompress(128 * 1024); } +TEST(SnappyStream, CompressUncompress_128k) { + TestCompressUncompress(128 * 1024); +} // Test buffers that are not exactly power-of-2 in length to try to // exercise more edge cases. The number 13 is arbitrary. -TEST(SnappyStream, CompressUncompress_256k_less_13) -{ TestCompressUncompress((256 * 1024) - 13); } +TEST(SnappyStream, CompressUncompress_256k_less_13) { + TestCompressUncompress((256 * 1024) - 13); +} -TEST(SnappyStream, CompressUncompress_256k) -{ TestCompressUncompress(256 * 1024); } +TEST(SnappyStream, CompressUncompress_256k) { + TestCompressUncompress(256 * 1024); +} -TEST(SnappyStream, CompressUncompress_256k_plus_13) -{ TestCompressUncompress((256 * 1024) + 13); } +TEST(SnappyStream, CompressUncompress_256k_plus_13) { + TestCompressUncompress((256 * 1024) + 13); +} -TEST(SnappyStream, UncompressCorruptStreamIdentifier) -{ +TEST(SnappyStream, UncompressCorruptStreamIdentifier) { static const char data[] = "This is not a valid compressed stream"; TestUncompressCorrupt(data, strlen(data)); } -TEST(SnappyStream, UncompressCorruptCompressedDataLength) -{ +TEST(SnappyStream, UncompressCorruptCompressedDataLength) { static const char data[] = "\xff\x06\x00\x00sNaPpY" // stream identifier "\x00\x99\x00\x00This is not a valid compressed stream"; @@ -155,8 +152,7 @@ TEST(SnappyStream, UncompressCorruptCompressedDataLength) TestUncompressCorrupt(data, dataLength); } -TEST(SnappyStream, UncompressCorruptCompressedDataContent) -{ +TEST(SnappyStream, UncompressCorruptCompressedDataContent) { static const char data[] = "\xff\x06\x00\x00sNaPpY" // stream identifier "\x00\x25\x00\x00This is not a valid compressed stream"; diff --git a/xpcom/tests/gtest/TestStateWatching.cpp b/xpcom/tests/gtest/TestStateWatching.cpp index 804a907050a9..a7b37b5c1063 100644 --- a/xpcom/tests/gtest/TestStateWatching.cpp +++ b/xpcom/tests/gtest/TestStateWatching.cpp @@ -25,8 +25,7 @@ struct Foo { ~Foo() {} }; -TEST(WatchManager, Shutdown) -{ +TEST(WatchManager, Shutdown) { RefPtr queue = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)); diff --git a/xpcom/tests/gtest/TestStorageStream.cpp b/xpcom/tests/gtest/TestStorageStream.cpp index 8cfc16dc1b50..136bcd5d2d85 100644 --- a/xpcom/tests/gtest/TestStorageStream.cpp +++ b/xpcom/tests/gtest/TestStorageStream.cpp @@ -26,8 +26,7 @@ void WriteData(nsIOutputStream* aOut, nsTArray& aData, uint32_t aNumBytes, } // namespace -TEST(StorageStreams, Main) -{ +TEST(StorageStreams, Main) { // generate some test data we will write in 4k chunks to the stream nsTArray kData; testing::CreateData(4096, kData); @@ -91,8 +90,7 @@ TEST(StorageStreams, Main) in = nullptr; } -TEST(StorageStreams, EarlyInputStream) -{ +TEST(StorageStreams, EarlyInputStream) { // generate some test data we will write in 4k chunks to the stream nsTArray kData; testing::CreateData(4096, kData); diff --git a/xpcom/tests/gtest/TestStringStream.cpp b/xpcom/tests/gtest/TestStringStream.cpp index 36e3fffd88ec..bbae5218c9a9 100644 --- a/xpcom/tests/gtest/TestStringStream.cpp +++ b/xpcom/tests/gtest/TestStringStream.cpp @@ -52,8 +52,6 @@ static void TestStringStreamClone(uint32_t aNumBytes) { } // namespace -TEST(StringStream, Simple_4k) -{ TestStringStream(1024 * 4); } +TEST(StringStream, Simple_4k) { TestStringStream(1024 * 4); } -TEST(StringStream, Clone_4k) -{ TestStringStreamClone(1024 * 4); } +TEST(StringStream, Clone_4k) { TestStringStreamClone(1024 * 4); } diff --git a/xpcom/tests/gtest/TestStrings.cpp b/xpcom/tests/gtest/TestStrings.cpp index dd7f4b80a227..497b6c71c6de 100644 --- a/xpcom/tests/gtest/TestStrings.cpp +++ b/xpcom/tests/gtest/TestStrings.cpp @@ -1304,8 +1304,7 @@ static void test_parse_string_helper2(const char* str, char separator, test_parse_string_helper(str, separator, 2, s1, s2); } -TEST(String, parse_string) -{ +TEST(String, parse_string) { test_parse_string_helper1("foo, bar", '_', "foo, bar"); test_parse_string_helper2("foo, bar", ',', "foo", " bar"); test_parse_string_helper2("foo, bar ", ' ', "foo,", "bar"); @@ -1323,8 +1322,7 @@ static void test_strip_chars_helper(const char16_t* str, const char16_t* strip, EXPECT_TRUE(data.Equals(result)); } -TEST(String, strip_chars) -{ +TEST(String, strip_chars) { test_strip_chars_helper(u"foo \r \nbar", u" \n\r", NS_LITERAL_STRING("foobar")); test_strip_chars_helper(u"\r\nfoo\r\n", u" \n\r", NS_LITERAL_STRING("foo")); diff --git a/xpcom/tests/gtest/TestSynchronization.cpp b/xpcom/tests/gtest/TestSynchronization.cpp index e4865321a62d..d1da58f8f4aa 100644 --- a/xpcom/tests/gtest/TestSynchronization.cpp +++ b/xpcom/tests/gtest/TestSynchronization.cpp @@ -20,8 +20,7 @@ static PRThread* spawn(void (*run)(void*), void* arg) { //----------------------------------------------------------------------------- // Sanity check: tests that can be done on a single thread // -TEST(Synchronization, Sanity) -{ +TEST(Synchronization, Sanity) { Mutex lock("sanity::lock"); lock.Lock(); lock.AssertCurrentThreadOwns(); @@ -66,8 +65,7 @@ static void MutexContention_thread(void* /*arg*/) { } } -TEST(Synchronization, MutexContention) -{ +TEST(Synchronization, MutexContention) { gLock1 = new Mutex("lock1"); // PURPOSELY not checking for OOM. YAY! @@ -95,8 +93,7 @@ static void MonitorContention_thread(void* /*arg*/) { } } -TEST(Synchronization, MonitorContention) -{ +TEST(Synchronization, MonitorContention) { gMon1 = new Monitor("mon1"); PRThread* t1 = spawn(MonitorContention_thread, nullptr); @@ -126,8 +123,7 @@ static void MonitorContention2_thread(void* /*arg*/) { } } -TEST(Synchronization, MonitorContention2) -{ +TEST(Synchronization, MonitorContention2) { gMon2 = new ReentrantMonitor("mon1"); PRThread* t1 = spawn(MonitorContention2_thread, nullptr); @@ -161,8 +157,7 @@ static void MonitorSyncSanity_thread(void* /*arg*/) { gMon3->Exit(); } -TEST(Synchronization, MonitorSyncSanity) -{ +TEST(Synchronization, MonitorSyncSanity) { gMon3 = new ReentrantMonitor("monitor::syncsanity"); for (int32_t i = 0; i < 10000; ++i) { @@ -196,8 +191,7 @@ static void CondVarSanity_thread(void* /*arg*/) { gCvlock1->Unlock(); } -TEST(Synchronization, CondVarSanity) -{ +TEST(Synchronization, CondVarSanity) { gCvlock1 = new Mutex("cvlock1"); gCv1 = new CondVar(*gCvlock1, "cvlock1"); @@ -216,8 +210,7 @@ TEST(Synchronization, CondVarSanity) //----------------------------------------------------------------------------- // AutoLock tests // -TEST(Synchronization, AutoLock) -{ +TEST(Synchronization, AutoLock) { Mutex l1("autolock"); MutexAutoLock autol1(l1); @@ -237,8 +230,7 @@ TEST(Synchronization, AutoLock) //----------------------------------------------------------------------------- // AutoUnlock tests // -TEST(Synchronization, AutoUnlock) -{ +TEST(Synchronization, AutoUnlock) { Mutex l1("autounlock"); Mutex l2("autounlock2"); @@ -264,8 +256,7 @@ TEST(Synchronization, AutoUnlock) //----------------------------------------------------------------------------- // AutoMonitor tests // -TEST(Synchronization, AutoMonitor) -{ +TEST(Synchronization, AutoMonitor) { ReentrantMonitor m1("automonitor"); ReentrantMonitor m2("automonitor2"); diff --git a/xpcom/tests/gtest/TestTArray.cpp b/xpcom/tests/gtest/TestTArray.cpp index 4a52707adba2..edd7276436f5 100644 --- a/xpcom/tests/gtest/TestTArray.cpp +++ b/xpcom/tests/gtest/TestTArray.cpp @@ -79,8 +79,7 @@ static const nsTArray& FakeHugeArray() { } #endif -TEST(TArray, AppendElementsRvalue) -{ +TEST(TArray, AppendElementsRvalue) { nsTArray array; nsTArray temp(DummyArray()); @@ -97,8 +96,7 @@ TEST(TArray, AppendElementsRvalue) ASSERT_TRUE(temp.IsEmpty()); } -TEST(TArray, Assign) -{ +TEST(TArray, Assign) { nsTArray array; array.Assign(DummyArray()); ASSERT_EQ(DummyArray(), array); @@ -116,8 +114,7 @@ TEST(TArray, Assign) ASSERT_EQ(DummyArray(), array2); } -TEST(TArray, AssignmentOperatorSelfAssignment) -{ +TEST(TArray, AssignmentOperatorSelfAssignment) { nsTArray array; array = DummyArray(); @@ -135,8 +132,7 @@ TEST(TArray, AssignmentOperatorSelfAssignment) #endif } -TEST(TArray, CopyOverlappingForwards) -{ +TEST(TArray, CopyOverlappingForwards) { const size_t rangeLength = 8; const size_t initialLength = 2 * rangeLength; uint32_t destructionCounters[initialLength]; @@ -163,8 +159,7 @@ TEST(TArray, CopyOverlappingForwards) // The code to copy overlapping regions had a bug in that it wouldn't correctly // destroy all over the source elements being copied. -TEST(TArray, CopyOverlappingBackwards) -{ +TEST(TArray, CopyOverlappingBackwards) { const size_t rangeLength = 8; const size_t initialLength = 2 * rangeLength; uint32_t destructionCounters[initialLength]; @@ -196,8 +191,7 @@ TEST(TArray, CopyOverlappingBackwards) } } -TEST(TArray, UnorderedRemoveElements) -{ +TEST(TArray, UnorderedRemoveElements) { // When removing an element from the end of the array, it can be removed in // place, by destroying it and decrementing the length. // @@ -316,8 +310,7 @@ TEST(TArray, UnorderedRemoveElements) } } -TEST(TArray, RemoveFromEnd) -{ +TEST(TArray, RemoveFromEnd) { { nsTArray array{1, 2, 3, 4}; ASSERT_EQ(array.PopLastElement(), 4); diff --git a/xpcom/tests/gtest/TestTArray2.cpp b/xpcom/tests/gtest/TestTArray2.cpp index e123f4556753..5f92ac8a8816 100644 --- a/xpcom/tests/gtest/TestTArray2.cpp +++ b/xpcom/tests/gtest/TestTArray2.cpp @@ -82,42 +82,34 @@ static bool test_basic_array(ElementType* data, size_t dataLen, if (ary.Length() != (oldLen - 1)) return false; if (!(ary == ary)) return false; - if (ary.ApplyIf( - extra, []() { return true; }, []() { return false; })) + if (ary.ApplyIf(extra, []() { return true; }, []() { return false; })) return false; - if (ary.ApplyIf( - extra, [](size_t) { return true; }, []() { return false; })) + if (ary.ApplyIf(extra, [](size_t) { return true; }, []() { return false; })) return false; // On a non-const array, ApplyIf's first lambda may use either const or non- // const element types. - if (ary.ApplyIf( - extra, [](ElementType&) { return true; }, []() { return false; })) + if (ary.ApplyIf(extra, [](ElementType&) { return true; }, + []() { return false; })) return false; - if (ary.ApplyIf( - extra, [](const ElementType&) { return true; }, - []() { return false; })) + if (ary.ApplyIf(extra, [](const ElementType&) { return true; }, + []() { return false; })) return false; - if (ary.ApplyIf( - extra, [](size_t, ElementType&) { return true; }, - []() { return false; })) + if (ary.ApplyIf(extra, [](size_t, ElementType&) { return true; }, + []() { return false; })) return false; - if (ary.ApplyIf( - extra, [](size_t, const ElementType&) { return true; }, - []() { return false; })) + if (ary.ApplyIf(extra, [](size_t, const ElementType&) { return true; }, + []() { return false; })) return false; - if (cary.ApplyIf( - extra, []() { return true; }, []() { return false; })) - if (cary.ApplyIf( - extra, [](size_t) { return true; }, []() { return false; })) + if (cary.ApplyIf(extra, []() { return true; }, []() { return false; })) + if (cary.ApplyIf(extra, [](size_t) { return true; }, + []() { return false; })) // On a const array, ApplyIf's first lambda must only use const element // types. - if (cary.ApplyIf( - extra, [](const ElementType&) { return true; }, - []() { return false; })) - if (cary.ApplyIf( - extra, [](size_t, const ElementType&) { return true; }, - []() { return false; })) + if (cary.ApplyIf(extra, [](const ElementType&) { return true; }, + []() { return false; })) + if (cary.ApplyIf(extra, [](size_t, const ElementType&) { return true; }, + []() { return false; })) return false; size_t index = ary.Length() / 2; @@ -129,19 +121,17 @@ static bool test_basic_array(ElementType* data, size_t dataLen, // ensure proper searching if (ary.IndexOf(extra) > ary.LastIndexOf(extra)) return false; if (ary.IndexOf(extra, index) != ary.LastIndexOf(extra, index)) return false; - if (!ary.ApplyIf( - extra, - [&](size_t i, const ElementType& e) { - return i == index && e == extra; - }, - []() { return false; })) + if (!ary.ApplyIf(extra, + [&](size_t i, const ElementType& e) { + return i == index && e == extra; + }, + []() { return false; })) return false; - if (!cary.ApplyIf( - extra, - [&](size_t i, const ElementType& e) { - return i == index && e == extra; - }, - []() { return false; })) + if (!cary.ApplyIf(extra, + [&](size_t i, const ElementType& e) { + return i == index && e == extra; + }, + []() { return false; })) return false; nsTArray copy(ary); @@ -158,11 +148,9 @@ static bool test_basic_array(ElementType* data, size_t dataLen, ary.Clear(); if (ary.IndexOf(extra) != ary.NoIndex) return false; if (ary.LastIndexOf(extra) != ary.NoIndex) return false; - if (ary.ApplyIf( - extra, []() { return true; }, []() { return false; })) + if (ary.ApplyIf(extra, []() { return true; }, []() { return false; })) return false; - if (cary.ApplyIf( - extra, []() { return true; }, []() { return false; })) + if (cary.ApplyIf(extra, []() { return true; }, []() { return false; })) return false; ary.Clear(); @@ -198,26 +186,22 @@ static bool test_basic_array(ElementType* data, size_t dataLen, return true; } -TEST(TArray, test_int_array) -{ +TEST(TArray, test_int_array) { int data[] = {4, 6, 8, 2, 4, 1, 5, 7, 3}; ASSERT_TRUE(test_basic_array(data, ArrayLength(data), int(14))); } -TEST(TArray, test_int64_array) -{ +TEST(TArray, test_int64_array) { int64_t data[] = {4, 6, 8, 2, 4, 1, 5, 7, 3}; ASSERT_TRUE(test_basic_array(data, ArrayLength(data), int64_t(14))); } -TEST(TArray, test_char_array) -{ +TEST(TArray, test_char_array) { char data[] = {4, 6, 8, 2, 4, 1, 5, 7, 3}; ASSERT_TRUE(test_basic_array(data, ArrayLength(data), char(14))); } -TEST(TArray, test_uint32_array) -{ +TEST(TArray, test_uint32_array) { uint32_t data[] = {4, 6, 8, 2, 4, 1, 5, 7, 3}; ASSERT_TRUE(test_basic_array(data, ArrayLength(data), uint32_t(14))); } @@ -254,8 +238,7 @@ class Object { uint32_t mNum; }; -TEST(TArray, test_object_array) -{ +TEST(TArray, test_object_array) { nsTArray objArray; const char kdata[] = "hello world"; size_t i; @@ -310,14 +293,12 @@ static nsTArray returns_by_value() { return result; } -TEST(TArray, test_return_by_value) -{ +TEST(TArray, test_return_by_value) { nsTArray result = returns_by_value(); ASSERT_TRUE(true); // This is just a compilation test. } -TEST(TArray, test_move_array) -{ +TEST(TArray, test_move_array) { nsTArray countableArray; uint32_t i; for (i = 0; i < 4; ++i) { @@ -433,8 +414,7 @@ TEST(TArray, test_move_array) //---- -TEST(TArray, test_string_array) -{ +TEST(TArray, test_string_array) { nsTArray strArray; const char kdata[] = "hello world"; size_t i; @@ -491,8 +471,7 @@ class nsFileNameComparator { } }; -TEST(TArray, test_comptr_array) -{ +TEST(TArray, test_comptr_array) { FilePointer tmpDir; NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpDir)); ASSERT_TRUE(tmpDir); @@ -508,9 +487,9 @@ TEST(TArray, test_comptr_array) } ASSERT_EQ(fileArray.IndexOf(kNames[1], 0, nsFileNameComparator()), size_t(1)); - ASSERT_TRUE(fileArray.ApplyIf( - kNames[1], 0, nsFileNameComparator(), [](size_t i) { return i == 1; }, - []() { return false; })); + ASSERT_TRUE(fileArray.ApplyIf(kNames[1], 0, nsFileNameComparator(), + [](size_t i) { return i == 1; }, + []() { return false; })); // It's unclear what 'operator<' means for nsCOMPtr, but whatever... ASSERT_TRUE( @@ -532,8 +511,7 @@ class RefcountedObject { int32_t rc; }; -TEST(TArray, test_refptr_array) -{ +TEST(TArray, test_refptr_array) { nsTArray > objArray; RefcountedObject* a = new RefcountedObject(); @@ -560,8 +538,7 @@ TEST(TArray, test_refptr_array) //---- -TEST(TArray, test_ptrarray) -{ +TEST(TArray, test_ptrarray) { nsTArray ary; ASSERT_EQ(ary.SafeElementAt(0), nullptr); ASSERT_EQ(ary.SafeElementAt(1000), nullptr); @@ -589,8 +566,7 @@ TEST(TArray, test_ptrarray) // This test relies too heavily on the existence of DebugGetHeader to be // useful in non-debug builds. #ifdef DEBUG -TEST(TArray, test_autoarray) -{ +TEST(TArray, test_autoarray) { uint32_t data[] = {4, 6, 8, 2, 4, 1, 5, 7, 3}; AutoTArray array; @@ -646,8 +622,7 @@ TEST(TArray, test_autoarray) // IndexOf used to potentially scan beyond the end of the array. Test for // this incorrect behavior by adding a value (5), removing it, then seeing // if IndexOf finds it. -TEST(TArray, test_indexof) -{ +TEST(TArray, test_indexof) { nsTArray array; array.AppendElement(0); // add and remove the 5 @@ -656,8 +631,8 @@ TEST(TArray, test_indexof) // we should not find the 5! auto no_index = array.NoIndex; // Fixes gtest compilation error. ASSERT_EQ(array.IndexOf(5, 1), no_index); - ASSERT_FALSE(array.ApplyIf( - 5, 1, []() { return true; }, []() { return false; })); + ASSERT_FALSE( + array.ApplyIf(5, 1, []() { return true; }, []() { return false; })); } //---- @@ -710,8 +685,7 @@ static bool is_heap(const Array& ary, size_t len) { } \ } while (0) -TEST(TArray, test_swap) -{ +TEST(TArray, test_swap) { // Test nsTArray::SwapElements. Unfortunately there are many cases. int data1[] = {8, 6, 7, 5}; int data2[] = {3, 0, 9}; @@ -937,8 +911,7 @@ TEST(TArray, test_swap) // Bug 1171296: Disabled on andoid due to crashes. #if !defined(ANDROID) -TEST(TArray, test_fallible) -{ +TEST(TArray, test_fallible) { // Test that FallibleTArray works properly; that is, it never OOMs, but // instead eventually returns false. // @@ -980,14 +953,12 @@ TEST(TArray, test_fallible) } } - ASSERT_TRUE(oomed) - << "Didn't OOM or crash? nsTArray::SetCapacity" - "must be lying."; + ASSERT_TRUE(oomed) << "Didn't OOM or crash? nsTArray::SetCapacity" + "must be lying."; } #endif -TEST(TArray, test_conversion_operator) -{ +TEST(TArray, test_conversion_operator) { FallibleTArray f; const FallibleTArray fconst; @@ -1031,8 +1002,7 @@ struct BufAccessor : public T { void* GetHdr() { return T::mHdr; } }; -TEST(TArray, test_SetLengthAndRetainStorage_no_ctor) -{ +TEST(TArray, test_SetLengthAndRetainStorage_no_ctor) { // 1050 because sizeof(int)*1050 is more than a page typically. const int N = 1050; FallibleTArray f; @@ -1134,8 +1104,7 @@ struct IntComparator { bool LessThan(int aLeft, int aRight) const { return aLeft < aRight; } }; -TEST(TArray, test_comparator_objects) -{ +TEST(TArray, test_comparator_objects) { ASSERT_TRUE(TestCompareMethods(IntComparator())); ASSERT_TRUE( TestCompareMethods([](int aLeft, int aRight) { return aLeft - aRight; })); @@ -1145,8 +1114,7 @@ struct Big { uint64_t size[40] = {}; }; -TEST(TArray, test_AutoTArray_SwapElements) -{ +TEST(TArray, test_AutoTArray_SwapElements) { AutoTArray oneArray; AutoTArray another; diff --git a/xpcom/tests/gtest/TestTaskQueue.cpp b/xpcom/tests/gtest/TestTaskQueue.cpp index 5e052e2c96ab..116e957724dd 100644 --- a/xpcom/tests/gtest/TestTaskQueue.cpp +++ b/xpcom/tests/gtest/TestTaskQueue.cpp @@ -14,8 +14,7 @@ namespace TestTaskQueue { using namespace mozilla; -TEST(TaskQueue, EventOrder) -{ +TEST(TaskQueue, EventOrder) { RefPtr tq1 = new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK), true); RefPtr tq2 = diff --git a/xpcom/tests/gtest/TestTextFormatter.cpp b/xpcom/tests/gtest/TestTextFormatter.cpp index e532b3c65b5c..fabcdc8d101f 100644 --- a/xpcom/tests/gtest/TestTextFormatter.cpp +++ b/xpcom/tests/gtest/TestTextFormatter.cpp @@ -7,8 +7,7 @@ #include "nsString.h" #include "gtest/gtest.h" -TEST(TextFormatter, Tests) -{ +TEST(TextFormatter, Tests) { nsAutoString fmt(NS_LITERAL_STRING("%3$s %4$S %1$d %2$d %2$d %3$s")); char utf8[] = "Hello"; char16_t ucs2[] = {'W', 'o', 'r', 'l', 'd', @@ -51,8 +50,7 @@ TEST(TextFormatter, Tests) * Check misordered parameters */ -TEST(TextFormatterOrdering, orders) -{ +TEST(TextFormatterOrdering, orders) { nsString out; // plain list @@ -103,8 +101,7 @@ TEST(TextFormatterOrdering, orders) * Tests to validate that horrible things don't happen if the passed-in * variable and the formatter don't match. */ -TEST(TextFormatterTestMismatch, format_d) -{ +TEST(TextFormatterTestMismatch, format_d) { nsString out; // just for completeness, this is our format, and works nsTextFormatter::ssprintf(out, u"%d", int(-1)); @@ -121,8 +118,7 @@ TEST(TextFormatterTestMismatch, format_d) #endif } -TEST(TextFormatterTestMismatch, format_u) -{ +TEST(TextFormatterTestMismatch, format_u) { nsString out; nsTextFormatter::ssprintf(out, u"%u", int(-1)); EXPECT_STREQ("4294967295", NS_ConvertUTF16toUTF8(out).get()); @@ -139,8 +135,7 @@ TEST(TextFormatterTestMismatch, format_u) #endif } -TEST(TextFormatterTestMismatch, format_x) -{ +TEST(TextFormatterTestMismatch, format_x) { nsString out; nsTextFormatter::ssprintf(out, u"%x", int32_t(-1)); EXPECT_STREQ("ffffffff", NS_ConvertUTF16toUTF8(out).get()); @@ -157,8 +152,7 @@ TEST(TextFormatterTestMismatch, format_x) #endif } -TEST(TextFormatterTestMismatch, format_s) -{ +TEST(TextFormatterTestMismatch, format_s) { nsString out; #ifndef DEBUG nsTextFormatter::ssprintf(out, u"%s", int(-1)); @@ -177,8 +171,7 @@ TEST(TextFormatterTestMismatch, format_s) #endif } -TEST(TextFormatterTestMismatch, format_S) -{ +TEST(TextFormatterTestMismatch, format_S) { nsString out; #ifndef DEBUG nsTextFormatter::ssprintf(out, u"%S", int32_t(-1)); @@ -195,8 +188,7 @@ TEST(TextFormatterTestMismatch, format_S) EXPECT_STREQ("foo", NS_ConvertUTF16toUTF8(out).get()); } -TEST(TextFormatterTestMismatch, format_c) -{ +TEST(TextFormatterTestMismatch, format_c) { nsString out; nsTextFormatter::ssprintf(out, u"%c", int32_t(-1)); EXPECT_EQ(1u, out.Length()); @@ -222,8 +214,7 @@ TEST(TextFormatterTestMismatch, format_c) EXPECT_EQ(u'c', out.CharAt(0)); } -TEST(TextFormatterTestResults, Tests) -{ +TEST(TextFormatterTestResults, Tests) { char16_t buf[10]; EXPECT_EQ( diff --git a/xpcom/tests/gtest/TestThreadManager.cpp b/xpcom/tests/gtest/TestThreadManager.cpp index b76523867577..0baafdc06baf 100644 --- a/xpcom/tests/gtest/TestThreadManager.cpp +++ b/xpcom/tests/gtest/TestThreadManager.cpp @@ -71,8 +71,7 @@ class CountRunnable final : public Runnable { Atomic& mCounter; }; -TEST(ThreadManager, SpinEventLoopUntilSuccess) -{ +TEST(ThreadManager, SpinEventLoopUntilSuccess) { const uint32_t kRunnablesToDispatch = 100; nsresult rv; mozilla::Atomic count(0); @@ -118,8 +117,7 @@ class ErrorCondition final : public nsINestedEventLoopCondition { NS_IMPL_ISUPPORTS(ErrorCondition, nsINestedEventLoopCondition) -TEST(ThreadManager, SpinEventLoopUntilError) -{ +TEST(ThreadManager, SpinEventLoopUntilError) { const uint32_t kRunnablesToDispatch = 100; nsresult rv; mozilla::Atomic count(0); diff --git a/xpcom/tests/gtest/TestThreadPool.cpp b/xpcom/tests/gtest/TestThreadPool.cpp index 21f5bdd8f502..ad51b986496c 100644 --- a/xpcom/tests/gtest/TestThreadPool.cpp +++ b/xpcom/tests/gtest/TestThreadPool.cpp @@ -47,8 +47,7 @@ NS_IMPL_ISUPPORTS(Task, nsIRunnable) mozilla::Atomic Task::sCount; -TEST(ThreadPool, Main) -{ +TEST(ThreadPool, Main) { nsCOMPtr pool = new nsThreadPool(); for (int i = 0; i < 100; ++i) { @@ -62,8 +61,7 @@ TEST(ThreadPool, Main) EXPECT_EQ(Task::sCount, 100); } -TEST(ThreadPool, Parallelism) -{ +TEST(ThreadPool, Parallelism) { nsCOMPtr pool = new nsThreadPool(); // Dispatch and sleep to ensure we have an idle thread @@ -123,8 +121,7 @@ TEST(ThreadPool, Parallelism) pool->Shutdown(); } -TEST(ThreadPool, ShutdownWithTimeout) -{ +TEST(ThreadPool, ShutdownWithTimeout) { Task::sCount = 0; nsCOMPtr pool = new nsThreadPool(); @@ -164,8 +161,7 @@ TEST(ThreadPool, ShutdownWithTimeout) EXPECT_EQ(Task::sCount, 3); } -TEST(ThreadPool, ShutdownWithTimeoutThenSleep) -{ +TEST(ThreadPool, ShutdownWithTimeoutThenSleep) { Task::sCount = 0; nsCOMPtr pool = new nsThreadPool(); diff --git a/xpcom/tests/gtest/TestThreadPoolListener.cpp b/xpcom/tests/gtest/TestThreadPoolListener.cpp index 85fd5cfd82de..cfa4bf13b527 100644 --- a/xpcom/tests/gtest/TestThreadPoolListener.cpp +++ b/xpcom/tests/gtest/TestThreadPoolListener.cpp @@ -120,8 +120,7 @@ class AutoCreateAndDestroyReentrantMonitor { ReentrantMonitor** mReentrantMonitorPtr; }; -TEST(ThreadPoolListener, Test) -{ +TEST(ThreadPoolListener, Test) { nsIThread* createdThreadList[NUMBER_OF_THREADS] = {nullptr}; gCreatedThreadList = createdThreadList; diff --git a/xpcom/tests/gtest/TestThreadUtils.cpp b/xpcom/tests/gtest/TestThreadUtils.cpp index 86718f260ec0..e75924f1c179 100644 --- a/xpcom/tests/gtest/TestThreadUtils.cpp +++ b/xpcom/tests/gtest/TestThreadUtils.cpp @@ -403,11 +403,11 @@ static void TestNewRunnableFunction(bool aNamed) { } } -TEST(ThreadUtils, NewRunnableFunction) -{ TestNewRunnableFunction(/*aNamed*/ false); } +TEST(ThreadUtils, NewRunnableFunction) { + TestNewRunnableFunction(/*aNamed*/ false); +} -TEST(ThreadUtils, NewNamedRunnableFunction) -{ +TEST(ThreadUtils, NewNamedRunnableFunction) { // The named overload shall behave identical to the non-named counterpart. TestNewRunnableFunction(/*aNamed*/ true); @@ -509,11 +509,9 @@ static void TestNewRunnableMethod(bool aNamed) { } } -TEST(ThreadUtils, RunnableMethod) -{ TestNewRunnableMethod(/* aNamed */ false); } +TEST(ThreadUtils, RunnableMethod) { TestNewRunnableMethod(/* aNamed */ false); } -TEST(ThreadUtils, NamedRunnableMethod) -{ +TEST(ThreadUtils, NamedRunnableMethod) { // The named overloads shall behave identical to the non-named counterparts. TestNewRunnableMethod(/* aNamed */ true); @@ -573,7 +571,7 @@ class IdleObject final { uint32_t index; for (index = 0; index < aNumExecuted; ++index) { ASSERT_TRUE(mRunnableExecuted[index]) - << aKey << ": Method" << index << " should've executed"; + << aKey << ": Method" << index << " should've executed"; } for (; index < ArrayLength(mRunnableExecuted); ++index) { @@ -656,8 +654,7 @@ class IdleObject final { ~IdleObject() {} }; -TEST(ThreadUtils, IdleRunnableMethod) -{ +TEST(ThreadUtils, IdleRunnableMethod) { { RefPtr idle = new IdleObject(); RefPtr idleNoSetDeadline = @@ -703,8 +700,7 @@ TEST(ThreadUtils, IdleRunnableMethod) } } -TEST(ThreadUtils, IdleTaskRunner) -{ +TEST(ThreadUtils, IdleTaskRunner) { using namespace mozilla; // Repeating. @@ -784,8 +780,7 @@ TEST(ThreadUtils, IdleTaskRunner) } \ } -TEST(ThreadUtils, TypeTraits) -{ +TEST(ThreadUtils, TypeTraits) { static_assert(!mozilla::IsRefcountedSmartPointer::value, "IsRefcountedSmartPointer should be false"); static_assert(mozilla::IsRefcountedSmartPointer>::value, @@ -1190,8 +1185,7 @@ class ThreadUtilsNonRefCounted {}; } // namespace TestThreadUtils -TEST(ThreadUtils, main) -{ +TEST(ThreadUtils, main) { using namespace TestThreadUtils; static_assert(!IsParameterStorageClass::value, diff --git a/xpcom/tests/gtest/TestThreads.cpp b/xpcom/tests/gtest/TestThreads.cpp index 31a7ba703852..69e4b3a80cc3 100644 --- a/xpcom/tests/gtest/TestThreads.cpp +++ b/xpcom/tests/gtest/TestThreads.cpp @@ -41,8 +41,7 @@ class nsRunner final : public nsIRunnable { NS_IMPL_ISUPPORTS(nsRunner, nsIRunnable) -TEST(Threads, Main) -{ +TEST(Threads, Main) { nsresult rv; nsCOMPtr event = new nsRunner(0); @@ -96,8 +95,7 @@ int32_t nsStressRunner::gNum = 0; NS_IMPL_ISUPPORTS(nsStressRunner, nsIRunnable) -TEST(Threads, Stress) -{ +TEST(Threads, Stress) { const int loops = 1000; const int threads = 50; @@ -207,8 +205,7 @@ class SameThreadSentinel : public nsIRunnable { NS_IMPL_ISUPPORTS(SameThreadSentinel, nsIRunnable) -TEST(Threads, AsyncShutdown) -{ +TEST(Threads, AsyncShutdown) { gAsyncShutdownReadyMonitor = new mozilla::Monitor("gAsyncShutdownReady"); gBeginAsyncShutdownMonitor = new mozilla::Monitor("gBeginAsyncShutdown"); @@ -239,8 +236,7 @@ static void threadProc(void* arg) { EXPECT_EQ(PR_JOINABLE_THREAD, PR_GetThreadState(PR_GetCurrentThread())); } -TEST(Threads, StressNSPR) -{ +TEST(Threads, StressNSPR) { const int loops = 1000; const int threads = 50; diff --git a/xpcom/tests/gtest/TestThrottledEventQueue.cpp b/xpcom/tests/gtest/TestThrottledEventQueue.cpp index 82e481d7c666..91691d6e50fb 100644 --- a/xpcom/tests/gtest/TestThrottledEventQueue.cpp +++ b/xpcom/tests/gtest/TestThrottledEventQueue.cpp @@ -103,8 +103,7 @@ static void Enqueue(nsIEventTarget* target, function&& aCallable) { using namespace TestThrottledEventQueue; -TEST(ThrottledEventQueue, RunnableQueue) -{ +TEST(ThrottledEventQueue, RunnableQueue) { string log; RefPtr queue = MakeRefPtr(); @@ -117,8 +116,7 @@ TEST(ThrottledEventQueue, RunnableQueue) ASSERT_EQ(log, "abc"); } -TEST(ThrottledEventQueue, SimpleDispatch) -{ +TEST(ThrottledEventQueue, SimpleDispatch) { string log; auto base = MakeRefPtr(); @@ -132,8 +130,7 @@ TEST(ThrottledEventQueue, SimpleDispatch) ASSERT_TRUE(throttled->IsEmpty()); } -TEST(ThrottledEventQueue, MixedDispatch) -{ +TEST(ThrottledEventQueue, MixedDispatch) { string log; auto base = MakeRefPtr(); @@ -177,8 +174,7 @@ TEST(ThrottledEventQueue, MixedDispatch) ASSERT_TRUE(throttled->IsEmpty()); } -TEST(ThrottledEventQueue, EnqueueFromRun) -{ +TEST(ThrottledEventQueue, EnqueueFromRun) { string log; auto base = MakeRefPtr(); @@ -202,8 +198,7 @@ TEST(ThrottledEventQueue, EnqueueFromRun) ASSERT_TRUE(throttled->IsEmpty()); } -TEST(ThrottledEventQueue, RunFromRun) -{ +TEST(ThrottledEventQueue, RunFromRun) { string log; auto base = MakeRefPtr(); @@ -228,8 +223,7 @@ TEST(ThrottledEventQueue, RunFromRun) ASSERT_TRUE(throttled->IsEmpty()); } -TEST(ThrottledEventQueue, DropWhileRunning) -{ +TEST(ThrottledEventQueue, DropWhileRunning) { string log; auto base = MakeRefPtr(); @@ -245,8 +239,7 @@ TEST(ThrottledEventQueue, DropWhileRunning) ASSERT_EQ(log, "a"); } -TEST(ThrottledEventQueue, AwaitIdle) -{ +TEST(ThrottledEventQueue, AwaitIdle) { Mutex mutex("TEQ AwaitIdle"); CondVar cond(mutex, "TEQ AwaitIdle"); @@ -301,8 +294,7 @@ TEST(ThrottledEventQueue, AwaitIdle) ASSERT_TRUE(NS_SUCCEEDED(thread->Shutdown())); } -TEST(ThrottledEventQueue, AwaitIdleMixed) -{ +TEST(ThrottledEventQueue, AwaitIdleMixed) { // Create a separate thread that waits for the queue to become idle, and // then takes observable action. nsCOMPtr thread; @@ -392,8 +384,7 @@ TEST(ThrottledEventQueue, AwaitIdleMixed) ASSERT_TRUE(NS_SUCCEEDED(thread->Shutdown())); } -TEST(ThrottledEventQueue, SimplePauseResume) -{ +TEST(ThrottledEventQueue, SimplePauseResume) { string log; auto base = MakeRefPtr(); @@ -427,8 +418,7 @@ TEST(ThrottledEventQueue, SimplePauseResume) ASSERT_TRUE(throttled->IsEmpty()); } -TEST(ThrottledEventQueue, MixedPauseResume) -{ +TEST(ThrottledEventQueue, MixedPauseResume) { string log; auto base = MakeRefPtr(); @@ -467,8 +457,7 @@ TEST(ThrottledEventQueue, MixedPauseResume) ASSERT_TRUE(throttled->IsEmpty()); } -TEST(ThrottledEventQueue, AwaitIdlePaused) -{ +TEST(ThrottledEventQueue, AwaitIdlePaused) { Mutex mutex("AwaitIdlePaused"); CondVar cond(mutex, "AwaitIdlePaused"); @@ -540,8 +529,7 @@ TEST(ThrottledEventQueue, AwaitIdlePaused) ASSERT_TRUE(NS_SUCCEEDED(thread->Shutdown())); } -TEST(ThrottledEventQueue, ExecutorTransitions) -{ +TEST(ThrottledEventQueue, ExecutorTransitions) { string log; auto base = MakeRefPtr(); diff --git a/xpcom/tests/gtest/TestTimeStamp.cpp b/xpcom/tests/gtest/TestTimeStamp.cpp index acd8ff575c5a..c8eddd28fc11 100644 --- a/xpcom/tests/gtest/TestTimeStamp.cpp +++ b/xpcom/tests/gtest/TestTimeStamp.cpp @@ -14,8 +14,7 @@ using mozilla::TimeDuration; using mozilla::TimeStamp; -TEST(TimeStamp, Main) -{ +TEST(TimeStamp, Main) { TimeDuration td; EXPECT_TRUE(td.ToSeconds() == 0.0); EXPECT_TRUE(TimeDuration::FromSeconds(5).ToSeconds() == 5.0); diff --git a/xpcom/tests/gtest/TestTimers.cpp b/xpcom/tests/gtest/TestTimers.cpp index 528c9afc2d0e..355bc0b1d304 100644 --- a/xpcom/tests/gtest/TestTimers.cpp +++ b/xpcom/tests/gtest/TestTimers.cpp @@ -94,8 +94,7 @@ class TimerCallback final : public nsITimerCallback { NS_IMPL_ISUPPORTS(TimerCallback, nsITimerCallback) -TEST(Timers, TargetedTimers) -{ +TEST(Timers, TargetedTimers) { AutoCreateAndDestroyReentrantMonitor newMon; ASSERT_TRUE(newMon); @@ -122,8 +121,7 @@ TEST(Timers, TargetedTimers) ASSERT_EQ(notifiedThread, testThread); } -TEST(Timers, TimerWithStoppedTarget) -{ +TEST(Timers, TimerWithStoppedTarget) { AutoTestThread testThread; ASSERT_TRUE(testThread); @@ -234,8 +232,7 @@ class FindExpirationTimeState final { } }; -TEST(Timers, FindExpirationTime) -{ +TEST(Timers, FindExpirationTime) { { FindExpirationTimeState state; // 0 low priority timers @@ -604,8 +601,7 @@ class FuzzTestThreadState final : public nsITimerCallback { NS_IMPL_ISUPPORTS(FuzzTestThreadState, nsITimerCallback) -TEST(Timers, FuzzTestTimers) -{ +TEST(Timers, FuzzTestTimers) { static const size_t kNumThreads(10); AutoTestThread threads[kNumThreads]; RefPtr threadStates[kNumThreads]; diff --git a/xpcom/tests/gtest/TestTokenizer.cpp b/xpcom/tests/gtest/TestTokenizer.cpp index e0092d08a3ed..126557e015a2 100644 --- a/xpcom/tests/gtest/TestTokenizer.cpp +++ b/xpcom/tests/gtest/TestTokenizer.cpp @@ -21,8 +21,7 @@ static bool HttpHeaderCharacter(char const c) { (c >= '0' && c <= '9') || (c == '_') || (c == '-'); } -TEST(Tokenizer, HTTPResponse) -{ +TEST(Tokenizer, HTTPResponse) { Tokenizer::Token t; // Real life test, HTTP response @@ -95,8 +94,7 @@ TEST(Tokenizer, HTTPResponse) EXPECT_TRUE(b == "This is the body"); } -TEST(Tokenizer, Main) -{ +TEST(Tokenizer, Main) { Tokenizer::Token t; // Synthetic code-specific test @@ -209,8 +207,7 @@ TEST(Tokenizer, Main) EXPECT_FALSE(p.CheckEOF()); } -TEST(Tokenizer, Main16) -{ +TEST(Tokenizer, Main16) { Tokenizer16::Token t; // Synthetic code-specific test @@ -323,8 +320,7 @@ TEST(Tokenizer, Main16) EXPECT_FALSE(p.CheckEOF()); } -TEST(Tokenizer, SingleWord) -{ +TEST(Tokenizer, SingleWord) { // Single word with numbers in it test Tokenizer p(NS_LITERAL_CSTRING("test123")); @@ -333,8 +329,7 @@ TEST(Tokenizer, SingleWord) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, EndingAfterNumber) -{ +TEST(Tokenizer, EndingAfterNumber) { // An end handling after a number Tokenizer p(NS_LITERAL_CSTRING("123")); @@ -344,8 +339,7 @@ TEST(Tokenizer, EndingAfterNumber) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, BadInteger) -{ +TEST(Tokenizer, BadInteger) { Tokenizer::Token t; // A bad integer test @@ -357,8 +351,7 @@ TEST(Tokenizer, BadInteger) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, CheckExpectedTokenValue) -{ +TEST(Tokenizer, CheckExpectedTokenValue) { Tokenizer::Token t; // Check expected token value test @@ -382,8 +375,7 @@ TEST(Tokenizer, CheckExpectedTokenValue) EXPECT_FALSE(p.Next(t)); } -TEST(Tokenizer, HasFailed) -{ +TEST(Tokenizer, HasFailed) { Tokenizer::Token t; // HasFailed test @@ -423,8 +415,7 @@ TEST(Tokenizer, HasFailed) EXPECT_TRUE(p2.HasFailed()); } -TEST(Tokenizer, Construction) -{ +TEST(Tokenizer, Construction) { { nsCString a("test"); Tokenizer p1(a); @@ -474,8 +465,7 @@ TEST(Tokenizer, Construction) } } -TEST(Tokenizer, Customization) -{ +TEST(Tokenizer, Customization) { Tokenizer p1(NS_LITERAL_CSTRING("test-custom*words and\tdefault-whites"), nullptr, "-*"); EXPECT_TRUE(p1.CheckWord("test-custom*words")); @@ -505,8 +495,7 @@ TEST(Tokenizer, Customization) EXPECT_TRUE(p3.CheckWord("whites-and#word-chars")); } -TEST(Tokenizer, ShortcutChecks) -{ +TEST(Tokenizer, ShortcutChecks) { Tokenizer p("test1 test2,123"); nsAutoCString test1; @@ -528,8 +517,7 @@ TEST(Tokenizer, ShortcutChecks) static bool ABChar(const char aChar) { return aChar == 'a' || aChar == 'b'; } -TEST(Tokenizer, ReadCharClassified) -{ +TEST(Tokenizer, ReadCharClassified) { Tokenizer p("abc"); char c; @@ -544,8 +532,7 @@ TEST(Tokenizer, ReadCharClassified) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, ClaimSubstring) -{ +TEST(Tokenizer, ClaimSubstring) { Tokenizer p(" abc "); EXPECT_TRUE(p.CheckWhite()); @@ -559,8 +546,7 @@ TEST(Tokenizer, ClaimSubstring) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, Fragment) -{ +TEST(Tokenizer, Fragment) { const char str[] = "ab;cd:10 "; Tokenizer p(str); nsDependentCSubstring f; @@ -621,8 +607,7 @@ TEST(Tokenizer, Fragment) EXPECT_TRUE(t1.Fragment().BeginReading() == &str[9]); } -TEST(Tokenizer, SkipWhites) -{ +TEST(Tokenizer, SkipWhites) { Tokenizer p("Text1 \nText2 \nText3\n Text4\n "); EXPECT_TRUE(p.CheckWord("Text1")); @@ -642,8 +627,7 @@ TEST(Tokenizer, SkipWhites) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, SkipCustomWhites) -{ +TEST(Tokenizer, SkipCustomWhites) { Tokenizer p("Text1 \n\r\t.Text2 \n\r\t.", " \n\r\t."); EXPECT_TRUE(p.CheckWord("Text1")); @@ -657,8 +641,7 @@ TEST(Tokenizer, SkipCustomWhites) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, IntegerReading) -{ +TEST(Tokenizer, IntegerReading) { #define INT_6_BITS 64U #define INT_30_BITS 1073741824UL #define INT_32_BITS 4294967295UL @@ -772,8 +755,7 @@ TEST(Tokenizer, IntegerReading) } } -TEST(Tokenizer, ReadUntil) -{ +TEST(Tokenizer, ReadUntil) { Tokenizer p("Hello;test 4,"); nsDependentCSubstring f; EXPECT_TRUE(p.ReadUntil(Tokenizer::Token::Char(';'), f)); @@ -801,8 +783,7 @@ TEST(Tokenizer, ReadUntil) EXPECT_TRUE(f == " 4"); } -TEST(Tokenizer, SkipUntil) -{ +TEST(Tokenizer, SkipUntil) { { Tokenizer p("test1,test2,,,test3"); @@ -847,8 +828,7 @@ TEST(Tokenizer, SkipUntil) } } -TEST(Tokenizer, Custom) -{ +TEST(Tokenizer, Custom) { Tokenizer p( "aaaaaacustom-1\r,custom-1,Custom-1,Custom-1,00custom-2xxxx,CUSTOM-2"); @@ -888,8 +868,7 @@ TEST(Tokenizer, Custom) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, CustomRaw) -{ +TEST(Tokenizer, CustomRaw) { Tokenizer p( "aaaaaacustom-1\r,custom-1,Custom-1,Custom-1,00custom-2xxxx,CUSTOM-2"); @@ -940,8 +919,7 @@ TEST(Tokenizer, CustomRaw) EXPECT_TRUE(p.CheckEOF()); } -TEST(Tokenizer, Incremental) -{ +TEST(Tokenizer, Incremental) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -989,8 +967,7 @@ TEST(Tokenizer, Incremental) EXPECT_TRUE(test == 8); } -TEST(Tokenizer, IncrementalRollback) -{ +TEST(Tokenizer, IncrementalRollback) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -1042,8 +1019,7 @@ TEST(Tokenizer, IncrementalRollback) EXPECT_TRUE(test == 9); } -TEST(Tokenizer, IncrementalNeedMoreInput) -{ +TEST(Tokenizer, IncrementalNeedMoreInput) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -1101,8 +1077,7 @@ TEST(Tokenizer, IncrementalNeedMoreInput) EXPECT_TRUE(test == 7); } -TEST(Tokenizer, IncrementalCustom) -{ +TEST(Tokenizer, IncrementalCustom) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -1136,8 +1111,7 @@ TEST(Tokenizer, IncrementalCustom) EXPECT_TRUE(test == 3); } -TEST(Tokenizer, IncrementalCustomRaw) -{ +TEST(Tokenizer, IncrementalCustomRaw) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -1192,8 +1166,7 @@ TEST(Tokenizer, IncrementalCustomRaw) EXPECT_TRUE(test == 8); } -TEST(Tokenizer, IncrementalCustomRemove) -{ +TEST(Tokenizer, IncrementalCustomRemove) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -1225,8 +1198,7 @@ TEST(Tokenizer, IncrementalCustomRemove) EXPECT_TRUE(test == 3); } -TEST(Tokenizer, IncrementalBuffering1) -{ +TEST(Tokenizer, IncrementalBuffering1) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -1285,8 +1257,7 @@ TEST(Tokenizer, IncrementalBuffering1) EXPECT_TRUE(test == 6); } -TEST(Tokenizer, IncrementalBuffering2) -{ +TEST(Tokenizer, IncrementalBuffering2) { typedef IncrementalTokenizer::Token Token; int test = 0; @@ -1335,8 +1306,7 @@ TEST(Tokenizer, IncrementalBuffering2) EXPECT_TRUE(test == 6); } -TEST(Tokenizer, RecordAndReadUntil) -{ +TEST(Tokenizer, RecordAndReadUntil) { Tokenizer t("aaaa,bbbb"); t.SkipWhites(); nsDependentCSubstring subject; @@ -1356,8 +1326,7 @@ TEST(Tokenizer, RecordAndReadUntil) EXPECT_TRUE(t.CheckEOF()); } -TEST(Tokenizer, ReadIntegers) -{ +TEST(Tokenizer, ReadIntegers) { // Make sure that adding dash (the 'minus' sign) as an additional char // doesn't break reading negative numbers. Tokenizer t("100,-100,200,-200,4294967295,-4294967295,-2147483647", nullptr, diff --git a/xpcom/tests/gtest/TestUTF.cpp b/xpcom/tests/gtest/TestUTF.cpp index ec5f2b555e01..a2a50b4b352b 100644 --- a/xpcom/tests/gtest/TestUTF.cpp +++ b/xpcom/tests/gtest/TestUTF.cpp @@ -22,8 +22,7 @@ using namespace mozilla; namespace TestUTF { -TEST(UTF, Valid) -{ +TEST(UTF, Valid) { for (unsigned int i = 0; i < ArrayLength(ValidStrings); ++i) { nsDependentCString str8(ValidStrings[i].m8); nsDependentString str16(ValidStrings[i].m16); @@ -44,8 +43,7 @@ TEST(UTF, Valid) } } -TEST(UTF, Invalid16) -{ +TEST(UTF, Invalid16) { for (unsigned int i = 0; i < ArrayLength(Invalid16Strings); ++i) { nsDependentString str16(Invalid16Strings[i].m16); nsDependentCString str8(Invalid16Strings[i].m8); @@ -60,8 +58,7 @@ TEST(UTF, Invalid16) } } -TEST(UTF, Invalid8) -{ +TEST(UTF, Invalid8) { for (unsigned int i = 0; i < ArrayLength(Invalid8Strings); ++i) { nsDependentString str16(Invalid8Strings[i].m16); nsDependentCString str8(Invalid8Strings[i].m8); @@ -76,8 +73,7 @@ TEST(UTF, Invalid8) } } -TEST(UTF, Malformed8) -{ +TEST(UTF, Malformed8) { for (unsigned int i = 0; i < ArrayLength(Malformed8Strings); ++i) { nsDependentString str16(Malformed8Strings[i].m16); nsDependentCString str8(Malformed8Strings[i].m8); @@ -92,8 +88,7 @@ TEST(UTF, Malformed8) } } -TEST(UTF, Hash16) -{ +TEST(UTF, Hash16) { for (unsigned int i = 0; i < ArrayLength(ValidStrings); ++i) { nsDependentCString str8(ValidStrings[i].m8); bool err; @@ -172,8 +167,7 @@ static void NonASCII16_helper(const size_t aStrSize) { } } -TEST(UTF, NonASCII16) -{ +TEST(UTF, NonASCII16) { // Test with various string sizes to catch any special casing. NonASCII16_helper(1); NonASCII16_helper(8); @@ -182,8 +176,7 @@ TEST(UTF, NonASCII16) NonASCII16_helper(512); } -TEST(UTF, UTF8CharEnumerator) -{ +TEST(UTF, UTF8CharEnumerator) { const char* p = "\x61\xC0\xC2\xC2\x80\xE0\x80\x80\xE0\xA0\x80\xE1\x80\x80\xED\xBF\xBF\xED" "\x9F\xBF\xEE\x80\x80\xEE\x80\xFF\xF0\x90\x80\x80\xF0\x80\x80\x80\xF1\x80" @@ -236,8 +229,7 @@ TEST(UTF, UTF8CharEnumerator) EXPECT_EQ(p, end); } -TEST(UTF, UTF16CharEnumerator) -{ +TEST(UTF, UTF16CharEnumerator) { const char16_t* p = u"\u0061\U0001F4A9"; const char16_t* end = p + 3; EXPECT_EQ(UTF16CharEnumerator::NextChar(&p, end), 0x0061U); diff --git a/xpcom/tests/windows/TestCOM.cpp b/xpcom/tests/windows/TestCOM.cpp index bbc87d5c3d8e..a52edba9e1d2 100644 --- a/xpcom/tests/windows/TestCOM.cpp +++ b/xpcom/tests/windows/TestCOM.cpp @@ -104,8 +104,7 @@ nsresult nsTestComFactory::CreateInstance(nsISupports *aOuter, return res; } -TEST(TestCOM, WindowsInterop) -{ +TEST(TestCOM, WindowsInterop) { nsTestComFactory *inst = new nsTestComFactory(); // Test we can QI nsIFactory to an IClassFactory. diff --git a/xpcom/tests/windows/TestNtPathToDosPath.cpp b/xpcom/tests/windows/TestNtPathToDosPath.cpp index e8e0fea2010d..1885b9d84da6 100644 --- a/xpcom/tests/windows/TestNtPathToDosPath.cpp +++ b/xpcom/tests/windows/TestNtPathToDosPath.cpp @@ -112,8 +112,7 @@ bool TestNtPathToDosPath(const wchar_t* aNtPath, aExpectedDosPath); } -TEST(NtPathToDosPath, Tests) -{ +TEST(NtPathToDosPath, Tests) { nsAutoString cDrive; ASSERT_TRUE(DriveToNtPath(L'C', cDrive)); diff --git a/xpcom/threads/MozPromise.h b/xpcom/threads/MozPromise.h index 0127abb95af2..5fda8e6badda 100644 --- a/xpcom/threads/MozPromise.h +++ b/xpcom/threads/MozPromise.h @@ -336,14 +336,13 @@ class MozPromise : public MozPromiseBase { RefPtr holder = new AllPromiseHolder(aPromises.Length()); RefPtr promise = holder->Promise(); for (size_t i = 0; i < aPromises.Length(); ++i) { - aPromises[i]->Then( - aProcessingTarget, __func__, - [holder, i](ResolveValueType aResolveValue) -> void { - holder->Resolve(i, std::move(aResolveValue)); - }, - [holder](RejectValueType aRejectValue) -> void { - holder->Reject(std::move(aRejectValue)); - }); + aPromises[i]->Then(aProcessingTarget, __func__, + [holder, i](ResolveValueType aResolveValue) -> void { + holder->Resolve(i, std::move(aResolveValue)); + }, + [holder](RejectValueType aRejectValue) -> void { + holder->Reject(std::move(aRejectValue)); + }); } return promise; } diff --git a/xpcom/threads/nsThreadUtils.cpp b/xpcom/threads/nsThreadUtils.cpp index b837598bf795..e0f7f9ebd342 100644 --- a/xpcom/threads/nsThreadUtils.cpp +++ b/xpcom/threads/nsThreadUtils.cpp @@ -488,8 +488,7 @@ bool NS_ProcessNextEvent(nsIThread* aThread, bool aMayWait) { void NS_SetCurrentThreadName(const char* aName) { #if defined(ANDROID) - // Workaround for Bug 1541216 - PR_SetCurrentThreadName() Fails to set the - // thread name on Android. + // Workaround for Bug 1541216 - PR_SetCurrentThreadName() Fails to set the thread name on Android. prctl(PR_SET_NAME, reinterpret_cast(aName)); #else PR_SetCurrentThreadName(aName);