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

Side by Side Diff: components/previews/core/previews_black_list_item.cc

Issue 2448313002: Adding unit tests for PreviewsOptOutStoreSQL (Closed)
Patch Set: tbansal Created 4 years, 1 month 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 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/previews/core/previews_black_list_item.h" 5 #include "components/previews/core/previews_black_list_item.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "components/previews/core/previews_opt_out_store.h" 9 #include "components/previews/core/previews_opt_out_store.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 DCHECK_LE(opt_out_records_.size(), max_stored_history_length_); 50 DCHECK_LE(opt_out_records_.size(), max_stored_history_length_);
51 } 51 }
52 52
53 bool PreviewsBlackListItem::IsBlackListed(base::Time now) const { 53 bool PreviewsBlackListItem::IsBlackListed(base::Time now) const {
54 DCHECK_LE(opt_out_records_.size(), max_stored_history_length_); 54 DCHECK_LE(opt_out_records_.size(), max_stored_history_length_);
55 return most_recent_opt_out_time_ && 55 return most_recent_opt_out_time_ &&
56 now - most_recent_opt_out_time_.value() < max_black_list_duration_ && 56 now - most_recent_opt_out_time_.value() < max_black_list_duration_ &&
57 total_opt_out_ >= opt_out_black_list_threshold_; 57 total_opt_out_ >= opt_out_black_list_threshold_;
58 } 58 }
59 59
60 size_t PreviewsBlackListItem::OptOutRecordsSizeForTesting() const {
61 return opt_out_records_.size();
62 }
63
60 } // namespace previews 64 } // namespace previews
OLDNEW
« no previous file with comments | « components/previews/core/previews_black_list_item.h ('k') | components/previews/core/previews_opt_out_store_sql.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698