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> |
| 8 |
7 #include <string> | 9 #include <string> |
8 | 10 |
9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/macros.h" |
10 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
11 #include "base/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
12 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
13 #include "base/prefs/testing_pref_service.h" | 16 #include "base/prefs/testing_pref_service.h" |
14 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
15 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 19 #include "chrome/browser/sync/profile_sync_service_factory.h" |
17 #include "chrome/browser/sync/profile_sync_test_util.h" | 20 #include "chrome/browser/sync/profile_sync_test_util.h" |
18 #include "chrome/common/channel_info.h" | 21 #include "chrome/common/channel_info.h" |
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( | 118 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
116 web_contents(), nullptr); | 119 web_contents(), nullptr); |
117 } | 120 } |
118 | 121 |
119 ChromePasswordManagerClient* ChromePasswordManagerClientTest::GetClient() { | 122 ChromePasswordManagerClient* ChromePasswordManagerClientTest::GetClient() { |
120 return ChromePasswordManagerClient::FromWebContents(web_contents()); | 123 return ChromePasswordManagerClient::FromWebContents(web_contents()); |
121 } | 124 } |
122 | 125 |
123 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( | 126 bool ChromePasswordManagerClientTest::WasLoggingActivationMessageSent( |
124 bool* activation_flag) { | 127 bool* activation_flag) { |
125 const uint32 kMsgID = AutofillMsg_SetLoggingState::ID; | 128 const uint32_t kMsgID = AutofillMsg_SetLoggingState::ID; |
126 const IPC::Message* message = | 129 const IPC::Message* message = |
127 process()->sink().GetFirstMessageMatching(kMsgID); | 130 process()->sink().GetFirstMessageMatching(kMsgID); |
128 if (!message) | 131 if (!message) |
129 return false; | 132 return false; |
130 base::Tuple<bool> param; | 133 base::Tuple<bool> param; |
131 AutofillMsg_SetLoggingState::Read(message, ¶m); | 134 AutofillMsg_SetLoggingState::Read(message, ¶m); |
132 *activation_flag = base::get<0>(param); | 135 *activation_flag = base::get<0>(param); |
133 process()->sink().ClearMessages(); | 136 process()->sink().ClearMessages(); |
134 return true; | 137 return true; |
135 } | 138 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile()); | 347 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile()); |
345 DummyLogReceiver log_receiver; | 348 DummyLogReceiver log_receiver; |
346 EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver)); | 349 EXPECT_EQ(std::string(), log_router->RegisterReceiver(&log_receiver)); |
347 | 350 |
348 // But then navigate to a WebUI, there the logging should not be active. | 351 // But then navigate to a WebUI, there the logging should not be active. |
349 NavigateAndCommit(GURL("about:password-manager-internals")); | 352 NavigateAndCommit(GURL("about:password-manager-internals")); |
350 EXPECT_FALSE(GetClient()->GetLogManager()->IsLoggingActive()); | 353 EXPECT_FALSE(GetClient()->GetLogManager()->IsLoggingActive()); |
351 | 354 |
352 log_router->UnregisterReceiver(&log_receiver); | 355 log_router->UnregisterReceiver(&log_receiver); |
353 } | 356 } |
OLD | NEW |