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 |