Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / ui / login / login_prompt_unittest.cc
blobb2bb2c4ef8981d365f41ae4c123a1a98e2a5c279
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/login/login_prompt.h"
6 #include "net/base/auth.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "url/gurl.h"
10 TEST(LoginPromptTest, GetSignonRealm) {
11 scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo;
12 auth_info->is_proxy = false; // server auth
13 // auth_info->host is intentionally left empty.
14 auth_info->scheme = "Basic";
15 auth_info->realm = "WallyWorld";
17 std::string url[] = {
18 "https://www.nowhere.org/dir/index.html",
19 "https://www.nowhere.org:443/dir/index.html", // default port
20 "https://www.nowhere.org:8443/dir/index.html", // non-default port
21 "https://www.nowhere.org", // no trailing slash
22 "https://foo:bar@www.nowhere.org/dir/index.html", // username:password
23 "https://www.nowhere.org/dir/index.html?id=965362", // query
24 "https://www.nowhere.org/dir/index.html#toc", // reference
27 std::string expected[] = {
28 "https://www.nowhere.org/WallyWorld",
29 "https://www.nowhere.org/WallyWorld",
30 "https://www.nowhere.org:8443/WallyWorld",
31 "https://www.nowhere.org/WallyWorld",
32 "https://www.nowhere.org/WallyWorld",
33 "https://www.nowhere.org/WallyWorld",
34 "https://www.nowhere.org/WallyWorld"
37 for (size_t i = 0; i < arraysize(url); i++) {
38 std::string key = GetSignonRealm(GURL(url[i]), *auth_info.get());
39 EXPECT_EQ(expected[i], key);