| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "components/safe_browsing/password_protection/password_protection_servi
ce.h" | 4 #include "components/safe_browsing/password_protection/password_protection_servi
ce.h" |
| 5 | 5 |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
| 10 #include "base/test/null_task_runner.h" | 10 #include "base/test/null_task_runner.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 LoginReputationClientResponse verdict_proto; | 125 LoginReputationClientResponse verdict_proto; |
| 126 verdict_proto.set_verdict_type(verdict); | 126 verdict_proto.set_verdict_type(verdict); |
| 127 verdict_proto.set_cache_duration_sec(cache_duration_sec); | 127 verdict_proto.set_cache_duration_sec(cache_duration_sec); |
| 128 verdict_proto.set_cache_expression(cache_expression); | 128 verdict_proto.set_cache_expression(cache_expression); |
| 129 return verdict_proto; | 129 return verdict_proto; |
| 130 } | 130 } |
| 131 | 131 |
| 132 void SetUp() override { | 132 void SetUp() override { |
| 133 HostContentSettingsMap::RegisterProfilePrefs(test_pref_service_.registry()); | 133 HostContentSettingsMap::RegisterProfilePrefs(test_pref_service_.registry()); |
| 134 content_setting_map_ = new HostContentSettingsMap( | 134 content_setting_map_ = new HostContentSettingsMap( |
| 135 &test_pref_service_, false /* incognito */, false /* guest_profile */); | 135 &test_pref_service_, false /* incognito */, false /* guest_profile */, |
| 136 false /* store_last_modified */); |
| 136 database_manager_ = new MockSafeBrowsingDatabaseManager(); | 137 database_manager_ = new MockSafeBrowsingDatabaseManager(); |
| 137 dummy_request_context_getter_ = new DummyURLRequestContextGetter(); | 138 dummy_request_context_getter_ = new DummyURLRequestContextGetter(); |
| 138 password_protection_service_ = | 139 password_protection_service_ = |
| 139 base::MakeUnique<TestPasswordProtectionService>( | 140 base::MakeUnique<TestPasswordProtectionService>( |
| 140 database_manager_, dummy_request_context_getter_, | 141 database_manager_, dummy_request_context_getter_, |
| 141 content_setting_map_); | 142 content_setting_map_); |
| 142 } | 143 } |
| 143 | 144 |
| 144 void TearDown() override { content_setting_map_->ShutdownOnUIThread(); } | 145 void TearDown() override { content_setting_map_->ShutdownOnUIThread(); } |
| 145 | 146 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 target_url, LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, nullptr); | 552 target_url, LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, nullptr); |
| 552 | 553 |
| 553 // Destroy password_protection_service_ while there is one request pending. | 554 // Destroy password_protection_service_ while there is one request pending. |
| 554 password_protection_service_.reset(); | 555 password_protection_service_.reset(); |
| 555 base::RunLoop().RunUntilIdle(); | 556 base::RunLoop().RunUntilIdle(); |
| 556 | 557 |
| 557 EXPECT_THAT(histograms_.GetAllSamples(kRequestOutcomeHistogramName), | 558 EXPECT_THAT(histograms_.GetAllSamples(kRequestOutcomeHistogramName), |
| 558 testing::ElementsAre(base::Bucket(2 /* CANCELED */, 1))); | 559 testing::ElementsAre(base::Bucket(2 /* CANCELED */, 1))); |
| 559 } | 560 } |
| 560 } // namespace safe_browsing | 561 } // namespace safe_browsing |
| OLD | NEW |