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

Side by Side Diff: chrome/browser/browsing_data/mock_browsing_data_media_license_helper.cc

Issue 2359393002: Adds media license nodes to cookie tree model and cookies view. (Closed)
Patch Set: rebase Created 4 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browsing_data/mock_browsing_data_media_license_helper.h "
6
7 #include <algorithm>
8
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 MockBrowsingDataMediaLicenseHelper::MockBrowsingDataMediaLicenseHelper(
12 Profile* profile) {}
13
14 MockBrowsingDataMediaLicenseHelper::~MockBrowsingDataMediaLicenseHelper() {}
15
16 void MockBrowsingDataMediaLicenseHelper::StartFetching(
17 const FetchCallback& callback) {
18 ASSERT_FALSE(callback.is_null());
19 ASSERT_TRUE(callback_.is_null());
20 callback_ = callback;
21 }
22
23 void MockBrowsingDataMediaLicenseHelper::DeleteMediaLicenseOrigin(
24 const GURL& origin) {
25 auto entry = std::find_if(media_licenses_.begin(), media_licenses_.end(),
26 [origin](const MediaLicenseInfo& entry) {
27 return entry.origin == origin;
28 });
29 ASSERT_TRUE(entry != media_licenses_.end());
30 media_licenses_.erase(entry);
31 }
32
33 void MockBrowsingDataMediaLicenseHelper::AddMediaLicenseSamples() {
34 const GURL kOrigin1("https://media1/");
35 const GURL kOrigin2("https://media2/");
36 const base::Time ten_days_ago =
37 base::Time::Now() - base::TimeDelta::FromDays(10);
38 const base::Time twenty_days_ago =
39 base::Time::Now() - base::TimeDelta::FromDays(20);
40
41 media_licenses_.push_back(MediaLicenseInfo(kOrigin1, 1000, ten_days_ago));
42 media_licenses_.push_back(MediaLicenseInfo(kOrigin2, 50, twenty_days_ago));
43 }
44
45 void MockBrowsingDataMediaLicenseHelper::Notify() {
46 callback_.Run(media_licenses_);
47 callback_ = FetchCallback();
48 }
49
50 bool MockBrowsingDataMediaLicenseHelper::AllDeleted() {
51 return media_licenses_.empty();
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698