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

Unified Diff: chrome/renderer/autofill/password_autofill_agent_browsertest.cc

Issue 257803004: Add a test for toggling logging in PasswordAutofillAgent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/renderer/autofill/password_autofill_agent_browsertest.cc
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
index 955156d58985b17bf0e878badcc60d89eaed3bb4..5bc1c941d26e469aefc343e0b1a6caf30faee9c6 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -1047,4 +1047,24 @@ TEST_F(PasswordAutofillAgentTest, AcceptSuggestion) {
CheckTextFieldsDOMState(kBobUsername, true, kCarolPassword, true);
}
+// Tests that the PasswordAutofillAgent reacts appropriately to messages about
+// changing the logging state.
+// Note: this seems like better suited for a unit test, but for technical
+// complications was done as a browser test, see the discussion at
+// https://codereview.chromium.org/258473005/.
+TEST_F(PasswordAutofillAgentTest, OnChangeLoggingState) {
+ // Up-cast to access OnMessageReceived, which is private in the agent.
+ IPC::Listener* const agent_listener(password_autofill_);
+
+ EXPECT_FALSE(password_autofill_->logging_state_active());
+
+ AutofillMsg_ChangeLoggingState msg_activate(0, true);
+ EXPECT_TRUE(agent_listener->OnMessageReceived(msg_activate));
+ EXPECT_TRUE(password_autofill_->logging_state_active());
+
+ AutofillMsg_ChangeLoggingState msg_deactivate(0, false);
+ EXPECT_TRUE(agent_listener->OnMessageReceived(msg_deactivate));
+ EXPECT_FALSE(password_autofill_->logging_state_active());
+}
Ilya Sherman 2014/04/25 18:25:29 Hmm, could you instead test that RPCs are or aren'
vabr (Chromium) 2014/04/28 14:31:09 Absolutely, that's a very good point. Done.
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698