Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1186)

Unified Diff: chrome/browser/ui/passwords/password_manager_presenter_unittest.cc

Issue 2439953004: Remove invalid "suffix" assumption from CreateSortKey (Closed)
Patch Set: Fix typo Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
diff --git a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
index f81376906dae98c25a7652049356f26640ec2a83..74e750fc905a4f0636101e9d8680922b181b3092 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
@@ -137,7 +137,7 @@ void PasswordManagerPresenterTest::SortAndCheckPositions(
const SortEntry& entry = test_entries[i];
std::unique_ptr<autofill::PasswordForm> form(new autofill::PasswordForm());
form->signon_realm = entry.origin;
- form->origin = GURL(base::ASCIIToUTF16(entry.origin));
+ form->origin = GURL(entry.origin);
if (entry_type == PasswordEntryType::SAVED) {
form->username_value = base::ASCIIToUTF16(entry.username);
form->password_value = base::ASCIIToUTF16(entry.password);
@@ -163,8 +163,7 @@ void PasswordManagerPresenterTest::SortAndCheckPositions(
if (entry.expected_position >= 0) {
SCOPED_TRACE(testing::Message("position in sorted list: ")
<< entry.expected_position);
- EXPECT_EQ(GURL(base::ASCIIToUTF16(entry.origin)),
- list[entry.expected_position]->origin);
+ EXPECT_EQ(GURL(entry.origin), list[entry.expected_position]->origin);
if (entry_type == PasswordEntryType::SAVED) {
EXPECT_EQ(base::ASCIIToUTF16(entry.username),
list[entry.expected_position]->username_value);
@@ -305,4 +304,13 @@ TEST_F(PasswordManagerPresenterTest, Sorting_Federations) {
PasswordEntryType::SAVED);
}
+TEST_F(PasswordManagerPresenterTest, Sorting_SpecialCharacters) {
+ // URLs with encoded special characters should not cause crash during sorting.
+ const SortEntry test_cases[] = {
+ {"https://xn--bea5m6d.com/", "user_a", "pwd", nullptr, nullptr, 0},
kolos1 2016/10/24 03:35:35 Does this test cause a crash? Shall we use "žřč.co
vabr (Chromium) 2016/10/24 08:54:02 It does cause crash (without the fix, and on ASAN)
+ };
+ SortAndCheckPositions(test_cases, arraysize(test_cases),
kolos1 2016/10/24 03:35:35 Please add more items to |test_cases| to test if t
vabr (Chromium) 2016/10/24 08:54:02 Done.
+ PasswordEntryType::SAVED);
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698