| 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 |
| 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 8 #include "components/password_manager/core/browser/password_manager_logger.h" | 10 #include "components/password_manager/core/browser/password_manager_logger.h" |
| 11 #include "components/password_manager/core/common/password_manager_switches.h" |
| 9 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 16 |
| 14 using content::BrowserContext; | 17 using content::BrowserContext; |
| 15 using content::WebContents; | 18 using content::WebContents; |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 | 21 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressDetachLogger) { | 72 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressDetachLogger) { |
| 70 ChromePasswordManagerClient* client = GetClient(); | 73 ChromePasswordManagerClient* client = GetClient(); |
| 71 | 74 |
| 72 client->SetLogger(&logger); | 75 client->SetLogger(&logger); |
| 73 // After detaching the logger, no text should be passed. | 76 // After detaching the logger, no text should be passed. |
| 74 client->SetLogger(NULL); | 77 client->SetLogger(NULL); |
| 75 EXPECT_CALL(logger, LogSavePasswordProgress(kTestText)).Times(0); | 78 EXPECT_CALL(logger, LogSavePasswordProgress(kTestText)).Times(0); |
| 76 client->LogSavePasswordProgress(kTestText); | 79 client->LogSavePasswordProgress(kTestText); |
| 77 EXPECT_FALSE(client->IsLoggingActive()); | 80 EXPECT_FALSE(client->IsLoggingActive()); |
| 78 } | 81 } |
| 82 |
| 83 TEST_F(ChromePasswordManagerClientTest, |
| 84 IsAutomaticPasswordSavingEnabledDefaultBehaviourTest) { |
| 85 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled()); |
| 86 } |
| 87 |
| 88 TEST_F(ChromePasswordManagerClientTest, |
| 89 IsAutomaticPasswordSavingEnabledWhenFlagIsSetTest) { |
| 90 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 91 password_manager::switches::kEnableAutomaticPasswordSaving); |
| 92 |
| 93 EXPECT_TRUE(GetClient()->IsAutomaticPasswordSavingEnabled()); |
| 94 } |
| OLD | NEW |