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

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

Issue 336763002: Password internals page: notify renderer about logging state on client construction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 6 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: chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
diff --git a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
index 87c2239d37b8ab5d3c4a1de88286412bb21a4189..100a3e6b7fca7c43eaa4a5a26a1c6ce957fe8edd 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -43,8 +43,8 @@ class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness {
protected:
ChromePasswordManagerClient* GetClient();
- // If the test IPC sink contains an AutofillMsg_ChangeLoggingState message,
- // then copies its argument into |activation_flag| and returns true. Otherwise
+ // If the test IPC sink contains an AutofillMsg_SetLoggingState message, then
+ // copies its argument into |activation_flag| and returns true. Otherwise
// returns false.
bool WasLoggingActivationMessageSent(bool* activation_flag);
@@ -72,13 +72,13 @@ ChromePasswordManagerClient* ChromePasswordManagerClientTest::GetClient() {
bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent(
bool* activation_flag) {
- const uint32 kMsgID = AutofillMsg_ChangeLoggingState::ID;
+ const uint32 kMsgID = AutofillMsg_SetLoggingState::ID;
const IPC::Message* message =
process()->sink().GetFirstMessageMatching(kMsgID);
if (!message)
return false;
Tuple1<bool> param;
- AutofillMsg_ChangeLoggingState::Read(message, &param);
+ AutofillMsg_SetLoggingState::Read(message, &param);
*activation_flag = param.a;
process()->sink().ClearMessages();
return true;
@@ -137,6 +137,35 @@ TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNotifyRenderer) {
EXPECT_FALSE(logging_active);
}
+TEST_F(ChromePasswordManagerClientTest, AnswerToPingsAboutLoggingState_Active) {
+ service_->RegisterReceiver(&receiver_);
+
+ process()->sink().ClearMessages();
+
+ // Ping the client for logging activity update.
+ AutofillHostMsg_PasswordAutofillAgentConstructed msg(0);
+ static_cast<IPC::Listener*>(GetClient())->OnMessageReceived(msg);
+
+ bool logging_active = false;
+ EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active));
+ EXPECT_TRUE(logging_active);
+
+ service_->UnregisterReceiver(&receiver_);
+}
+
+TEST_F(ChromePasswordManagerClientTest,
+ AnswerToPingsAboutLoggingState_Inactive) {
+ process()->sink().ClearMessages();
+
+ // Ping the client for logging activity update.
+ AutofillHostMsg_PasswordAutofillAgentConstructed msg(0);
+ static_cast<IPC::Listener*>(GetClient())->OnMessageReceived(msg);
+
+ bool logging_active = true;
+ EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active));
+ EXPECT_FALSE(logging_active);
+}
+
TEST_F(ChromePasswordManagerClientTest,
IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) {
EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled());

Powered by Google App Engine
This is Rietveld 408576698