| 426 | } |
| 427 | |
| 428 | TEST(RtmpTest, parse_rtmp_url) { |
| 429 | butil::StringPiece host; |
| 430 | butil::StringPiece vhost; |
| 431 | butil::StringPiece port; |
| 432 | butil::StringPiece app; |
| 433 | butil::StringPiece stream_name; |
| 434 | |
| 435 | brpc::ParseRtmpURL("rtmp://HOST/APP/STREAM", |
| 436 | &host, &vhost, &port, &app, &stream_name); |
| 437 | ASSERT_EQ("HOST", host); |
| 438 | ASSERT_TRUE(vhost.empty()); |
| 439 | ASSERT_EQ("1935", port); |
| 440 | ASSERT_EQ("APP", app); |
| 441 | ASSERT_EQ("STREAM", stream_name); |
| 442 | |
| 443 | brpc::ParseRtmpURL("HOST/APP/STREAM", |
| 444 | &host, &vhost, &port, &app, &stream_name); |
| 445 | ASSERT_EQ("HOST", host); |
| 446 | ASSERT_TRUE(vhost.empty()); |
| 447 | ASSERT_EQ("1935", port); |
| 448 | ASSERT_EQ("APP", app); |
| 449 | ASSERT_EQ("STREAM", stream_name); |
| 450 | |
| 451 | brpc::ParseRtmpURL("rtmp://HOST:8765//APP?vhost=abc///STREAM?queries", |
| 452 | &host, &vhost, &port, &app, &stream_name); |
| 453 | ASSERT_EQ("HOST", host); |
| 454 | ASSERT_EQ("abc", vhost); |
| 455 | ASSERT_EQ("8765", port); |
| 456 | ASSERT_EQ("APP", app); |
| 457 | ASSERT_EQ("STREAM?queries", stream_name); |
| 458 | |
| 459 | brpc::ParseRtmpURL("HOST:8765//APP?vhost=abc///STREAM?queries", |
| 460 | &host, &vhost, &port, &app, &stream_name); |
| 461 | ASSERT_EQ("HOST", host); |
| 462 | ASSERT_EQ("abc", vhost); |
| 463 | ASSERT_EQ("8765", port); |
| 464 | ASSERT_EQ("APP", app); |
| 465 | ASSERT_EQ("STREAM?queries", stream_name); |
| 466 | |
| 467 | brpc::ParseRtmpURL("HOST:8765//APP?vhost=abc///STREAM?queries/", |
| 468 | &host, &vhost, &port, &app, &stream_name); |
| 469 | ASSERT_EQ("HOST", host); |
| 470 | ASSERT_EQ("abc", vhost); |
| 471 | ASSERT_EQ("8765", port); |
| 472 | ASSERT_EQ("APP", app); |
| 473 | ASSERT_EQ("STREAM?queries/", stream_name); |
| 474 | |
| 475 | brpc::ParseRtmpURL("HOST:8765/APP?vhost=abc", |
| 476 | &host, &vhost, &port, &app, &stream_name); |
| 477 | ASSERT_EQ("HOST", host); |
| 478 | ASSERT_EQ("abc", vhost); |
| 479 | ASSERT_EQ("8765", port); |
| 480 | ASSERT_EQ("APP", app); |
| 481 | ASSERT_TRUE(stream_name.empty()); |
| 482 | } |
| 483 | |
| 484 | TEST(RtmpTest, amf) { |
| 485 | std::string req_buf; |
nothing calls this directly
no test coverage detected