| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/signin/core/browser/account_investigator.h" | 5 #include "components/signin/core/browser/account_investigator.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/test/histogram_tester.h" | 13 #include "base/test/histogram_tester.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "components/pref_registry/pref_registry_syncable.h" | 15 #include "components/pref_registry/pref_registry_syncable.h" |
| 16 #include "components/pref_registry/testing_pref_service_syncable.h" | |
| 17 #include "components/signin/core/browser/account_tracker_service.h" | 16 #include "components/signin/core/browser/account_tracker_service.h" |
| 18 #include "components/signin/core/browser/fake_gaia_cookie_manager_service.h" | 17 #include "components/signin/core/browser/fake_gaia_cookie_manager_service.h" |
| 19 #include "components/signin/core/browser/fake_signin_manager.h" | 18 #include "components/signin/core/browser/fake_signin_manager.h" |
| 20 #include "components/signin/core/browser/signin_metrics.h" | 19 #include "components/signin/core/browser/signin_metrics.h" |
| 21 #include "components/signin/core/browser/test_signin_client.h" | 20 #include "components/signin/core/browser/test_signin_client.h" |
| 22 #include "components/signin/core/common/signin_pref_names.h" | 21 #include "components/signin/core/common/signin_pref_names.h" |
| 22 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 23 #include "google_apis/gaia/gaia_auth_util.h" | 23 #include "google_apis/gaia/gaia_auth_util.h" |
| 24 #include "google_apis/gaia/gaia_constants.h" | 24 #include "google_apis/gaia/gaia_constants.h" |
| 25 #include "google_apis/gaia/google_service_auth_error.h" | 25 #include "google_apis/gaia/google_service_auth_error.h" |
| 26 #include "net/url_request/test_url_fetcher_factory.h" | 26 #include "net/url_request/test_url_fetcher_factory.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 28 | 28 |
| 29 using base::HistogramTester; | 29 using base::HistogramTester; |
| 30 using base::Time; | 30 using base::Time; |
| 31 using base::TimeDelta; | 31 using base::TimeDelta; |
| 32 using gaia::ListedAccount; | 32 using gaia::ListedAccount; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 histogram_tester.ExpectTotalCount( | 148 histogram_tester.ExpectTotalCount( |
| 149 "Signin.CookieJar.ChromeAccountRelation" + suffix_[type], 0); | 149 "Signin.CookieJar.ChromeAccountRelation" + suffix_[type], 0); |
| 150 } | 150 } |
| 151 histogram_tester.ExpectUniqueSample("Signin.IsShared" + suffix_[type], | 151 histogram_tester.ExpectUniqueSample("Signin.IsShared" + suffix_[type], |
| 152 is_shared, 1); | 152 is_shared, 1); |
| 153 } | 153 } |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 // Timer needs a message loop. | 156 // Timer needs a message loop. |
| 157 base::MessageLoop message_loop_; | 157 base::MessageLoop message_loop_; |
| 158 user_prefs::TestingPrefServiceSyncable prefs_; | 158 sync_preferences::TestingPrefServiceSyncable prefs_; |
| 159 AccountTrackerService account_tracker_service_; | 159 AccountTrackerService account_tracker_service_; |
| 160 TestSigninClient signin_client_; | 160 TestSigninClient signin_client_; |
| 161 FakeSigninManager signin_manager_; | 161 FakeSigninManager signin_manager_; |
| 162 FakeGaiaCookieManagerService gaia_cookie_manager_service_; | 162 FakeGaiaCookieManagerService gaia_cookie_manager_service_; |
| 163 AccountInvestigator investigator_; | 163 AccountInvestigator investigator_; |
| 164 net::FakeURLFetcherFactory fake_url_fetcher_factory_; | 164 net::FakeURLFetcherFactory fake_url_fetcher_factory_; |
| 165 std::map<ReportingType, std::string> suffix_ = { | 165 std::map<ReportingType, std::string> suffix_ = { |
| 166 {ReportingType::PERIODIC, "_Periodic"}, | 166 {ReportingType::PERIODIC, "_Periodic"}, |
| 167 {ReportingType::ON_CHANGE, "_OnChange"}}; | 167 {ReportingType::ON_CHANGE, "_OnChange"}}; |
| 168 }; | 168 }; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 cookie_manager_service()->set_list_accounts_stale_for_testing(false); | 363 cookie_manager_service()->set_list_accounts_stale_for_testing(false); |
| 364 const HistogramTester histogram_tester; | 364 const HistogramTester histogram_tester; |
| 365 | 365 |
| 366 TryPeriodicReport(); | 366 TryPeriodicReport(); |
| 367 EXPECT_FALSE(*periodic_pending()); | 367 EXPECT_FALSE(*periodic_pending()); |
| 368 ExpectSharedReportHistograms(ReportingType::PERIODIC, histogram_tester, | 368 ExpectSharedReportHistograms(ReportingType::PERIODIC, histogram_tester, |
| 369 nullptr, 0, 0, 0, nullptr, false); | 369 nullptr, 0, 0, 0, nullptr, false); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace | 372 } // namespace |
| OLD | NEW |