| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 false, PasswordTittleType::SAVE_ACCOUNT, "this site", 0, 0}, | 73 false, PasswordTittleType::SAVE_ACCOUNT, "this site", 0, 0}, |
| 74 {"http://example.com/landing", "http://example.com/login#form?value=3", | 74 {"http://example.com/landing", "http://example.com/login#form?value=3", |
| 75 true, PasswordTittleType::SAVE_ACCOUNT, "this site", 12, 29}, | 75 true, PasswordTittleType::SAVE_ACCOUNT, "this site", 12, 29}, |
| 76 | 76 |
| 77 // Different subdomains, federated credential. | 77 // Different subdomains, federated credential. |
| 78 {"https://a.example.com/landing", | 78 {"https://a.example.com/landing", |
| 79 "https://b.example.com/login#form?value=3", false, | 79 "https://b.example.com/login#form?value=3", false, |
| 80 PasswordTittleType::SAVE_ACCOUNT, "this site", 0, 0}, | 80 PasswordTittleType::SAVE_ACCOUNT, "this site", 0, 0}, |
| 81 {"https://a.example.com/landing", | 81 {"https://a.example.com/landing", |
| 82 "https://b.example.com/login#form?value=3", true, | 82 "https://b.example.com/login#form?value=3", true, |
| 83 PasswordTittleType::SAVE_ACCOUNT, "this site", 12, 29}, | 83 PasswordTittleType::SAVE_ACCOUNT, "this site", 12, 29}}; |
| 84 | |
| 85 // Android update. | |
| 86 {"https://another.org", "android://m3HSJL1i83hdltRq0-o9czGb-8KJDKra4t_3JR" | |
| 87 "lnPKcjI8PZm6XBHXx6zG4UuMXaDEZjR1wuXDre9G9zvN7AQw==@com.example.android", | |
| 88 false, PasswordTittleType::SAVE_PASSWORD, "android://com.example.android", | |
| 89 0, 0}, | |
| 90 {"https://another.org","android://m3HSJL1i83hdltRq0-o9czGb-8KJDKra4t_3JR" | |
| 91 "lnPKcjI8PZm6XBHXx6zG4UuMXaDEZjR1wuXDre9G9zvN7AQw==@com.example.android", | |
| 92 true, PasswordTittleType::SAVE_PASSWORD, "android://com.example.android", | |
| 93 12, 29}, | |
| 94 }; | |
| 95 | 84 |
| 96 } // namespace | 85 } // namespace |
| 97 | 86 |
| 98 // Test for GetSavePasswordDialogTitleTextAndLinkRange(). | 87 // Test for GetSavePasswordDialogTitleTextAndLinkRange(). |
| 99 TEST(ManagePasswordsViewUtilTest, GetSavePasswordDialogTitleTextAndLinkRange) { | 88 TEST(ManagePasswordsViewUtilTest, GetSavePasswordDialogTitleTextAndLinkRange) { |
| 100 for (size_t i = 0; i < arraysize(kDomainsTestCases); ++i) { | 89 for (size_t i = 0; i < arraysize(kDomainsTestCases); ++i) { |
| 101 SCOPED_TRACE(testing::Message() << "user_visible_url = " | 90 SCOPED_TRACE(testing::Message() << "user_visible_url = " |
| 102 << kDomainsTestCases[i].user_visible_url | 91 << kDomainsTestCases[i].user_visible_url |
| 103 << ", form_origin_url = " | 92 << ", form_origin_url = " |
| 104 << kDomainsTestCases[i].form_origin_url); | 93 << kDomainsTestCases[i].form_origin_url); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 base::string16 branding = | 161 base::string16 branding = |
| 173 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); | 162 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); |
| 174 base::string16 title; | 163 base::string16 title; |
| 175 gfx::Range title_link_range; | 164 gfx::Range title_link_range; |
| 176 GetAccountChooserDialogTitleTextAndLinkRange( | 165 GetAccountChooserDialogTitleTextAndLinkRange( |
| 177 false /* is_smartlock_branding_enabled */, &title, &title_link_range); | 166 false /* is_smartlock_branding_enabled */, &title, &title_link_range); |
| 178 EXPECT_GE(title.find(branding, 0), title.size()); | 167 EXPECT_GE(title.find(branding, 0), title.size()); |
| 179 EXPECT_EQ(0U, title_link_range.start()); | 168 EXPECT_EQ(0U, title_link_range.start()); |
| 180 EXPECT_EQ(0U, title_link_range.end()); | 169 EXPECT_EQ(0U, title_link_range.end()); |
| 181 } | 170 } |
| OLD | NEW |