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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
| 10 #include <tuple> |
10 | 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 17 #include "chrome/browser/sync/profile_sync_service_factory.h" |
17 #include "chrome/browser/sync/profile_sync_test_util.h" | 18 #include "chrome/browser/sync/profile_sync_test_util.h" |
18 #include "chrome/common/channel_info.h" | 19 #include "chrome/common/channel_info.h" |
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 20 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return ChromePasswordManagerClient::FromWebContents(web_contents()); | 124 return ChromePasswordManagerClient::FromWebContents(web_contents()); |
124 } | 125 } |
125 | 126 |
126 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( | 127 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( |
127 bool* activation_flag) { | 128 bool* activation_flag) { |
128 const uint32_t kMsgID = AutofillMsg_SetLoggingState::ID; | 129 const uint32_t kMsgID = AutofillMsg_SetLoggingState::ID; |
129 const IPC::Message* message = | 130 const IPC::Message* message = |
130 process()->sink().GetFirstMessageMatching(kMsgID); | 131 process()->sink().GetFirstMessageMatching(kMsgID); |
131 if (!message) | 132 if (!message) |
132 return false; | 133 return false; |
133 base::Tuple<bool> param; | 134 std::tuple<bool> param; |
134 AutofillMsg_SetLoggingState::Read(message, ¶m); | 135 AutofillMsg_SetLoggingState::Read(message, ¶m); |
135 *activation_flag = base::get<0>(param); | 136 *activation_flag = std::get<0>(param); |
136 process()->sink().ClearMessages(); | 137 process()->sink().ClearMessages(); |
137 return true; | 138 return true; |
138 } | 139 } |
139 | 140 |
140 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNotifyRenderer) { | 141 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressNotifyRenderer) { |
141 bool logging_active = true; | 142 bool logging_active = true; |
142 // Ensure the existence of a driver, which will send the IPCs we listen for | 143 // Ensure the existence of a driver, which will send the IPCs we listen for |
143 // below. | 144 // below. |
144 NavigateAndCommit(GURL("about:blank")); | 145 NavigateAndCommit(GURL("about:blank")); |
145 | 146 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile()); | 348 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile()); |
348 DummyLogReceiver log_receiver; | 349 DummyLogReceiver log_receiver; |
349 EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver)); | 350 EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver)); |
350 | 351 |
351 // But then navigate to a WebUI, there the logging should not be active. | 352 // But then navigate to a WebUI, there the logging should not be active. |
352 NavigateAndCommit(GURL("about:password-manager-internals")); | 353 NavigateAndCommit(GURL("about:password-manager-internals")); |
353 EXPECT_FALSE(GetClient()->GetLogManager()->IsLoggingActive()); | 354 EXPECT_FALSE(GetClient()->GetLogManager()->IsLoggingActive()); |
354 | 355 |
355 log_router->UnregisterReceiver(&log_receiver); | 356 log_router->UnregisterReceiver(&log_receiver); |
356 } | 357 } |
OLD | NEW |