OLD | NEW |
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 <stack> | 5 #include <stack> |
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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 AppCacheEntry found_fallback_entry_; | 139 AppCacheEntry found_fallback_entry_; |
140 int64 found_cache_id_; | 140 int64 found_cache_id_; |
141 int64 found_group_id_; | 141 int64 found_group_id_; |
142 GURL found_manifest_url_; | 142 GURL found_manifest_url_; |
143 AppCacheStorageImplTest* test_; | 143 AppCacheStorageImplTest* test_; |
144 }; | 144 }; |
145 | 145 |
146 class MockQuotaManager : public quota::QuotaManager { | 146 class MockQuotaManager : public quota::QuotaManager { |
147 public: | 147 public: |
148 MockQuotaManager() | 148 MockQuotaManager() |
149 : QuotaManager(true /* is_incognito */, base::FilePath(), | 149 : QuotaManager(true /* is_incognito */, |
150 io_thread->message_loop_proxy(), | 150 base::FilePath(), |
151 db_thread->message_loop_proxy(), | 151 io_thread->message_loop_proxy().get(), |
152 NULL), | 152 db_thread->message_loop_proxy().get(), |
153 async_(false) {} | 153 NULL), |
| 154 async_(false) {} |
154 | 155 |
155 virtual void GetUsageAndQuota( | 156 virtual void GetUsageAndQuota( |
156 const GURL& origin, | 157 const GURL& origin, |
157 quota::StorageType type, | 158 quota::StorageType type, |
158 const GetUsageAndQuotaCallback& callback) OVERRIDE { | 159 const GetUsageAndQuotaCallback& callback) OVERRIDE { |
159 EXPECT_EQ(kOrigin, origin); | 160 EXPECT_EQ(kOrigin, origin); |
160 EXPECT_EQ(quota::kStorageTypeTemporary, type); | 161 EXPECT_EQ(quota::kStorageTypeTemporary, type); |
161 if (async_) { | 162 if (async_) { |
162 base::MessageLoop::current()->PostTask( | 163 base::MessageLoop::current()->PostTask( |
163 FROM_HERE, | 164 FROM_HERE, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 io_thread->message_loop()->PostTask( | 275 io_thread->message_loop()->PostTask( |
275 FROM_HERE, base::Bind(&AppCacheStorageImplTest::MethodWrapper<Method>, | 276 FROM_HERE, base::Bind(&AppCacheStorageImplTest::MethodWrapper<Method>, |
276 base::Unretained(this), method)); | 277 base::Unretained(this), method)); |
277 test_finished_event_->Wait(); | 278 test_finished_event_->Wait(); |
278 } | 279 } |
279 | 280 |
280 void SetUpTest() { | 281 void SetUpTest() { |
281 DCHECK(base::MessageLoop::current() == io_thread->message_loop()); | 282 DCHECK(base::MessageLoop::current() == io_thread->message_loop()); |
282 service_.reset(new AppCacheService(NULL)); | 283 service_.reset(new AppCacheService(NULL)); |
283 service_->Initialize( | 284 service_->Initialize( |
284 base::FilePath(), db_thread->message_loop_proxy(), NULL); | 285 base::FilePath(), db_thread->message_loop_proxy().get(), NULL); |
285 mock_quota_manager_proxy_ = new MockQuotaManagerProxy(); | 286 mock_quota_manager_proxy_ = new MockQuotaManagerProxy(); |
286 service_->quota_manager_proxy_ = mock_quota_manager_proxy_; | 287 service_->quota_manager_proxy_ = mock_quota_manager_proxy_; |
287 delegate_.reset(new MockStorageDelegate(this)); | 288 delegate_.reset(new MockStorageDelegate(this)); |
288 } | 289 } |
289 | 290 |
290 void TearDownTest() { | 291 void TearDownTest() { |
291 DCHECK(base::MessageLoop::current() == io_thread->message_loop()); | 292 DCHECK(base::MessageLoop::current() == io_thread->message_loop()); |
292 storage()->CancelDelegateCallbacks(delegate()); | 293 storage()->CancelDelegateCallbacks(delegate()); |
293 group_ = NULL; | 294 group_ = NULL; |
294 cache_ = NULL; | 295 cache_ = NULL; |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 } | 1637 } |
1637 | 1638 |
1638 TEST_F(AppCacheStorageImplTest, FindFallbackPatternMatchInDatabase) { | 1639 TEST_F(AppCacheStorageImplTest, FindFallbackPatternMatchInDatabase) { |
1639 RunTestOnIOThread( | 1640 RunTestOnIOThread( |
1640 &AppCacheStorageImplTest::FindFallbackPatternMatchInDatabase); | 1641 &AppCacheStorageImplTest::FindFallbackPatternMatchInDatabase); |
1641 } | 1642 } |
1642 | 1643 |
1643 // That's all folks! | 1644 // That's all folks! |
1644 | 1645 |
1645 } // namespace appcache | 1646 } // namespace appcache |
OLD | NEW |