Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: components/safe_browsing/password_protection/password_protection_service_unittest.cc

Issue 2812113004: Write last_modified date to Content Settings in the PrefProvider (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE); 559 LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE);
559 560
560 // Destroy password_protection_service_ while there is one request pending. 561 // Destroy password_protection_service_ while there is one request pending.
561 password_protection_service_.reset(); 562 password_protection_service_.reset();
562 base::RunLoop().RunUntilIdle(); 563 base::RunLoop().RunUntilIdle();
563 564
564 EXPECT_THAT(histograms_.GetAllSamples(kRequestOutcomeHistogramName), 565 EXPECT_THAT(histograms_.GetAllSamples(kRequestOutcomeHistogramName),
565 testing::ElementsAre(base::Bucket(2 /* CANCELED */, 1))); 566 testing::ElementsAre(base::Bucket(2 /* CANCELED */, 1)));
566 } 567 }
567 } // namespace safe_browsing 568 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698