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

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
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
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() == chrome::VersionInfo::CHANNEL_UNKNOWN)
132 EXPECT_TRUE(GetClient()->IsAutomaticPasswordSavingEnabled());
133 else
134 EXPECT_FALSE(GetClient()->IsAutomaticPasswordSavingEnabled());
135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698