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

Side by Side Diff: webkit/appcache/appcache_test_helper.cc

Issue 8776024: base::Bind: Convert AppCacheService::GetAllAppCacheInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « webkit/appcache/appcache_test_helper.h ('k') | webkit/appcache/view_appcache_internals_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/appcache/appcache_test_helper.h" 5 #include "webkit/appcache/appcache_test_helper.h"
6 6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
7 #include "base/message_loop.h" 9 #include "base/message_loop.h"
8 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
9 #include "webkit/appcache/appcache.h" 11 #include "webkit/appcache/appcache.h"
10 #include "webkit/appcache/appcache_entry.h" 12 #include "webkit/appcache/appcache_entry.h"
11 #include "webkit/appcache/appcache_group.h" 13 #include "webkit/appcache/appcache_group.h"
12 #include "webkit/appcache/appcache_service.h" 14 #include "webkit/appcache/appcache_service.h"
13 15
14 namespace appcache { 16 namespace appcache {
15 17
16 AppCacheTestHelper::AppCacheTestHelper() 18 AppCacheTestHelper::AppCacheTestHelper()
17 : group_id_(0), 19 : group_id_(0),
18 appcache_id_(0), 20 appcache_id_(0),
19 response_id_(0), 21 response_id_(0),
20 ALLOW_THIS_IN_INITIALIZER_LIST(appcache_got_info_callback_(
21 this, &AppCacheTestHelper::OnGotAppCacheInfo)),
22 origins_(NULL) {} 22 origins_(NULL) {}
23 23
24 AppCacheTestHelper::~AppCacheTestHelper() {} 24 AppCacheTestHelper::~AppCacheTestHelper() {}
25 25
26 void AppCacheTestHelper::OnGroupAndNewestCacheStored( 26 void AppCacheTestHelper::OnGroupAndNewestCacheStored(
27 AppCacheGroup* /*group*/, 27 AppCacheGroup* /*group*/,
28 AppCache* /*newest_cache*/, 28 AppCache* /*newest_cache*/,
29 bool success, 29 bool success,
30 bool /*would_exceed_quota*/) { 30 bool /*would_exceed_quota*/) {
31 ASSERT_TRUE(success); 31 ASSERT_TRUE(success);
(...skipping 18 matching lines...) Expand all
50 this); 50 this);
51 // OnGroupAndNewestCacheStored will quit the message loop. 51 // OnGroupAndNewestCacheStored will quit the message loop.
52 MessageLoop::current()->Run(); 52 MessageLoop::current()->Run();
53 } 53 }
54 54
55 void AppCacheTestHelper::GetOriginsWithCaches(AppCacheService* appcache_service, 55 void AppCacheTestHelper::GetOriginsWithCaches(AppCacheService* appcache_service,
56 std::set<GURL>* origins) { 56 std::set<GURL>* origins) {
57 appcache_info_ = new AppCacheInfoCollection; 57 appcache_info_ = new AppCacheInfoCollection;
58 origins_ = origins; 58 origins_ = origins;
59 appcache_service->GetAllAppCacheInfo( 59 appcache_service->GetAllAppCacheInfo(
60 appcache_info_, &appcache_got_info_callback_); 60 appcache_info_, base::Bind(&AppCacheTestHelper::OnGotAppCacheInfo,
61 base::Unretained(this)));
62
61 // OnGotAppCacheInfo will quit the message loop. 63 // OnGotAppCacheInfo will quit the message loop.
62 MessageLoop::current()->Run(); 64 MessageLoop::current()->Run();
63 } 65 }
64 66
65 void AppCacheTestHelper::OnGotAppCacheInfo(int rv) { 67 void AppCacheTestHelper::OnGotAppCacheInfo(int rv) {
66 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; 68 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin;
67 69
68 origins_->clear(); 70 origins_->clear();
69 for (InfoByOrigin::const_iterator origin = 71 for (InfoByOrigin::const_iterator origin =
70 appcache_info_->infos_by_origin.begin(); 72 appcache_info_->infos_by_origin.begin();
71 origin != appcache_info_->infos_by_origin.end(); ++origin) { 73 origin != appcache_info_->infos_by_origin.end(); ++origin) {
72 origins_->insert(origin->first); 74 origins_->insert(origin->first);
73 } 75 }
74 MessageLoop::current()->Quit(); 76 MessageLoop::current()->Quit();
75 } 77 }
76 78
77 } // namespace appcache 79 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_test_helper.h ('k') | webkit/appcache/view_appcache_internals_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698