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

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

Issue 2092663002: Add a counter to calculate the total size of site data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_appcache_helper.h" 5 #include "chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 MockBrowsingDataAppCacheHelper::MockBrowsingDataAppCacheHelper( 10 MockBrowsingDataAppCacheHelper::MockBrowsingDataAppCacheHelper(
11 content::BrowserContext* browser_context) 11 content::BrowserContext* browser_context)
12 : BrowsingDataAppCacheHelper(browser_context) { 12 : BrowsingDataAppCacheHelper(browser_context),
13 response_(new content::AppCacheInfoCollection) {
13 } 14 }
14 15
15 MockBrowsingDataAppCacheHelper::~MockBrowsingDataAppCacheHelper() { 16 MockBrowsingDataAppCacheHelper::~MockBrowsingDataAppCacheHelper() {
16 } 17 }
17 18
18 void MockBrowsingDataAppCacheHelper::StartFetching( 19 void MockBrowsingDataAppCacheHelper::StartFetching(
19 const FetchCallback& completion_callback) { 20 const FetchCallback& completion_callback) {
20 ASSERT_FALSE(completion_callback.is_null()); 21 ASSERT_FALSE(completion_callback.is_null());
21 ASSERT_TRUE(completion_callback_.is_null()); 22 ASSERT_TRUE(completion_callback_.is_null());
22 completion_callback_ = completion_callback; 23 completion_callback_ = completion_callback;
23 } 24 }
24 25
25 void MockBrowsingDataAppCacheHelper::DeleteAppCacheGroup( 26 void MockBrowsingDataAppCacheHelper::DeleteAppCacheGroup(
26 const GURL& manifest_url) { 27 const GURL& manifest_url) {
27 } 28 }
29
30 void MockBrowsingDataAppCacheHelper::AddAppCacheSamples() {
31 GURL kOrigin("http://hello/");
32 content::AppCacheInfo mock_manifest_1;
33 content::AppCacheInfo mock_manifest_2;
34 content::AppCacheInfo mock_manifest_3;
35 mock_manifest_1.manifest_url = kOrigin.Resolve("manifest1");
36 mock_manifest_1.size = 1;
37 mock_manifest_2.manifest_url = kOrigin.Resolve("manifest2");
38 mock_manifest_2.size = 2;
39 mock_manifest_3.manifest_url = kOrigin.Resolve("manifest3");
40 mock_manifest_3.size = 3;
41 content::AppCacheInfoVector info_vector;
42 info_vector.push_back(mock_manifest_1);
43 info_vector.push_back(mock_manifest_2);
44 info_vector.push_back(mock_manifest_3);
45 response_->infos_by_origin[kOrigin] = info_vector;
46 }
47
48 void MockBrowsingDataAppCacheHelper::Notify() {
49 completion_callback_.Run(response_);
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698