OLD | NEW |
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" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 this); | 50 this); |
51 // OnGroupAndNewestCacheStored will quit the message loop. | 51 // OnGroupAndNewestCacheStored will quit the message loop. |
52 base::MessageLoop::current()->Run(); | 52 base::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_, base::Bind(&AppCacheTestHelper::OnGotAppCacheInfo, | 60 appcache_info_.get(), |
61 base::Unretained(this))); | 61 base::Bind(&AppCacheTestHelper::OnGotAppCacheInfo, |
| 62 base::Unretained(this))); |
62 | 63 |
63 // OnGotAppCacheInfo will quit the message loop. | 64 // OnGotAppCacheInfo will quit the message loop. |
64 base::MessageLoop::current()->Run(); | 65 base::MessageLoop::current()->Run(); |
65 } | 66 } |
66 | 67 |
67 void AppCacheTestHelper::OnGotAppCacheInfo(int rv) { | 68 void AppCacheTestHelper::OnGotAppCacheInfo(int rv) { |
68 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; | 69 typedef std::map<GURL, AppCacheInfoVector> InfoByOrigin; |
69 | 70 |
70 origins_->clear(); | 71 origins_->clear(); |
71 for (InfoByOrigin::const_iterator origin = | 72 for (InfoByOrigin::const_iterator origin = |
72 appcache_info_->infos_by_origin.begin(); | 73 appcache_info_->infos_by_origin.begin(); |
73 origin != appcache_info_->infos_by_origin.end(); ++origin) { | 74 origin != appcache_info_->infos_by_origin.end(); ++origin) { |
74 origins_->insert(origin->first); | 75 origins_->insert(origin->first); |
75 } | 76 } |
76 base::MessageLoop::current()->Quit(); | 77 base::MessageLoop::current()->Quit(); |
77 } | 78 } |
78 | 79 |
79 } // namespace appcache | 80 } // namespace appcache |
OLD | NEW |