| 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/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return ChromePasswordManagerClient::FromWebContents(web_contents()); | 112 return ChromePasswordManagerClient::FromWebContents(web_contents()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( | 115 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( |
| 116 bool* activation_flag) { | 116 bool* activation_flag) { |
| 117 const uint32 kMsgID = AutofillMsg_SetLoggingState::ID; | 117 const uint32 kMsgID = AutofillMsg_SetLoggingState::ID; |
| 118 const IPC::Message* message = | 118 const IPC::Message* message = |
| 119 process()->sink().GetFirstMessageMatching(kMsgID); | 119 process()->sink().GetFirstMessageMatching(kMsgID); |
| 120 if (!message) | 120 if (!message) |
| 121 return false; | 121 return false; |
| 122 Tuple<bool> param; | 122 base::Tuple<bool> param; |
| 123 AutofillMsg_SetLoggingState::Read(message, ¶m); | 123 AutofillMsg_SetLoggingState::Read(message, ¶m); |
| 124 *activation_flag = get<0>(param); | 124 *activation_flag = base::get<0>(param); |
| 125 process()->sink().ClearMessages(); | 125 process()->sink().ClearMessages(); |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNoReceiver) { | 129 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNoReceiver) { |
| 130 ChromePasswordManagerClient* client = GetClient(); | 130 ChromePasswordManagerClient* client = GetClient(); |
| 131 | 131 |
| 132 EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(0); | 132 EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(0); |
| 133 // Before attaching the receiver, no text should be passed. | 133 // Before attaching the receiver, no text should be passed. |
| 134 client->LogSavePasswordProgress(kTestText); | 134 client->LogSavePasswordProgress(kTestText); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 profile()->ForceIncognito(true); | 460 profile()->ForceIncognito(true); |
| 461 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); | 461 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); |
| 462 | 462 |
| 463 // Functionality disabled in Incognito mode also when manager itself is | 463 // Functionality disabled in Incognito mode also when manager itself is |
| 464 // enabled. | 464 // enabled. |
| 465 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled, | 465 prefs()->SetUserPref(password_manager::prefs::kPasswordManagerSavingEnabled, |
| 466 new base::FundamentalValue(true)); | 466 new base::FundamentalValue(true)); |
| 467 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); | 467 EXPECT_FALSE(client->IsSavingEnabledForCurrentPage()); |
| 468 profile()->ForceIncognito(false); | 468 profile()->ForceIncognito(false); |
| 469 } | 469 } |
| OLD | NEW |