1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1042, cover RTMP handshake protocol.

This commit is contained in:
winlin 2019-12-11 15:02:35 +08:00
parent f51f1efe42
commit 69817a9f34
3 changed files with 89 additions and 39 deletions

File diff suppressed because one or more lines are too long

View file

@ -87,10 +87,13 @@ public:
MockBufferIO(); MockBufferIO();
virtual ~MockBufferIO(); virtual ~MockBufferIO();
public: public:
virtual int length();
virtual MockBufferIO* append(std::string data); virtual MockBufferIO* append(std::string data);
virtual MockBufferIO* append(uint8_t* data, int size); virtual MockBufferIO* append(uint8_t* data, int size);
virtual int in_length(); public:
virtual int out_length(); virtual int out_length();
virtual MockBufferIO* out_append(std::string data);
virtual MockBufferIO* out_append(uint8_t* data, int size);
// for handshake. // for handshake.
public: public:
virtual srs_error_t read_fully(void* buf, size_t size, ssize_t* nread); virtual srs_error_t read_fully(void* buf, size_t size, ssize_t* nread);

View file

@ -1345,7 +1345,7 @@ VOID TEST(ProtoStackTest, HandshakeC0C1)
io.append(buf, sizeof(buf)); io.append(buf, sizeof(buf));
HELPER_EXPECT_SUCCESS(hs.read_c0c1(&io)); HELPER_EXPECT_SUCCESS(hs.read_c0c1(&io));
EXPECT_EQ(1537, io.in_length()); EXPECT_EQ(1537, io.length());
} }
} }
@ -1390,7 +1390,7 @@ VOID TEST(ProtoStackTest, HandshakeS0S1S2)
io.append(buf, sizeof(buf)); io.append(buf, sizeof(buf));
HELPER_EXPECT_SUCCESS(hs.read_s0s1s2(&io)); HELPER_EXPECT_SUCCESS(hs.read_s0s1s2(&io));
EXPECT_EQ(3073, io.in_length()); EXPECT_EQ(3073, io.length());
} }
} }
@ -1435,7 +1435,7 @@ VOID TEST(ProtoStackTest, HandshakeC2)
io.append(buf, sizeof(buf)); io.append(buf, sizeof(buf));
HELPER_EXPECT_SUCCESS(hs.read_c2(&io)); HELPER_EXPECT_SUCCESS(hs.read_c2(&io));
EXPECT_EQ(1536, io.in_buffer.length()); EXPECT_EQ(1536, io.length());
} }
} }