Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1029)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client_unittest.cc

Issue 256003003: Enable Automatic Passwords Saving (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 ChromePasswordManagerClient* client = GetClient();
86
87 EXPECT_FALSE(client->IsAutomaticPasswordSavingEnabled());
vabr (Chromium) 2014/04/29 13:04:44 nit: get rid of the |client| variable and just cal
rchtara 2014/04/29 13:51:24 Done.
88 }
89
90 TEST_F(ChromePasswordManagerClientTest,
91 IsAutomaticPasswordSavingEnabledWhenFlagIsSetTest) {
92 ChromePasswordManagerClient* client = GetClient();
93
94 CommandLine::ForCurrentProcess()->AppendSwitch(
95 password_manager::switches::kEnableAutomaticPasswordSaving);
96
97 EXPECT_TRUE(client->IsAutomaticPasswordSavingEnabled());
98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698