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 "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 6 |
| 7 #include <utility> |
5 #include <vector> | 8 #include <vector> |
6 | 9 |
7 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
8 #include "base/metrics/histogram_samples.h" | 11 #include "base/metrics/histogram_samples.h" |
9 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
11 #include "base/test/histogram_tester.h" | 14 #include "base/test/histogram_tester.h" |
12 #include "base/test/simple_test_clock.h" | 15 #include "base/test/simple_test_clock.h" |
13 #include "chrome/browser/password_manager/password_store_factory.h" | 16 #include "chrome/browser/password_manager/password_store_factory.h" |
14 #include "chrome/browser/sync/profile_sync_service_factory.h" | 17 #include "chrome/browser/sync/profile_sync_service_factory.h" |
15 #include "chrome/browser/sync/profile_sync_test_util.h" | 18 #include "chrome/browser/sync/profile_sync_test_util.h" |
16 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | |
17 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" | 19 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" |
18 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
19 #include "components/browser_sync/browser/profile_sync_service_mock.h" | 21 #include "components/browser_sync/browser/profile_sync_service_mock.h" |
20 #include "components/password_manager/core/browser/mock_password_store.h" | 22 #include "components/password_manager/core/browser/mock_password_store.h" |
21 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 23 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
22 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 24 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
23 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 25 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
24 #include "components/password_manager/core/browser/statistics_table.h" | 26 #include "components/password_manager/core/browser/statistics_table.h" |
25 #include "components/password_manager/core/common/credential_manager_types.h" | 27 #include "components/password_manager/core/common/credential_manager_types.h" |
26 #include "components/password_manager/core/common/password_manager_pref_names.h" | 28 #include "components/password_manager/core/common/password_manager_pref_names.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 249 |
248 TEST_F(ManagePasswordsBubbleModelTest, CloseWithoutInteraction) { | 250 TEST_F(ManagePasswordsBubbleModelTest, CloseWithoutInteraction) { |
249 PretendPasswordWaiting(); | 251 PretendPasswordWaiting(); |
250 | 252 |
251 EXPECT_EQ(model()->dismissal_reason(), | 253 EXPECT_EQ(model()->dismissal_reason(), |
252 password_manager::metrics_util::NO_DIRECT_INTERACTION); | 254 password_manager::metrics_util::NO_DIRECT_INTERACTION); |
253 EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE, model()->state()); | 255 EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE, model()->state()); |
254 scoped_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock); | 256 scoped_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock); |
255 base::Time now = base::Time::Now(); | 257 base::Time now = base::Time::Now(); |
256 clock->SetNow(now); | 258 clock->SetNow(now); |
257 model()->set_clock(clock.Pass()); | 259 model()->set_clock(std::move(clock)); |
258 password_manager::InteractionsStats stats = GetTestStats(); | 260 password_manager::InteractionsStats stats = GetTestStats(); |
259 stats.dismissal_count++; | 261 stats.dismissal_count++; |
260 stats.update_time = now; | 262 stats.update_time = now; |
261 EXPECT_CALL(*GetStore(), AddSiteStatsImpl(stats)); | 263 EXPECT_CALL(*GetStore(), AddSiteStatsImpl(stats)); |
262 EXPECT_CALL(*controller(), SavePassword()).Times(0); | 264 EXPECT_CALL(*controller(), SavePassword()).Times(0); |
263 EXPECT_CALL(*controller(), NeverSavePassword()).Times(0); | 265 EXPECT_CALL(*controller(), NeverSavePassword()).Times(0); |
264 DestroyModelExpectReason( | 266 DestroyModelExpectReason( |
265 password_manager::metrics_util::NO_DIRECT_INTERACTION); | 267 password_manager::metrics_util::NO_DIRECT_INTERACTION); |
266 } | 268 } |
267 | 269 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 BrandLinkTarget::SMART_LOCK_HOME}, | 586 BrandLinkTarget::SMART_LOCK_HOME}, |
585 {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::ENABLE, | 587 {kSmartLockBrandingSavePromptOnlyGroupName, SmartLockStatus::ENABLE, |
586 BrandLinkTarget::SMART_LOCK_HELP}, | 588 BrandLinkTarget::SMART_LOCK_HELP}, |
587 }; | 589 }; |
588 | 590 |
589 } // namespace | 591 } // namespace |
590 | 592 |
591 INSTANTIATE_TEST_CASE_P(Default, | 593 INSTANTIATE_TEST_CASE_P(Default, |
592 ManagePasswordsBubbleModelBrandLinkTest, | 594 ManagePasswordsBubbleModelBrandLinkTest, |
593 ::testing::ValuesIn(kBrandLinkTestCases)); | 595 ::testing::ValuesIn(kBrandLinkTestCases)); |
OLD | NEW |