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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc

Issue 2579823003: Remove Finch support for PasswordBranding (Closed)
Patch Set: Fix Android compilation and failed test Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
index a2b661fccf00fe08a0cbf477ee09d58d3b777ae9..0f3f2e85d38210083ccc9595417ac4df44310744 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -35,11 +35,8 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-using password_bubble_experiment::kBrandingExperimentName;
using password_bubble_experiment::kChromeSignInPasswordPromoExperimentName;
using password_bubble_experiment::kChromeSignInPasswordPromoThresholdParam;
-using password_bubble_experiment::kSmartLockBrandingGroupName;
-using password_bubble_experiment::kSmartLockBrandingSavePromptOnlyGroupName;
using ::testing::AnyNumber;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -320,46 +317,6 @@ TEST_F(ManagePasswordsBubbleModelTest, ClickUpdate) {
DestroyModel();
}
-TEST_F(ManagePasswordsBubbleModelTest, ShowSmartLockWarmWelcome) {
- TestSyncService* sync_service = static_cast<TestSyncService*>(
- ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
- profile(), &TestingSyncFactoryFunction));
- sync_service->set_smartlock_enabled(true);
- base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName,
- kSmartLockBrandingGroupName);
-
- PretendPasswordWaiting();
-
- EXPECT_TRUE(model()->ShouldShowGoogleSmartLockWelcome());
- EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_));
- DestroyModel();
- PretendPasswordWaiting();
-
- EXPECT_FALSE(model()->ShouldShowGoogleSmartLockWelcome());
- EXPECT_TRUE(prefs()->GetBoolean(
- password_manager::prefs::kWasSavePrompFirstRunExperienceShown));
-}
-
-TEST_F(ManagePasswordsBubbleModelTest, OmitSmartLockWarmWelcome) {
- TestSyncService* sync_service = static_cast<TestSyncService*>(
- ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
- profile(), &TestingSyncFactoryFunction));
- sync_service->set_smartlock_enabled(false);
- base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName,
- kSmartLockBrandingGroupName);
-
- PretendPasswordWaiting();
-
- EXPECT_FALSE(model()->ShouldShowGoogleSmartLockWelcome());
- EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_));
- DestroyModel();
- PretendPasswordWaiting();
-
- EXPECT_FALSE(model()->ShouldShowGoogleSmartLockWelcome());
- EXPECT_FALSE(prefs()->GetBoolean(
- password_manager::prefs::kWasSavePrompFirstRunExperienceShown));
-}
-
TEST_F(ManagePasswordsBubbleModelTest, OnBrandLinkClicked) {
PretendPasswordWaiting();
@@ -471,7 +428,6 @@ namespace {
enum class SmartLockStatus { ENABLE, DISABLE };
vasilii 2016/12/16 16:56:53 This is not sync status, not smartlock status
vabr (Chromium) 2016/12/16 18:56:27 Done. Changed this to a newly created TestSyncServ
struct TitleTestCase {
- const char* experiment_group;
SmartLockStatus smartlock_status;
const char* expected_title;
};
@@ -489,10 +445,6 @@ TEST_P(ManagePasswordsBubbleModelTitleTest, BrandedTitleOnSaving) {
profile(), &TestingSyncFactoryFunction));
sync_service->set_smartlock_enabled(test_case.smartlock_status ==
vasilii 2016/12/16 16:56:53 Can you fix TestSyncService to use better names. I
vabr (Chromium) 2016/12/16 18:56:27 Done.
SmartLockStatus::ENABLE);
- if (test_case.experiment_group) {
- base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName,
- test_case.experiment_group);
- }
PretendPasswordWaiting();
EXPECT_THAT(base::UTF16ToUTF8(model()->title()),
@@ -505,16 +457,8 @@ namespace {
// we would use the localised strings, but ResourceBundle does not get
// initialised for this unittest.
const TitleTestCase kTitleTestCases[] = {
vasilii 2016/12/16 16:56:53 I wonder if constexpr works here.
vabr (Chromium) 2016/12/16 18:56:27 It does. Also added that to the string constants a
- {kSmartLockBrandingGroupName, SmartLockStatus::ENABLE, "Google Smart Lock"},
- {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::ENABLE,
- "Google Smart Lock"},
- {nullptr, SmartLockStatus::ENABLE, "Chrom"},
- {"Default", SmartLockStatus::ENABLE, "Chrom"},
- {kSmartLockBrandingGroupName, SmartLockStatus::DISABLE, "Chrom"},
- {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::DISABLE,
- "Chrom"},
- {"Default", SmartLockStatus::DISABLE, "Chrom"},
- {nullptr, SmartLockStatus::DISABLE, "Chrom"},
+ {SmartLockStatus::ENABLE, "Google Smart Lock"},
+ {SmartLockStatus::DISABLE, "Chrom"},
};
} // namespace
@@ -523,67 +467,33 @@ INSTANTIATE_TEST_CASE_P(Default,
ManagePasswordsBubbleModelTitleTest,
::testing::ValuesIn(kTitleTestCases));
-namespace {
-
-enum class ManageLinkTarget { EXTERNAL_PASSWORD_MANAGER, SETTINGS_PAGE };
-
-struct ManageLinkTestCase {
- const char* experiment_group;
- SmartLockStatus smartlock_status;
- ManageLinkTarget expected_target;
-};
-
-} // namespace
-
class ManagePasswordsBubbleModelManageLinkTest
: public ManagePasswordsBubbleModelTest,
- public ::testing::WithParamInterface<ManageLinkTestCase> {};
+ public ::testing::WithParamInterface<SmartLockStatus> {};
TEST_P(ManagePasswordsBubbleModelManageLinkTest, OnManageLinkClicked) {
- ManageLinkTestCase test_case = GetParam();
+ SmartLockStatus smartlock_status = GetParam();
TestSyncService* sync_service = static_cast<TestSyncService*>(
ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
profile(), &TestingSyncFactoryFunction));
- sync_service->set_smartlock_enabled(test_case.smartlock_status ==
+ sync_service->set_smartlock_enabled(smartlock_status ==
SmartLockStatus::ENABLE);
- if (test_case.experiment_group) {
- base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName,
- test_case.experiment_group);
- }
PretendManagingPasswords();
- switch (test_case.expected_target) {
- case ManageLinkTarget::EXTERNAL_PASSWORD_MANAGER:
- EXPECT_CALL(*controller(), NavigateToExternalPasswordManager());
- break;
- case ManageLinkTarget::SETTINGS_PAGE:
- EXPECT_CALL(*controller(), NavigateToPasswordManagerSettingsPage());
- break;
- }
+ EXPECT_CALL(*controller(), NavigateToPasswordManagerSettingsPage());
model()->OnManageLinkClicked();
}
namespace {
-const ManageLinkTestCase kManageLinkTestCases[] = {
- {kSmartLockBrandingGroupName, SmartLockStatus::ENABLE,
- ManageLinkTarget::EXTERNAL_PASSWORD_MANAGER},
- {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::ENABLE,
- ManageLinkTarget::SETTINGS_PAGE},
- {nullptr, SmartLockStatus::ENABLE, ManageLinkTarget::SETTINGS_PAGE},
- {"Default", SmartLockStatus::ENABLE, ManageLinkTarget::SETTINGS_PAGE},
- {kSmartLockBrandingGroupName, SmartLockStatus::DISABLE,
- ManageLinkTarget::SETTINGS_PAGE},
- {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::DISABLE,
- ManageLinkTarget::SETTINGS_PAGE},
- {nullptr, SmartLockStatus::DISABLE, ManageLinkTarget::SETTINGS_PAGE},
- {"Default", SmartLockStatus::DISABLE, ManageLinkTarget::SETTINGS_PAGE},
+const SmartLockStatus kManageLinkTestStatuses[] = {
+ SmartLockStatus::ENABLE, SmartLockStatus::DISABLE,
};
} // namespace
INSTANTIATE_TEST_CASE_P(Default,
ManagePasswordsBubbleModelManageLinkTest,
- ::testing::ValuesIn(kManageLinkTestCases));
+ ::testing::ValuesIn(kManageLinkTestStatuses));

Powered by Google App Engine
This is Rietveld 408576698