This source file includes following definitions.
- TEST
#include "chrome/browser/ui/login/login_prompt.h"
#include "net/base/auth.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
TEST(LoginPromptTest, GetSignonRealm) {
scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo;
auth_info->is_proxy = false;
auth_info->scheme = "Basic";
auth_info->realm = "WallyWorld";
std::string url[] = {
"https://www.nowhere.org/dir/index.html",
"https://www.nowhere.org:443/dir/index.html",
"https://www.nowhere.org:8443/dir/index.html",
"https://www.nowhere.org",
"https://foo:bar@www.nowhere.org/dir/index.html",
"https://www.nowhere.org/dir/index.html?id=965362",
"https://www.nowhere.org/dir/index.html#toc",
};
std::string expected[] = {
"https://www.nowhere.org/WallyWorld",
"https://www.nowhere.org/WallyWorld",
"https://www.nowhere.org:8443/WallyWorld",
"https://www.nowhere.org/WallyWorld",
"https://www.nowhere.org/WallyWorld",
"https://www.nowhere.org/WallyWorld",
"https://www.nowhere.org/WallyWorld"
};
for (size_t i = 0; i < arraysize(url); i++) {
std::string key = GetSignonRealm(GURL(url[i]), *auth_info.get());
EXPECT_EQ(expected[i], key);
}
}