mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1301344 - Add test. r=valentin
This commit is contained in:
parent
b552a263d3
commit
1b0b85b2fe
@ -67,3 +67,30 @@ MOZ_GTEST_BENCH(TestStandardURL, Perf, [] {
|
||||
url->GetRef(out);
|
||||
}
|
||||
});
|
||||
|
||||
TEST(TestStandardURL, IPv4) {
|
||||
nsCOMPtr<nsIURL> url( do_CreateInstance(NS_STANDARDURL_CONTRACTID) );
|
||||
ASSERT_TRUE(url);
|
||||
ASSERT_EQ(url->SetSpec(NS_LITERAL_CSTRING("http://other.com/")), NS_OK);
|
||||
|
||||
nsAutoCString out;
|
||||
|
||||
ASSERT_EQ(url->GetSpec(out), NS_OK);
|
||||
ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://other.com/"));
|
||||
|
||||
ASSERT_EQ(url->SetSpec(NS_LITERAL_CSTRING("http://%30%78%63%30%2e%30%32%35%30.01%2e")), NS_OK);
|
||||
ASSERT_EQ(url->GetSpec(out), NS_OK);
|
||||
ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://192.168.0.1/"));
|
||||
|
||||
ASSERT_EQ(url->SetSpec(NS_LITERAL_CSTRING("http://0x7f000001")), NS_OK);
|
||||
ASSERT_EQ(url->GetSpec(out), NS_OK);
|
||||
ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://127.0.0.1/"));
|
||||
|
||||
ASSERT_EQ(url->SetSpec(NS_LITERAL_CSTRING("http://00000000000000000000000000177.0000000.0000000.0001")), NS_OK);
|
||||
ASSERT_EQ(url->GetSpec(out), NS_OK);
|
||||
ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://127.0.0.1/"));
|
||||
|
||||
ASSERT_EQ(url->SetSpec(NS_LITERAL_CSTRING("http://0x7f.0x00.0x00.0x01")), NS_OK);
|
||||
ASSERT_EQ(url->GetSpec(out), NS_OK);
|
||||
ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://127.0.0.1/"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user