| 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 16 matching lines...) Expand all Loading... |
| 27 void MockBrowsingDataServiceWorkerHelper::StartFetching( | 27 void MockBrowsingDataServiceWorkerHelper::StartFetching( |
| 28 const FetchCallback& callback) { | 28 const FetchCallback& callback) { |
| 29 ASSERT_FALSE(callback.is_null()); | 29 ASSERT_FALSE(callback.is_null()); |
| 30 ASSERT_TRUE(callback_.is_null()); | 30 ASSERT_TRUE(callback_.is_null()); |
| 31 callback_ = callback; | 31 callback_ = callback; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void MockBrowsingDataServiceWorkerHelper::DeleteServiceWorkers( | 34 void MockBrowsingDataServiceWorkerHelper::DeleteServiceWorkers( |
| 35 const GURL& origin) { | 35 const GURL& origin) { |
| 36 ASSERT_FALSE(callback_.is_null()); | 36 ASSERT_FALSE(callback_.is_null()); |
| 37 ASSERT_TRUE(ContainsKey(origins_, origin)); | 37 ASSERT_TRUE(base::ContainsKey(origins_, origin)); |
| 38 origins_[origin] = false; | 38 origins_[origin] = false; |
| 39 } | 39 } |
| 40 | 40 |
| 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; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 67 pair.second = true; | 67 pair.second = true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool MockBrowsingDataServiceWorkerHelper::AllDeleted() { | 70 bool MockBrowsingDataServiceWorkerHelper::AllDeleted() { |
| 71 for (const auto& pair : origins_) { | 71 for (const auto& pair : origins_) { |
| 72 if (pair.second) | 72 if (pair.second) |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| OLD | NEW |