| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return ChromePasswordManagerClient::FromWebContents(web_contents()); | 98 return ChromePasswordManagerClient::FromWebContents(web_contents()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( | 101 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( |
| 102 bool* activation_flag) { | 102 bool* activation_flag) { |
| 103 const uint32 kMsgID = AutofillMsg_SetLoggingState::ID; | 103 const uint32 kMsgID = AutofillMsg_SetLoggingState::ID; |
| 104 const IPC::Message* message = | 104 const IPC::Message* message = |
| 105 process()->sink().GetFirstMessageMatching(kMsgID); | 105 process()->sink().GetFirstMessageMatching(kMsgID); |
| 106 if (!message) | 106 if (!message) |
| 107 return false; | 107 return false; |
| 108 Tuple1<bool> param; | 108 Tuple<bool> param; |
| 109 AutofillMsg_SetLoggingState::Read(message, ¶m); | 109 AutofillMsg_SetLoggingState::Read(message, ¶m); |
| 110 *activation_flag = param.a; | 110 *activation_flag = get<0>(param); |
| 111 process()->sink().ClearMessages(); | 111 process()->sink().ClearMessages(); |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNoReceiver) { | 115 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNoReceiver) { |
| 116 ChromePasswordManagerClient* client = GetClient(); | 116 ChromePasswordManagerClient* client = GetClient(); |
| 117 | 117 |
| 118 EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(0); | 118 EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(0); |
| 119 // Before attaching the receiver, no text should be passed. | 119 // Before attaching the receiver, no text should be passed. |
| 120 client->LogSavePasswordProgress(kTestText); | 120 client->LogSavePasswordProgress(kTestText); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 // Again, without a custom passphrase. | 395 // Again, without a custom passphrase. |
| 396 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) | 396 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) |
| 397 .WillRepeatedly(Return(false)); | 397 .WillRepeatedly(Return(false)); |
| 398 | 398 |
| 399 EXPECT_FALSE( | 399 EXPECT_FALSE( |
| 400 client->IsPasswordSyncEnabled(password_manager::ONLY_CUSTOM_PASSPHRASE)); | 400 client->IsPasswordSyncEnabled(password_manager::ONLY_CUSTOM_PASSPHRASE)); |
| 401 EXPECT_FALSE(client->IsPasswordSyncEnabled( | 401 EXPECT_FALSE(client->IsPasswordSyncEnabled( |
| 402 password_manager::WITHOUT_CUSTOM_PASSPHRASE)); | 402 password_manager::WITHOUT_CUSTOM_PASSPHRASE)); |
| 403 } | 403 } |
| OLD | NEW |