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

Unified Diff: components/password_manager/core/browser/password_autofill_manager_unittest.cc

Issue 1208133002: [Autofill/Autocomplete Feature] Substring matching instead of prefix matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added |match_start| usage. Created 5 years, 6 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: components/password_manager/core/browser/password_autofill_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_autofill_manager_unittest.cc b/components/password_manager/core/browser/password_autofill_manager_unittest.cc
index 7dd87dcebc16a8513abdebc3330c5c0e07825268..48daf6c5100867277ca5aaacb14e98920589b467 100644
--- a/components/password_manager/core/browser/password_autofill_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_autofill_manager_unittest.cc
@@ -48,8 +48,10 @@ class MockPasswordManagerDriver : public StubPasswordManagerDriver {
public:
MOCK_METHOD2(FillSuggestion,
void(const base::string16&, const base::string16&));
- MOCK_METHOD2(PreviewSuggestion,
- void(const base::string16&, const base::string16&));
+ MOCK_METHOD3(PreviewSuggestion,
+ void(const base::string16&,
+ const base::string16&,
+ size_t match_start));
};
class TestPasswordManagerClient : public StubPasswordManagerClient {
@@ -146,24 +148,25 @@ TEST_F(PasswordAutofillManagerTest, PreviewSuggestion) {
scoped_ptr<TestPasswordManagerClient> client(new TestPasswordManagerClient);
InitializePasswordAutofillManager(client.get(), nullptr);
+ size_t match_start = 0;
EXPECT_CALL(*client->mock_driver(),
- PreviewSuggestion(test_username_, test_password_));
+ PreviewSuggestion(test_username_, test_password_, match_start));
EXPECT_TRUE(password_autofill_manager_->PreviewSuggestionForTest(
- fill_data_id(), test_username_));
+ fill_data_id(), test_username_, match_start));
testing::Mock::VerifyAndClearExpectations(client->mock_driver());
- EXPECT_CALL(*client->mock_driver(), PreviewSuggestion(_, _)).Times(0);
+ EXPECT_CALL(*client->mock_driver(), PreviewSuggestion(_, _, _)).Times(0);
EXPECT_FALSE(password_autofill_manager_->PreviewSuggestionForTest(
- fill_data_id(), base::ASCIIToUTF16(kInvalidUsername)));
+ fill_data_id(), base::ASCIIToUTF16(kInvalidUsername), match_start));
const int invalid_fill_data_id = fill_data_id() + 1;
EXPECT_FALSE(password_autofill_manager_->PreviewSuggestionForTest(
- invalid_fill_data_id, test_username_));
+ invalid_fill_data_id, test_username_, match_start));
password_autofill_manager_->DidNavigateMainFrame();
EXPECT_FALSE(password_autofill_manager_->PreviewSuggestionForTest(
- fill_data_id(), test_username_));
+ fill_data_id(), test_username_, match_start));
}
// Test that the popup is marked as visible after recieving password

Powered by Google App Engine
This is Rietveld 408576698