| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/sync/profile_sync_service_factory.h" | 10 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 EXPECT_FALSE(logging_active); | 165 EXPECT_FALSE(logging_active); |
| 166 } | 166 } |
| 167 | 167 |
| 168 TEST_F(ChromePasswordManagerClientTest, AnswerToPingsAboutLoggingState_Active) { | 168 TEST_F(ChromePasswordManagerClientTest, AnswerToPingsAboutLoggingState_Active) { |
| 169 service_->RegisterReceiver(&receiver_); | 169 service_->RegisterReceiver(&receiver_); |
| 170 | 170 |
| 171 process()->sink().ClearMessages(); | 171 process()->sink().ClearMessages(); |
| 172 | 172 |
| 173 // Ping the client for logging activity update. | 173 // Ping the client for logging activity update. |
| 174 AutofillHostMsg_PasswordAutofillAgentConstructed msg(0); | 174 AutofillHostMsg_PasswordAutofillAgentConstructed msg(0); |
| 175 static_cast<IPC::Listener*>(GetClient())->OnMessageReceived(msg); | 175 static_cast<content::WebContentsObserver*>(GetClient())->OnMessageReceived( |
| 176 msg, web_contents()->GetMainFrame()); |
| 176 | 177 |
| 177 bool logging_active = false; | 178 bool logging_active = false; |
| 178 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); | 179 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); |
| 179 EXPECT_TRUE(logging_active); | 180 EXPECT_TRUE(logging_active); |
| 180 | 181 |
| 181 service_->UnregisterReceiver(&receiver_); | 182 service_->UnregisterReceiver(&receiver_); |
| 182 } | 183 } |
| 183 | 184 |
| 184 TEST_F(ChromePasswordManagerClientTest, | 185 TEST_F(ChromePasswordManagerClientTest, |
| 185 AnswerToPingsAboutLoggingState_Inactive) { | 186 AnswerToPingsAboutLoggingState_Inactive) { |
| 186 process()->sink().ClearMessages(); | 187 process()->sink().ClearMessages(); |
| 187 | 188 |
| 188 // Ping the client for logging activity update. | 189 // Ping the client for logging activity update. |
| 189 AutofillHostMsg_PasswordAutofillAgentConstructed msg(0); | 190 AutofillHostMsg_PasswordAutofillAgentConstructed msg(0); |
| 190 static_cast<IPC::Listener*>(GetClient())->OnMessageReceived(msg); | 191 static_cast<content::WebContentsObserver*>(GetClient())->OnMessageReceived( |
| 192 msg, web_contents()->GetMainFrame()); |
| 191 | 193 |
| 192 bool logging_active = true; | 194 bool logging_active = true; |
| 193 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); | 195 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); |
| 194 EXPECT_FALSE(logging_active); | 196 EXPECT_FALSE(logging_active); |
| 195 } | 197 } |
| 196 | 198 |
| 197 TEST_F(ChromePasswordManagerClientTest, | 199 TEST_F(ChromePasswordManagerClientTest, |
| 198 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) { | 200 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) { |
| 199 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); | 201 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); |
| 200 } | 202 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 389 |
| 388 // Again, without a custom passphrase. | 390 // Again, without a custom passphrase. |
| 389 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) | 391 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) |
| 390 .WillRepeatedly(Return(false)); | 392 .WillRepeatedly(Return(false)); |
| 391 | 393 |
| 392 EXPECT_FALSE( | 394 EXPECT_FALSE( |
| 393 client->IsPasswordSyncEnabled(password_manager::ONLY_CUSTOM_PASSPHRASE)); | 395 client->IsPasswordSyncEnabled(password_manager::ONLY_CUSTOM_PASSPHRASE)); |
| 394 EXPECT_FALSE(client->IsPasswordSyncEnabled( | 396 EXPECT_FALSE(client->IsPasswordSyncEnabled( |
| 395 password_manager::WITHOUT_CUSTOM_PASSPHRASE)); | 397 password_manager::WITHOUT_CUSTOM_PASSPHRASE)); |
| 396 } | 398 } |
| OLD | NEW |