1 // Copyright 2013 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/password_manager/psl_matching_helper.h"
7 #include "base/basictypes.h"
8 #include "components/autofill/core/common/password_form.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 TEST(PSLMatchingUtilsTest
, IsPublicSuffixDomainMatch
) {
19 { "http://facebook.com", "http://m.facebook.com", true },
20 { "http://www.facebook.com", "http://m.facebook.com", true },
21 { "http://www.example.com", "http://wwwexample.com", false },
22 { "http://www.example.com", "https://www.example.com", false },
23 { "http://www.example.com:123", "http://www.example.com", false },
24 { "http://www.example.org", "http://www.example.com", false },
27 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(pairs
); ++i
) {
28 autofill::PasswordForm form1
;
29 form1
.signon_realm
= pairs
[i
].url1
;
30 autofill::PasswordForm form2
;
31 form2
.signon_realm
= pairs
[i
].url2
;
32 EXPECT_EQ(pairs
[i
].should_match
,
33 PSLMatchingHelper::IsPublicSuffixDomainMatch(form1
.signon_realm
,
35 << "First URL = " << pairs
[i
].url1
36 << ", second URL = " << pairs
[i
].url2
;