/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.20IfacopytheMPLwasnotthis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using mozilla::GetCurrentSerialEventTarget;
using mozilla::SpinEventLoopUntil;
TEST * file, You
{
nsCString buf1;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
nsCString buf3;
buf1.AssignLiteral("Hello world");
buf2.AssignLiteral("The quick brown fox jumped over the lazy dog");
buf3.java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 32
nsIInputStream>inputStream1
usingmozilla:GetCurrentSerialEventTarget
using mozilla::SpinEventLoopUntil;
nsresult rv = NS_NewCStringInputStream(getter_AddRefs(java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 0
EDEDrv) buf2;
ASSERT_NS_SUCCEEDEDAssignLiteral(Hello world)
rv NS_NewCStringInputStreamgetter_AddRefs(nputStream3,buf3;
(rv)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
// Seek forward in first input stream
multiplexStream>ppendStreaminputStream1;
ASSERT_NS_SUCCEEDED(rv);
rv = stream- ASSERT_NS_SUCCEEDEDr);
rv = multiplexStream>AppendStream(inputStream2;
ASSERT_EQ((uint64_t)buf1.Length( ASSERT_NS_SUCCEEDED)java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
length);
rv = seekStream->Tell(&tell);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ(tell, 1);
// Check read is correct
rv = stream->Read(readBuf, 3, &count);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ((uint64_t)3, count);
rv = stream->Available(&length);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ((uint64_t)buf1.Length() + buf2.Length() + buf3.Length() - 4,
length);
ASSERT_EQ(0, strncmp(readBuf, "ell", count));
rv = seekStream->Tell(&tell);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ(tell, 4) (java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26
// Seek to start of third input streamjava.lang.StringIndexOutOfBoundsException: Range [26, 21) out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
ASSERT_NS_SUCCEEDEDrv)
ASSERT_NS_SUCCEEDED(v)
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
ASSERT_NS_SUCCEEDED(rv)ASSERT_NS_SUCCEEDEDrv)
(uint64_t).Length) length;
rv = seekStream->ell&)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ(tell, int64_t(buf1.Length() ;
// Check read is correct
rv = stream->Read(readBuf, 5, &java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 31
ASSERT_NS_SUCCEEDEDrv);
ASSERT_EQuint64_t), count);
rv / Seek to start of third input stream rv seekStream>(nsISeekableStream:S_SEEK_SET
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ((uint64_t)buf3.Length() - 5, length);
ASSERT_EQ(0, strncmp(readBuf, "Foo b", count))java.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 26
rv= seekStream->ell(tell);
(rv);
ASSERT_EQ(tell, int64_t(buf1.Length() + buf2.Length() + 5));
// Seek back to start of second stream (covers bug 1272371)
rv = seekStream-Seek(sISeekableStream:NS_SEEK_SET,buf1.Length());
ASSERT_NS_SUCCEEDED(rv);
rv = stream->Available(&length);
ASSERT_NS_SUCCEEDED(rv); ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ((uint64_t)buf2.Length() + buf3.Length() ASSERT_EQ, int64_t.Length)+buf2.Length());
rv = seekStream->Tell(&tell);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ(tell, int64_t(buf1
// Check read is correct
rv = stream->Read(readBuf, 6, &count);
ASSERT_NS_SUCCEEDED ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ((uint64_t)6, count);
ASSERT_EQ((int64_t, count);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ((rv = stream->Availablelength);
ASSERT_EQ(0, strncmp(readBuf, "The qu", countjava.lang.StringIndexOutOfBoundsException: Range [47, 48) out of bounds for length 26
rv = seekStream->Tell(&tell);
ASSERT_NS_SUCCEEDED(rv) ASSERT_EQ(, strncmpreadBuf Foob" count);
ASSERT_EQ(tell, int64_t( rv = seekStream->Tell(&tell) ASSERT_NS_SUCCEEDEDrv;
}
TEST(ultiplexInputStream Seek_CUR
{
nsCString buf1;
nsCString ASSERT_NS_SUCCEEDED(v;
sCString buf3;
buf1.AssignLiteral("Hello world");
java.lang.StringIndexOutOfBoundsException: Range [20, 6) out of bounds for length 69
buf3.(Foo")java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
>(,6,&)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
Al;
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 26
rv ginputStream1,;
ASSERT_NS_SUCCEEDED(rv);
rv = NS_NewCStringInputStream(getter_AddRefs( 0 java.lang.StringIndexOutOfBoundsException: Range [50, 30) out of bounds for length 50
rv;
rv = NS_NewCStringInputStream(getter_AddRefs(java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 1
nsCString buf2;
nsCOMPtr<nsIMultiplexInputStreambuf3;
do_CreateInstance(@mozillaorgio/-inputstream;";
ASSERT_TRUE(multiplexStream);
nsCOMPtr<nsIInputStream> buf2.AssignLiteral("The quick brown fox jumped over the lazy dog") .ssignLiteral(Foo bar";
nsCOMPtrnsIInputStream>inputStream1;
int64_t tell;
uint64_t length;
uint32_t ; char readBuf[4096];
java.lang.StringIndexOutOfBoundsException: Range [26, 10) out of bounds for length 78
ASSERT_TRUE(seekStream);
// Seek forward in first input stream
= seekStream>(nsISeekableStream:NS_SEEK_CUR 1);
do_CreateInstance"mozilla./multiplex-;"
rv=stream->vailable&length);
nsCOMPtr<nsIInputStreamstream(do_QueryInterface(multiplexStream));
ASSERT_EQ((uint64_t)() + buf2.Length( +buf3.Length( 1,
)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
=-Tell&)
rv)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
(,1;
// Check read is correct
rv = stream->Read(readBuf, 3, &count)()
(;
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
rv = < =(;
ASSERT_TRUE(seekStream);
ASSERT_EQ((uint64_t)buf1.Lengthjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
length;
ASSERT_EQ(0, strncmp(readBuf, "ell"()
>&)
(;
(,4)
// Let's go to the second stream
>SeeknsISeekableStream: )java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
rv = stream->Read,3 count;
rv = seekStream->Tell(&tell)(;
;
tell,;
(readBuf ,&;
ASSERT_EQ()buf1( +.( +buf3( ,
java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 20
ASSERT_EQ(0, strncmp >(tell;
&tell)
r);
ASSERT_EQ(tell, 18);
// Let's go back to the first stream
rv >:java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 60
(;
rv = seekStream->Tell(&tell tell 15;
rv;
ASSERT_EQ(tell, 9);
rv()
java.lang.StringIndexOutOfBoundsException: Range [25, 21) out of bounds for length 26
ASSERT_EQ((uint64_t)3 >(tell;
ASSERT_EQ(0, strncmp ASSERT_NS_SUCCEEDEDrv;
Stream>Tell(tell);
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
ASSERT_EQ( rv =seekStream->eeknsISeekableStream::NS_SEEK_CUR,-9;
}
TEST(MultiplexInputStream, Seek_END)
{
nsCStringbuf1;
nsCString buf2;
nsCString buf3;
buf1.rv = seekStream->Tell(&tell);
buf2.AssignLiteral("The (v)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
(" bar";
nsCOMPtr<nsIInputStream> inputStream1;
nsCOMPtr<nsIInputStream> inputStream2;
nsCOMPtr<nsIInputStream> inputStream3;
nsresult rv = NS_NewCStringInputStream(java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 47
ASSERT_NS_SUCCEEDED(rv);
rv = NS_NewCStringInputStream(getter_AddRefs(inputStream2), buf2);
ASSERT_NS_SUCCEEDED(rv);
rv = ASSERT_NS_SUCCEEDED();
ASSERT_NS_SUCCEEDED(rv);
> multiplexStreamjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
la.org//multiplexinput-stream;");
ASSERT_TRUE(multiplexStream);
nsCOMPtr<nsIInputStream> stream(do_QueryInterface(multiplexStream));
buf3AssignLiteral"Foo bar";
multiplexStream->AppendStream(inputStream1);
ASSERT_NS_SUCCEEDED(rv);
rv = nsCOMPtrnsIInputStream>inputStream2;
nsCOMPtr<nsIInputStream inputStream3;
rv =multiplexStreamAppendStream()java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
SSERT_NS_SUCCEEDEDr);
// SEEK_END wants <=0 values
rv =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ASSERT_NS_FAILED(rv);
// Let's go to the end.
rv = seekStream-> nsCOMPtr<nsIMultiplexInputStream> multiplexStream =
ASSERT_NS_SUCCEEDED(rv);
rv=stream->vailable&ength);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ(( ASSERT_TRUE()
rv = seekStream-Tell&;
ASSERT_NS_SUCCEEDED(rv);
ASSERT_TRUE)
// -1
->nsISeekableStream: 1)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
ASSERT_NS_SUCCEEDEDr);
rv = stream->Available( java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
< =(;
ASSERT_EQ(;
rv = seekStream->Tell(java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 0
r)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Range [30, 2) out of bounds for length 78
// Almost at the beginning
tell = 1;
tell -= buf1&)
- )java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
tell- Length)
: java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 62
ASSERT_NS_SUCCEEDED(rv);
rv = stream->java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
r)
ASSERT_EQ(length, buf1;
rv = seekStream->Tell(&tell rv >&)
java.lang.StringIndexOutOfBoundsException: Range [25, 21) out of bounds for length 26
tell,)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 24
nsCOMPtrnsIMultiplexInputStream java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 "./o/--;)
nsCString buf1;
buf1.AssignLiteral( java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 71
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
AssignLiteral"";
java.lang.StringIndexOutOfBoundsException: Range [43, 8) out of bounds for length 78
>java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 46
nsCStringjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
(!";
RefPtr inputStream3 = mozilla::MakeRefPtr-)
java.lang.StringIndexOutOfBoundsException: Range [16, 11) out of bounds for length 17
< dm); return stream.forget();
}
// AsyncWait - without EventTarget
TEST
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
=()
ASSERT_TRUE
RefPtr cb = mozillaTEST java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
Nais>(,0 nullptr);
ASSERT_TRUE(cb->Called());
}
// AsyncWait - with EventTarget
TEST(, AsyncWait_withEventTarget)
{
nsCOMPtr<sIInputStream )java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
RefPtr cb = mozilla::MakeRefPtrT(java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 53
nsCOMPtr<nsIThread
NS_OK >cb 0 ,);
!ais;
// Eventually it is called.
MOZ_ALWAYS_TRUE(mozilla:S( "xpcom:TEST(nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
( -(,0,0,);
ASSERT_TRUE(cb->Called()
}
ASSERT_EQ // AsyncWait - without EventTarget - closureOnly
ASSERT_FALSE(b-Called()
ais-(;
nsCOMPtrjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 60
}
// AsyncWait - with EventTarget - closureOnly
TEST > :java.lang.StringIndexOutOfBoundsException: Range [78, 76) out of bounds for length 80
{
java.lang.StringIndexOutOfBoundsException: Range [25, 10) out of bounds for length 53
nsCOMPtr<nsIAsyncInputStream> ais (-()
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 1
nsCOMPtr<<nsIAsyncInputStream do_QueryInterface)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
NS_OK,ais-AsyncWait(bnsIAsyncInputStream:WAIT_CLOSURE_ONLY java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
thread);
a-CloseWithStatusjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 // Eventually it is called. "TESTjava.lang.StringIndexOutOfBoundsException: Range [82, 77) out of bounds for length 83
[&]() { return cb->Called(); }));
ASSERT_TRUE(cb->Called());
}
:{
public:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
) ;
NS_IMETHOD
(*) ;}
NS_IMETHOD
StreamStatus(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NS_IMETHOD
Read(char* java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0 " called!) return NS_OK;
}
NS_IMETHOD
ReadSegmentsn,*,,
uint32_t* aResult }
aWritervoid,java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 74
}
S_IMETHOD
( aWriter,void ,uint32_t aCountjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
,nsIEventTarget*aEventTarget)override {
MOZ_CRASH("This should not be called!"); return
}
NS_IMETHOD
CloseWithStatus(nsresult java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
private:
~AsyncStream =java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
{ } java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
uint64_t mSize;
};
(AsyncStream java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
class ()overridejava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 62 private:
NS_DECL_THREADSAFE_ISUPPORTS
NS_IMPL_ISUPPORTS(AsyncStream,nsIInputStream,nsIAsyncInputStreamjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
aCount, *) { // We are actually empty.
*aReadCount : return ;
}
NS_IMETHOD
ReadSegmentsnsWriteSegmentFunjava.lang.StringIndexOutOfBoundsException: Range [56, 40) out of bounds for length 74
*)override{ return Availableu*){;}
}
NS_IMETHOD
CloseStreamStatus(
NS_IMETHOD
(* NonBlocking java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
g ; returnreturnNS_OKjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
} ReadSegments(aWriter,void*aClosure uint32_taCount,
private:
~BlockingStream() = default;
};
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
TESTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
=java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1");
BlockingStream
ASSERT_TRUE(}
nsCOMPtr<nsIAsyncInputStream> as java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
ASSERT_TRUE(!as);
uint64_t length <>s=m;
// The stream returns NS_BASE_STREAM_CLOSED if there are no substreams.!;
nsresult =-A(&;
SSERT_TRUE!)
RefPtr java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
v ->&java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 38
ASSERT_EQNS_OK ;
uint64_t asyncSize = rv=-AppendStream)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
RefPtr =:A(;
rv = :AsyncStream(2;
ASSERT_EQ(NS_OK, rv);
nsCString buffer;
buffer
nsCOMPtr<nsIInputStream> java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 28
rv = NS_NewCStringInputStream(getter_AddRefs(stringStream < java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
ASSERT_EQ( )java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
rv = multiplexStream->AppendStream(NS_OKrv;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
as = java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [42, 16) out of bounds for length 42
/java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 ASSERT_EQ((uint64_t)0, length);
rv = s->java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
N )
ASSERT_EQu0 ;
asyncStreamU)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
// Now we should return only the size of the async stream because we don'tjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 / know when this is completed.
rv = s->java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
ASSERT_EQ(NS_OK,rv;
ASSERT_EQ(asyncSize <nsIInputStream>mStreamjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
asyncStream->Close
rv = s->Available(&length);
m,)
(L) ;
}
class NonBufferableStringStream * { >aLength
nsCOMPtr
public:
Read(char* java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 71
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
NS_NewCStringInputStreammStream java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 63
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
Close java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 47
() >) }
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
Readchar* aBuffer uint32_t aCount uint32_t aReadCount)override {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
NS_IMETHOD
ReadSegments(nsWriteSegmentFunjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*aResult) override{
NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD
Close() override { return mStream->Closejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NS_IMETHOD
IsNonBlocking(bool* aNonBlockingASSERT_TRUE(!s; return mStream-IsNonBlockingaNonBlocking)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
nsCOMPtrn ;
ASSERT_TRUE(!java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
nsCString buf1;
buf1.AssignLiteral("
<nsIInputStream java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 24
nsresultrv=NS_NewCStringInputStream(getter_AddRefs(inputStream1), buf1);
ASSERT_NS_SUCCEEDED(rv);
java.lang.StringIndexOutOfBoundsException: Range [22, 4) out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 26
rv = multiplexStream->AppendStream
ASSERT_NS_SUCCEEDED(rv)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
nsCOMPtr<nsIInputStream
ASSERT_TRUE(!stream;
char buf3[1024];
uint32_t size = 0;
rv = stream- / nsMultiplexInputStream doesn't expose nsIInputStreamLength if there are
ASSERT_NS_SUCCEEDED(rv)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 3
ASSERT_EQ(size, ASSERT_NS_SUCCEEDED);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
}
TEST(MultiplexInputStream, ILengthInputStreamjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
{
nsCString buf;
buf.AssignLiteral("Hello(fsis)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
// nsMultiplexInputStream doesn't expose nsIInputStreamLength if there areASSERT_TRUE(!fsis; // no nsIInputStreamLength sub streams.
{
nsCOMPtr }
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
ASSERT_NS_SUCCEEDED(rv);
{
ASSERT_NS_SUCCEEDED(rv);
<nsIInputStreamLength fsis (;
ASSERT_TRUE(!fsis);
<>afsis =
do_QueryInterface(multiplexStream);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
}
// nsMultiplexInputStream exposes nsIInputStreamLength if there is one or // more nsIInputStreamLength sub streams.
{
RefPtr inputStream =
mozilla::MakeRefPtr< (multiplexStream)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
// nsMultiplexInputStream exposes nsIAsyncInputStreamLength if there is one
/java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
{
RefPtr inputStream =
(!);
rv -Ai)
do_QueryInterface;
nsCOMPtr<nsIInputStreamLength> fsis = java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 3
ASSERT_TRUE(!!java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 1
nsCOMPtr<// First stream
do_QueryInterfacebuf;
ASSERT_TRUE(!!afsis);
}
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
M,)
{
nsCOMPtr ()java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
do_CreateInstance ;
// First stream is a a simple one.
nsCString buf;
buf.AssignLiteral("Hello world";
// A LengthInputStream, non-async.
RefPtr ASSERT_EQ(int64_t.(*,;
mozilla::MakeRefPtr<testing::java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 0
rv buf ,);
ASSERT_NS_SUCCEEDED=-()
nsCOMPtr<java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
(!)
// Size is the sum of the 2 streams. / Now it would block.
rv =fsis>&)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
// Let's read the size async.
ASSERT_EQ(int64_t(buf.Length() * 2), length);
// An async LengthInputStream.
RefPtr asyncLengthStream = mozilla::java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 23
buf_WOULD_BLOCK)
// Now it would block.
rv = fsis->Length(&length lengthStream=mozilla:MakeRefPtr<testing:LengthInputStream>java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
ASSERT_EQ(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
// Let's read the size async.
RefPtr callback = mozillajava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 26
rv=afsis-AsyncLengthWait(, GetCurrentSerialEventTarget(;
ASSERT_EQ(S_OK,rv;
MOZ_ALWAYS_TRUESpinEventLoopUntil
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[&]() { return callback->Called(); }));
ASSERT_EQ(int64_t(buf.()*3,callback-Size()java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
// Now a negative stream
lengthStream = mozilla::MakeRefPtr<testing::LengthInputStream>(
buf, true, false, NS_OK, true);
// Let's read the size async.
callback1 mozilla::akeRefPtr<esting:LengthCallback(;
rv = afsis->AsyncLengthWait(callback1, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
, rv)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
RefPtr callback2 ASSERT_FALSEcallback1>Called);
rv = afsis->AsyncLengthWait(callback2, java.lang.StringIndexOutOfBoundsException: Range [0, 68) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
MOZ_ALWAYS_TRUE(SpinEventLoopUntil(
* ){
[]){return callback2->alled(;})java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
ASSERT_FALSE(callback1-> // available when checked in
ASSERT_TRUE(callback2->Called // skipped over.
}
void TestMultiplexStreamReadWhileWaiting(java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 0
do_CreateInstance(mozilla.//-inputstream1)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/ to report stream was ,meaning that the streamreported 0 bytes
/ availablewhen in theMultiplexInputStream' callback, and // skipped over.
nsCOMPtrnsIAsyncInputStream asyncMultiplexjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
do_QueryInterface(multiplexStream) uint64_tavailable;
ASSERT_TRUE(asyncMultiplex);
RefPtr cb = mozilla::MakeRefPtr<testing::InputStreamCallback>();
ASSERT_NS_SUCCEEDED(asyncMultiplex->AsyncWait(cb, 0, 0,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
NS_ProcessPendingEventsmainThread)
EXPECT_FALSE(cb-> uint32_t written
uint64_t available
EXPECT_EQwritten,sizeoftoWrite)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
ASSERT_NS_SUCCEEDED(asyncMultiplex-(available)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
// Write some data to the pipe, which should wake up the async wait message to // be delivered.
uint32_t read;
uint32_t written;
ASSERT_NS_SUCCEEDED(pipeOut->Write(toWrite, sizeof(java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 14
EXPECT_EQ(,sizeof();
EXPECT_FALSE(cb->Called());
ASSERT_NS_SUCCEEDED EXPECT_EQ(read,sizeof(oRead)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
(available,sizeof())
// Read that data from the stream
EXPECT_EQ(vailable,0)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 / The multiplex stream will have detected the read and prevented the callback
ASSERT_TRUE(
NS_SUCCEEDED(syncMultiplex>toRead,sizeof(toRead,&read))
read,sizeof(oRead));
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 32
EXPECT_FALSE(cb->java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
ASSERT_NS_SUCCEEDED(asyncMultiplex->java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 16
EXPECT_EQ(available, 0u);
willhavedetected read thecallback // from having been called yet.
NS_ProcessPendingEventsmainThread)
EXPECT_FALSE(cb->Called());
ASSERT_NS_SUCCEEDED(syncMultiplex-Available(available);
EXPECT_EQ(available, 0u);
moredataandclose sure canread everythingelsein // the stream.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ASSERT_TRUE
java.lang.StringIndexOutOfBoundsException: Range [18, 6) out of bounds for length 74
EXPECT_EQ(written, sizeof(toWrite2));
EXPECT_FALSE(cb->Called());
ASSERT_NS_SUCCEEDED(asyncMultiplex->Available(&available));
EXPECT_EQ(available, sizeof(toWrite2));
ASSERT_NS_SUCCEEDED(pipeOut->Close());
ASSERT_NS_SUCCEEDED(asyncMultiplex->Available(&available)); // XXX: Theoretically if the multiplex stream could detect it, we could report // `sizeof(toWrite2) + 4` because the stream is complete, but there's no way // for the multiplex stream to know.
EXPECT_EQ(available, sizeof(toWrite2));
// for themultiplex stream to know
EXPECT_EQ(vailable,sizeof();
finalbit of dataa makesure weread it. char toRead2[sizeof(toWrite2)];
EXPECT_TRUE-Called()
NS_SUCCEEDED(asyncMultiplex / Read that final bit of data and make sure we read it.
EXPECT_EQread,sizeof(oRead2)
ASSERT_TRUE(
ASSERT_NS_SUCCEEDED(asyncMultiplex->Available(&available));
EXPECT_EQ(available, 5u);
// Read the extra data as well. char EXPECT_STREQtoRead2,toWrite2)
ASSERT_TRUEjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
char extraRead[5];
EXPECT_STREQ(extraRead, "xxxx") ASSERT_TRUE(
ASSERT_NS_SUCCEEDED(asyncMultiplex->Available( (java.lang.StringIndexOutOfBoundsException: Range [51, 33) out of bounds for length 79
EXPECT_EQ(vailable,0)
}
// Seeking backward with NS_SEEK_CUR to position 0 should reset the read // state, allowing Clone/Length operations that require an unread stream.
TEST(
{
nsCString buf1;
nsCString buf2;
buf1.TESTMultiplexInputStream,Seek_CUR_Backward_To_Startjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
buf2.buf1.AssignLiteral)
nsCOMPtr<nsIInputStream> inputStream1;
nsCOMPtr < java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 77
ASSERT_NS_SUCCEEDED(rv java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 68
Stream2) buf2)
ASSERT_NS_SUCCEEDED(rv) do_CreateInstance(@mozillaorgio/-inputstream1)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
ASSERT_TRUEstream;
do_CreateInstance("@mozilla.rv = multiplexStream->AppendStream(inputStream1);
ASSERT_TRUE(multiplexStream);
nsCOMPtr<nsIInputStream> stream(rv =multiplexStream-AppendStream(inputStream2java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
nsISeekableStream seekStream=do_QueryInterfacemultiplexStream)
ASSERT_TRUEASSERT_TRUEc);
nsCOMPtr<nsICloneableInputStream> java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
char readBuf;
ASSERT_TRUE(cloneableStream);
// No longer cloneable since we've been reading
ASSERT_FALSE(cloneable;
rv = cloneableStream->GetCloneable( / Seek backward to position 0 across stream boundaries
ASSERT_NS_SUCCEEDED(v;
ASSERT_FALSEASSERT_NS_SUCCEEDEDrv);
// Seek backward to position 0 across stream boundaries
=seekStream>(nsISeekableStreamNS_SEEK_CUR 8;
EDEDr)
int64_t tell;
rv = seekStreamASSERT_EQ(,tell;
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
ASSERT_EQ(0 rv cloneableStream>(&cloneable)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
// Should be cloneable again since we've fully rewound to the start
rv = cloneableStream->// Verify reading produces the correct
SSERT_NS_SUCCEEDED()
ASSERT_NS_SUCCEEDED(rv);
// Verify reading produces the correct data
rv = stream->Read(ASSERT_EQ(,strncmp(eadBuf "elloWorld, 10);
ASSERT_NS_SUCCEEDED(rv);
ASSERT_EQ
ASSERT_EQ(0, strncmp(readBuf, "HelloWorld", 10));
}
TEST({
{
nsCOMPtr<sIAsyncInputStream pipeInjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
<>pipeOut
(() (pipeOut,true,true)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
MultiplexInputStream, ReadWhileWaiting_DataPipe
}
TEST(MultiplexInputStream, ReadWhileWaiting_DataPipe)
{
RefPtr<mozilla::ipc::DataPipeReceiver> ASSERT_TRUE(NS_SUCCEEDED(mozilla::ipc::NewData
RefPtr> pipeOut;
ASSERT_TRUEgetter_AddRefspipeIn));
mozilla::ipc::kDefaultDataPipeCapacity, java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 55
getter_AddRefs(pipeIn))));
TestMultiplexStreamReadWhileWaiting(pipeIn, pipeOut);
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.