OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.
h" | 5 #include "chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.
h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 void MockBrowsingDataServiceWorkerHelper::AddServiceWorkerSamples() { | 41 void MockBrowsingDataServiceWorkerHelper::AddServiceWorkerSamples() { |
42 const GURL kOrigin1("https://swhost1:1/"); | 42 const GURL kOrigin1("https://swhost1:1/"); |
43 std::vector<GURL> scopes1; | 43 std::vector<GURL> scopes1; |
44 scopes1.push_back(GURL("https://swhost1:1/app1/*")); | 44 scopes1.push_back(GURL("https://swhost1:1/app1/*")); |
45 scopes1.push_back(GURL("https://swhost1:1/app2/*")); | 45 scopes1.push_back(GURL("https://swhost1:1/app2/*")); |
46 const GURL kOrigin2("https://swhost2:2/"); | 46 const GURL kOrigin2("https://swhost2:2/"); |
47 std::vector<GURL> scopes2; | 47 std::vector<GURL> scopes2; |
48 scopes2.push_back(GURL("https://swhost2:2/*")); | 48 scopes2.push_back(GURL("https://swhost2:2/*")); |
49 | 49 |
50 content::ServiceWorkerUsageInfo info1(kOrigin1, scopes1); | 50 content::ServiceWorkerUsageInfo info1(kOrigin1, scopes1); |
| 51 info1.total_size_bytes = 1; |
51 response_.push_back(info1); | 52 response_.push_back(info1); |
52 origins_[kOrigin1] = true; | 53 origins_[kOrigin1] = true; |
53 | 54 |
54 content::ServiceWorkerUsageInfo info2(kOrigin2, scopes2); | 55 content::ServiceWorkerUsageInfo info2(kOrigin2, scopes2); |
| 56 info2.total_size_bytes = 2; |
55 response_.push_back(info2); | 57 response_.push_back(info2); |
56 origins_[kOrigin2] = true; | 58 origins_[kOrigin2] = true; |
57 } | 59 } |
58 | 60 |
59 void MockBrowsingDataServiceWorkerHelper::Notify() { | 61 void MockBrowsingDataServiceWorkerHelper::Notify() { |
60 callback_.Run(response_); | 62 callback_.Run(response_); |
61 } | 63 } |
62 | 64 |
63 void MockBrowsingDataServiceWorkerHelper::Reset() { | 65 void MockBrowsingDataServiceWorkerHelper::Reset() { |
64 for (auto& pair : origins_) | 66 for (auto& pair : origins_) |
65 pair.second = true; | 67 pair.second = true; |
66 } | 68 } |
67 | 69 |
68 bool MockBrowsingDataServiceWorkerHelper::AllDeleted() { | 70 bool MockBrowsingDataServiceWorkerHelper::AllDeleted() { |
69 for (const auto& pair : origins_) { | 71 for (const auto& pair : origins_) { |
70 if (pair.second) | 72 if (pair.second) |
71 return false; | 73 return false; |
72 } | 74 } |
73 return true; | 75 return true; |
74 } | 76 } |
OLD | NEW |