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/metrics/field_trial.h" | 5 #include "base/metrics/field_trial.h" |
6 #include "base/metrics/histogram_samples.h" | 6 #include "base/metrics/histogram_samples.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
10 #include "chrome/browser/password_manager/password_store_factory.h" | 10 #include "chrome/browser/password_manager/password_store_factory.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 : public ManagePasswordsUIControllerMock { | 76 : public ManagePasswordsUIControllerMock { |
77 public: | 77 public: |
78 explicit ManagePasswordsUIControllerMockWithMockNavigation( | 78 explicit ManagePasswordsUIControllerMockWithMockNavigation( |
79 content::WebContents* contents) | 79 content::WebContents* contents) |
80 : ManagePasswordsUIControllerMock(contents) {} | 80 : ManagePasswordsUIControllerMock(contents) {} |
81 | 81 |
82 ~ManagePasswordsUIControllerMockWithMockNavigation() override {} | 82 ~ManagePasswordsUIControllerMockWithMockNavigation() override {} |
83 | 83 |
84 MOCK_METHOD0(NavigateToPasswordManagerSettingsPage, void()); | 84 MOCK_METHOD0(NavigateToPasswordManagerSettingsPage, void()); |
85 MOCK_METHOD0(NavigateToExternalPasswordManager, void()); | 85 MOCK_METHOD0(NavigateToExternalPasswordManager, void()); |
86 MOCK_METHOD0(NavigateToSmartLockPage, void()); | |
87 MOCK_METHOD0(NavigateToSmartLockHelpPage, void()); | 86 MOCK_METHOD0(NavigateToSmartLockHelpPage, void()); |
88 MOCK_CONST_METHOD0(GetCurrentInteractionStats, | 87 MOCK_CONST_METHOD0(GetCurrentInteractionStats, |
89 password_manager::InteractionsStats*()); | 88 password_manager::InteractionsStats*()); |
90 }; | 89 }; |
91 | 90 |
92 // TODO(vasilii): get rid of the matcher when it's possible to test the whole | 91 // TODO(vasilii): get rid of the matcher when it's possible to test the whole |
93 // InteractionsStats. | 92 // InteractionsStats. |
94 MATCHER_P(DissmisalCountIs, count, "") { | 93 MATCHER_P(DissmisalCountIs, count, "") { |
95 return count == arg.dismissal_count; | 94 return count == arg.dismissal_count; |
96 } | 95 } |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 SmartLockStatus::ENABLE); | 570 SmartLockStatus::ENABLE); |
572 if (test_case.experiment_group) { | 571 if (test_case.experiment_group) { |
573 base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName, | 572 base::FieldTrialList::CreateFieldTrial(kBrandingExperimentName, |
574 test_case.experiment_group); | 573 test_case.experiment_group); |
575 } | 574 } |
576 | 575 |
577 PretendManagingPasswords(); | 576 PretendManagingPasswords(); |
578 | 577 |
579 switch (test_case.expected_target) { | 578 switch (test_case.expected_target) { |
580 case BrandLinkTarget::SMART_LOCK_HOME: | 579 case BrandLinkTarget::SMART_LOCK_HOME: |
581 EXPECT_CALL(*controller(), NavigateToSmartLockPage()); | 580 EXPECT_CALL(*controller(), NavigateToExternalPasswordManager()); |
582 break; | 581 break; |
583 case BrandLinkTarget::SMART_LOCK_HELP: | 582 case BrandLinkTarget::SMART_LOCK_HELP: |
584 EXPECT_CALL(*controller(), NavigateToSmartLockHelpPage()); | 583 EXPECT_CALL(*controller(), NavigateToSmartLockHelpPage()); |
585 break; | 584 break; |
586 } | 585 } |
587 | 586 |
588 model_->OnBrandLinkClicked(); | 587 model_->OnBrandLinkClicked(); |
589 } | 588 } |
590 | 589 |
591 namespace { | 590 namespace { |
592 | 591 |
593 const BrandLinkTestCase kBrandLinkTestCases[] = { | 592 const BrandLinkTestCase kBrandLinkTestCases[] = { |
594 {kSmartLockBrandingGroupName, SmartLockStatus::ENABLE, | 593 {kSmartLockBrandingGroupName, SmartLockStatus::ENABLE, |
595 BrandLinkTarget::SMART_LOCK_HOME}, | 594 BrandLinkTarget::SMART_LOCK_HOME}, |
596 {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::ENABLE, | 595 {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::ENABLE, |
597 BrandLinkTarget::SMART_LOCK_HELP}, | 596 BrandLinkTarget::SMART_LOCK_HELP}, |
598 }; | 597 }; |
599 | 598 |
600 } // namespace | 599 } // namespace |
601 | 600 |
602 INSTANTIATE_TEST_CASE_P(Default, | 601 INSTANTIATE_TEST_CASE_P(Default, |
603 ManagePasswordsBubbleModelBrandLinkTest, | 602 ManagePasswordsBubbleModelBrandLinkTest, |
604 ::testing::ValuesIn(kBrandLinkTestCases)); | 603 ::testing::ValuesIn(kBrandLinkTestCases)); |
OLD | NEW |