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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 AppCacheEntry found_fallback_entry_; | 125 AppCacheEntry found_fallback_entry_; |
126 int64 found_cache_id_; | 126 int64 found_cache_id_; |
127 int64 found_group_id_; | 127 int64 found_group_id_; |
128 GURL found_manifest_url_; | 128 GURL found_manifest_url_; |
129 AppCacheStorageImplTest* test_; | 129 AppCacheStorageImplTest* test_; |
130 }; | 130 }; |
131 | 131 |
132 class MockQuotaManager : public quota::QuotaManager { | 132 class MockQuotaManager : public quota::QuotaManager { |
133 public: | 133 public: |
134 MockQuotaManager() | 134 MockQuotaManager() |
135 : QuotaManager(true /* is_incognito */, FilePath(), | 135 : QuotaManager(true /* is_incognito */, base::FilePath(), |
136 io_thread->message_loop_proxy(), | 136 io_thread->message_loop_proxy(), |
137 db_thread->message_loop_proxy(), | 137 db_thread->message_loop_proxy(), |
138 NULL), | 138 NULL), |
139 async_(false) {} | 139 async_(false) {} |
140 | 140 |
141 virtual void GetUsageAndQuota( | 141 virtual void GetUsageAndQuota( |
142 const GURL& origin, quota::StorageType type, | 142 const GURL& origin, quota::StorageType type, |
143 const GetUsageAndQuotaCallback& callback) OVERRIDE { | 143 const GetUsageAndQuotaCallback& callback) OVERRIDE { |
144 EXPECT_EQ(kOrigin, origin); | 144 EXPECT_EQ(kOrigin, origin); |
145 EXPECT_EQ(quota::kStorageTypeTemporary, type); | 145 EXPECT_EQ(quota::kStorageTypeTemporary, type); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 test_finished_event_ .reset(new base::WaitableEvent(false, false)); | 254 test_finished_event_ .reset(new base::WaitableEvent(false, false)); |
255 io_thread->message_loop()->PostTask( | 255 io_thread->message_loop()->PostTask( |
256 FROM_HERE, base::Bind(&AppCacheStorageImplTest::MethodWrapper<Method>, | 256 FROM_HERE, base::Bind(&AppCacheStorageImplTest::MethodWrapper<Method>, |
257 base::Unretained(this), method)); | 257 base::Unretained(this), method)); |
258 test_finished_event_->Wait(); | 258 test_finished_event_->Wait(); |
259 } | 259 } |
260 | 260 |
261 void SetUpTest() { | 261 void SetUpTest() { |
262 DCHECK(MessageLoop::current() == io_thread->message_loop()); | 262 DCHECK(MessageLoop::current() == io_thread->message_loop()); |
263 service_.reset(new AppCacheService(NULL)); | 263 service_.reset(new AppCacheService(NULL)); |
264 service_->Initialize(FilePath(), db_thread->message_loop_proxy(), NULL); | 264 service_->Initialize(base::FilePath(), db_thread->message_loop_proxy(), NULL
); |
265 mock_quota_manager_proxy_ = new MockQuotaManagerProxy(); | 265 mock_quota_manager_proxy_ = new MockQuotaManagerProxy(); |
266 service_->quota_manager_proxy_ = mock_quota_manager_proxy_; | 266 service_->quota_manager_proxy_ = mock_quota_manager_proxy_; |
267 delegate_.reset(new MockStorageDelegate(this)); | 267 delegate_.reset(new MockStorageDelegate(this)); |
268 } | 268 } |
269 | 269 |
270 void TearDownTest() { | 270 void TearDownTest() { |
271 DCHECK(MessageLoop::current() == io_thread->message_loop()); | 271 DCHECK(MessageLoop::current() == io_thread->message_loop()); |
272 storage()->CancelDelegateCallbacks(delegate()); | 272 storage()->CancelDelegateCallbacks(delegate()); |
273 group_ = NULL; | 273 group_ = NULL; |
274 cache_ = NULL; | 274 cache_ = NULL; |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 } | 1409 } |
1410 | 1410 |
1411 TEST_F(AppCacheStorageImplTest, FindMainResponseExclusionsInWorkingSet) { | 1411 TEST_F(AppCacheStorageImplTest, FindMainResponseExclusionsInWorkingSet) { |
1412 RunTestOnIOThread( | 1412 RunTestOnIOThread( |
1413 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet); | 1413 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet); |
1414 } | 1414 } |
1415 | 1415 |
1416 // That's all folks! | 1416 // That's all folks! |
1417 | 1417 |
1418 } // namespace appcache | 1418 } // namespace appcache |
OLD | NEW |