| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  121     verdict_proto.set_verdict_type(verdict); |  121     verdict_proto.set_verdict_type(verdict); | 
|  122     verdict_proto.set_cache_duration_sec(cache_duration_sec); |  122     verdict_proto.set_cache_duration_sec(cache_duration_sec); | 
|  123     verdict_proto.set_cache_expression(cache_expression); |  123     verdict_proto.set_cache_expression(cache_expression); | 
|  124     verdict_proto.set_cache_expression_exact_match(exact_match); |  124     verdict_proto.set_cache_expression_exact_match(exact_match); | 
|  125     return verdict_proto; |  125     return verdict_proto; | 
|  126   } |  126   } | 
|  127  |  127  | 
|  128   void SetUp() override { |  128   void SetUp() override { | 
|  129     HostContentSettingsMap::RegisterProfilePrefs(test_pref_service_.registry()); |  129     HostContentSettingsMap::RegisterProfilePrefs(test_pref_service_.registry()); | 
|  130     content_setting_map_ = new HostContentSettingsMap( |  130     content_setting_map_ = new HostContentSettingsMap( | 
|  131         &test_pref_service_, false /* incognito */, false /* guest_profile */); |  131         &test_pref_service_, false /* incognito */, false /* guest_profile */, | 
 |  132         false /* store_last_modified */); | 
|  132     database_manager_ = new MockSafeBrowsingDatabaseManager(); |  133     database_manager_ = new MockSafeBrowsingDatabaseManager(); | 
|  133     dummy_request_context_getter_ = new DummyURLRequestContextGetter(); |  134     dummy_request_context_getter_ = new DummyURLRequestContextGetter(); | 
|  134     password_protection_service_ = |  135     password_protection_service_ = | 
|  135         base::MakeUnique<TestPasswordProtectionService>( |  136         base::MakeUnique<TestPasswordProtectionService>( | 
|  136             database_manager_, dummy_request_context_getter_, |  137             database_manager_, dummy_request_context_getter_, | 
|  137             content_setting_map_); |  138             content_setting_map_); | 
|  138   } |  139   } | 
|  139  |  140  | 
|  140   void TearDown() override { content_setting_map_->ShutdownOnUIThread(); } |  141   void TearDown() override { content_setting_map_->ShutdownOnUIThread(); } | 
|  141  |  142  | 
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  599       target_url, LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE); |  600       target_url, LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE); | 
|  600  |  601  | 
|  601   // Destroy password_protection_service_ while there is one request pending. |  602   // Destroy password_protection_service_ while there is one request pending. | 
|  602   password_protection_service_.reset(); |  603   password_protection_service_.reset(); | 
|  603   base::RunLoop().RunUntilIdle(); |  604   base::RunLoop().RunUntilIdle(); | 
|  604  |  605  | 
|  605   EXPECT_THAT(histograms_.GetAllSamples(kRequestOutcomeHistogramName), |  606   EXPECT_THAT(histograms_.GetAllSamples(kRequestOutcomeHistogramName), | 
|  606               testing::ElementsAre(base::Bucket(2 /* CANCELED */, 1))); |  607               testing::ElementsAre(base::Bucket(2 /* CANCELED */, 1))); | 
|  607 } |  608 } | 
|  608 }  // namespace safe_browsing |  609 }  // namespace safe_browsing | 
| OLD | NEW |