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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
11 #include "content/browser/appcache/chrome_appcache_service.h" | 11 #include "content/browser/appcache/chrome_appcache_service.h" |
| 12 #include "content/public/browser/storage_partition.h" |
12 #include "content/public/test/test_browser_context.h" | 13 #include "content/public/test/test_browser_context.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "webkit/appcache/appcache_database.h" | 15 #include "webkit/appcache/appcache_database.h" |
15 #include "webkit/appcache/appcache_storage_impl.h" | 16 #include "webkit/appcache/appcache_storage_impl.h" |
16 #include "webkit/appcache/appcache_test_helper.h" | 17 #include "webkit/appcache/appcache_test_helper.h" |
17 #include "webkit/quota/mock_special_storage_policy.h" | 18 #include "webkit/quota/mock_special_storage_policy.h" |
18 | 19 |
19 #include <set> | 20 #include <set> |
20 | 21 |
21 using content::BrowserThread; | 22 using content::BrowserThread; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 scoped_refptr<ChromeAppCacheService> appcache_service = | 77 scoped_refptr<ChromeAppCacheService> appcache_service = |
77 new ChromeAppCacheService(NULL); | 78 new ChromeAppCacheService(NULL); |
78 scoped_refptr<quota::MockSpecialStoragePolicy> mock_policy = | 79 scoped_refptr<quota::MockSpecialStoragePolicy> mock_policy = |
79 new quota::MockSpecialStoragePolicy; | 80 new quota::MockSpecialStoragePolicy; |
80 mock_policy->AddProtected(kProtectedManifestURL.GetOrigin()); | 81 mock_policy->AddProtected(kProtectedManifestURL.GetOrigin()); |
81 mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin()); | 82 mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin()); |
82 BrowserThread::PostTask( | 83 BrowserThread::PostTask( |
83 BrowserThread::IO, FROM_HERE, | 84 BrowserThread::IO, FROM_HERE, |
84 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 85 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, |
85 appcache_service.get(), appcache_path, | 86 appcache_service.get(), appcache_path, |
86 browser_context_.GetResourceContext(), mock_policy)); | 87 content::BrowserContext::GetDefaultStoragePartition( |
| 88 &browser_context_)->GetResourceContext(), |
| 89 mock_policy)); |
87 // Steps needed to initialize the storage of AppCache data. | 90 // Steps needed to initialize the storage of AppCache data. |
88 message_loop_.RunAllPending(); | 91 message_loop_.RunAllPending(); |
89 if (init_storage) { | 92 if (init_storage) { |
90 appcache::AppCacheStorageImpl* storage = | 93 appcache::AppCacheStorageImpl* storage = |
91 static_cast<appcache::AppCacheStorageImpl*>( | 94 static_cast<appcache::AppCacheStorageImpl*>( |
92 appcache_service->storage()); | 95 appcache_service->storage()); |
93 storage->database_->db_connection(); | 96 storage->database_->db_connection(); |
94 storage->disk_cache(); | 97 storage->disk_cache(); |
95 message_loop_.RunAllPending(); | 98 message_loop_.RunAllPending(); |
96 } | 99 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); | 186 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); |
184 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != | 187 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != |
185 origins.end()); | 188 origins.end()); |
186 | 189 |
187 // Delete and let cleanup tasks run prior to returning. | 190 // Delete and let cleanup tasks run prior to returning. |
188 appcache_service = NULL; | 191 appcache_service = NULL; |
189 message_loop_.RunAllPending(); | 192 message_loop_.RunAllPending(); |
190 } | 193 } |
191 | 194 |
192 } // namespace appcache | 195 } // namespace appcache |
OLD | NEW |