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" |
9 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
10 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 | 15 |
14 using content::BrowserContext; | 16 using content::BrowserContext; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressDetachLogger) { | 71 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgressDetachLogger) { |
70 ChromePasswordManagerClient* client = GetClient(); | 72 ChromePasswordManagerClient* client = GetClient(); |
71 | 73 |
72 client->SetLogger(&logger); | 74 client->SetLogger(&logger); |
73 // After detaching the logger, no text should be passed. | 75 // After detaching the logger, no text should be passed. |
74 client->SetLogger(NULL); | 76 client->SetLogger(NULL); |
75 EXPECT_CALL(logger, LogSavePasswordProgress(kTestText)).Times(0); | 77 EXPECT_CALL(logger, LogSavePasswordProgress(kTestText)).Times(0); |
76 client->LogSavePasswordProgress(kTestText); | 78 client->LogSavePasswordProgress(kTestText); |
77 EXPECT_FALSE(client->IsLoggingActive()); | 79 EXPECT_FALSE(client->IsLoggingActive()); |
78 } | 80 } |
81 | |
82 TEST_F(ChromePasswordManagerClientTest, IsAutomaticPasswordSavingEnabledTest) { | |
vabr (Chromium)
2014/04/29 09:08:26
nit: please split this test into two: one testing
rchtara
2014/04/29 12:20:08
Done.
| |
83 ChromePasswordManagerClient* client = GetClient(); | |
84 EXPECT_FALSE(client->IsAutomaticPasswordSavingEnabled()); | |
85 | |
86 CommandLine::ForCurrentProcess()->AppendSwitch( | |
87 password_manager::switches::kEnableAutomaticPasswordSaving); | |
88 | |
89 EXPECT_TRUE(client->IsAutomaticPasswordSavingEnabled()); | |
90 } | |
OLD | NEW |