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

Unified Diff: trunk/src/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc

Issue 477273003: Revert 290030 "[Password Manager] Setup experiment to restrict a..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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: trunk/src/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
===================================================================
--- trunk/src/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc (revision 290044)
+++ trunk/src/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc (working copy)
@@ -32,29 +32,6 @@
MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&));
};
-class TestChromePasswordManagerClient : public ChromePasswordManagerClient {
- public:
- explicit TestChromePasswordManagerClient(content::WebContents* web_contents)
- : ChromePasswordManagerClient(web_contents, NULL),
- is_sync_account_credential_(false) {}
- virtual ~TestChromePasswordManagerClient() {}
-
- virtual bool IsSyncAccountCredential(
- const std::string& username,
- const std::string& origin) const OVERRIDE {
- return is_sync_account_credential_;
- }
-
- void set_is_sync_account_credential(bool is_sync_account_credential) {
- is_sync_account_credential_ = is_sync_account_credential;
- }
-
- private:
- bool is_sync_account_credential_;
-
- DISALLOW_COPY_AND_ASSIGN(TestChromePasswordManagerClient);
-};
-
} // namespace
class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness {
@@ -215,54 +192,3 @@
service_->UnregisterReceiver(&receiver_);
EXPECT_FALSE(client->IsLoggingActive());
}
-
-TEST_F(ChromePasswordManagerClientTest, ShouldFilterAutofillResult_Reauth) {
- // Make client disallow only reauth requests.
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- command_line->AppendSwitch(
- password_manager::switches::kDisallowAutofillSyncCredentialForReauth);
- scoped_ptr<TestChromePasswordManagerClient> client(
- new TestChromePasswordManagerClient(web_contents()));
- autofill::PasswordForm form;
-
- client->set_is_sync_account_credential(false);
- NavigateAndCommit(
- GURL("https://accounts.google.com/login?rart=123&continue=blah"));
- EXPECT_FALSE(client->ShouldFilterAutofillResult(form));
-
- client->set_is_sync_account_credential(true);
- NavigateAndCommit(
- GURL("https://accounts.google.com/login?rart=123&continue=blah"));
- EXPECT_TRUE(client->ShouldFilterAutofillResult(form));
-
- // This counts as a reauth url, though a valid URL should have a value for
- // "rart"
- NavigateAndCommit(GURL("https://accounts.google.com/addlogin?rart"));
- EXPECT_TRUE(client->ShouldFilterAutofillResult(form));
-
- NavigateAndCommit(GURL("https://accounts.google.com/login?param=123"));
- EXPECT_FALSE(client->ShouldFilterAutofillResult(form));
-
- NavigateAndCommit(GURL("https://site.com/login?rart=678"));
- EXPECT_FALSE(client->ShouldFilterAutofillResult(form));
-}
-
-TEST_F(ChromePasswordManagerClientTest, ShouldFilterAutofillResult) {
- // Normally the client should allow any credentials through, even if they
- // are the sync credential.
- scoped_ptr<TestChromePasswordManagerClient> client(
- new TestChromePasswordManagerClient(web_contents()));
- autofill::PasswordForm form;
- client->set_is_sync_account_credential(true);
- NavigateAndCommit(GURL("https://accounts.google.com/Login"));
- EXPECT_FALSE(client->ShouldFilterAutofillResult(form));
-
- // Adding disallow switch should cause sync credential to be filtered.
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- command_line->AppendSwitch(
- password_manager::switches::kDisallowAutofillSyncCredential);
- client.reset(new TestChromePasswordManagerClient(web_contents()));
- client->set_is_sync_account_credential(true);
- NavigateAndCommit(GURL("https://accounts.google.com/Login"));
- EXPECT_TRUE(client->ShouldFilterAutofillResult(form));
-}

Powered by Google App Engine
This is Rietveld 408576698