Chromium Code Reviews| 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 "base/command_line.h" | |
| 6 | |
| 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 7 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 8 |
| 9 #include "chrome/common/chrome_version_info.h" | |
| 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 8 #include "components/autofill/content/common/autofill_messages.h" | 11 #include "components/autofill/content/common/autofill_messages.h" |
| 9 #include "components/password_manager/core/browser/password_manager_logger.h" | 12 #include "components/password_manager/core/browser/password_manager_logger.h" |
| 13 #include "components/password_manager/core/common/password_manager_switches.h" | |
| 10 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
| 11 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/test/mock_render_process_host.h" | 16 #include "content/public/test/mock_render_process_host.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 19 |
| 16 using content::BrowserContext; | 20 using content::BrowserContext; |
| 17 using content::WebContents; | 21 using content::WebContents; |
| 18 | 22 |
| 19 namespace { | 23 namespace { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 EXPECT_FALSE(WasLoggingActivationMessageSent(&logging_active)); | 111 EXPECT_FALSE(WasLoggingActivationMessageSent(&logging_active)); |
| 108 | 112 |
| 109 client->SetLogger(&logger_); | 113 client->SetLogger(&logger_); |
| 110 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); | 114 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); |
| 111 EXPECT_TRUE(logging_active); | 115 EXPECT_TRUE(logging_active); |
| 112 | 116 |
| 113 client->SetLogger(NULL); | 117 client->SetLogger(NULL); |
| 114 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); | 118 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_active)); |
| 115 EXPECT_FALSE(logging_active); | 119 EXPECT_FALSE(logging_active); |
| 116 } | 120 } |
| 121 | |
| 122 TEST_F(ChromePasswordManagerClientTest, | |
| 123 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) { | |
| 124 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); | |
| 125 } | |
| 126 | |
| 127 TEST_F(ChromePasswordManagerClientTest, | |
| 128 IsAutomaticPasswordSavingEnabledWhenFlagIsSetTest) { | |
| 129 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 130 password_manager::switches::kEnableAutomaticPasswordSaving); | |
| 131 if (chrome::VersionInfo::GetChannel() == | |
| 132 chrome::VersionInfo::CHANNEL_UNKNOWN) | |
| 133 EXPECT_TRUE(GetClient()->IsAutomaticPasswordSavingEnabled()); | |
| 134 else | |
| 135 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); | |
| 136 } | |
| 137 | |
|
vabr (Chromium)
2014/04/30 07:46:31
nit: Please remove this blank line.
rchtara
2014/04/30 09:06:40
Done.
| |
| OLD | NEW |