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/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "content/browser/appcache/chrome_appcache_service.h" | 10 #include "content/browser/appcache/chrome_appcache_service.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 bool init_storage) { | 99 bool init_storage) { |
100 scoped_refptr<ChromeAppCacheService> appcache_service = | 100 scoped_refptr<ChromeAppCacheService> appcache_service = |
101 new ChromeAppCacheService(NULL); | 101 new ChromeAppCacheService(NULL); |
102 scoped_refptr<quota::MockSpecialStoragePolicy> mock_policy = | 102 scoped_refptr<quota::MockSpecialStoragePolicy> mock_policy = |
103 new quota::MockSpecialStoragePolicy; | 103 new quota::MockSpecialStoragePolicy; |
104 mock_policy->AddProtected(kProtectedManifestURL.GetOrigin()); | 104 mock_policy->AddProtected(kProtectedManifestURL.GetOrigin()); |
105 mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin()); | 105 mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin()); |
106 scoped_refptr<MockURLRequestContextGetter> mock_request_context_getter = | 106 scoped_refptr<MockURLRequestContextGetter> mock_request_context_getter = |
107 new MockURLRequestContextGetter( | 107 new MockURLRequestContextGetter( |
108 browser_context_.GetResourceContext()->GetRequestContext(), | 108 browser_context_.GetResourceContext()->GetRequestContext(), |
109 message_loop_.message_loop_proxy()); | 109 message_loop_.message_loop_proxy().get()); |
110 BrowserThread::PostTask( | 110 BrowserThread::PostTask( |
111 BrowserThread::IO, FROM_HERE, | 111 BrowserThread::IO, |
| 112 FROM_HERE, |
112 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 113 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, |
113 appcache_service.get(), appcache_path, | 114 appcache_service.get(), |
| 115 appcache_path, |
114 browser_context_.GetResourceContext(), | 116 browser_context_.GetResourceContext(), |
115 mock_request_context_getter, | 117 mock_request_context_getter, |
116 mock_policy)); | 118 mock_policy)); |
117 // Steps needed to initialize the storage of AppCache data. | 119 // Steps needed to initialize the storage of AppCache data. |
118 message_loop_.RunUntilIdle(); | 120 message_loop_.RunUntilIdle(); |
119 if (init_storage) { | 121 if (init_storage) { |
120 appcache::AppCacheStorageImpl* storage = | 122 appcache::AppCacheStorageImpl* storage = |
121 static_cast<appcache::AppCacheStorageImpl*>( | 123 static_cast<appcache::AppCacheStorageImpl*>( |
122 appcache_service->storage()); | 124 appcache_service->storage()); |
123 storage->database_->db_connection(); | 125 storage->database_->db_connection(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); | 217 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); |
216 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != | 218 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != |
217 origins.end()); | 219 origins.end()); |
218 | 220 |
219 // Delete and let cleanup tasks run prior to returning. | 221 // Delete and let cleanup tasks run prior to returning. |
220 appcache_service = NULL; | 222 appcache_service = NULL; |
221 message_loop_.RunUntilIdle(); | 223 message_loop_.RunUntilIdle(); |
222 } | 224 } |
223 | 225 |
224 } // namespace content | 226 } // namespace content |
OLD | NEW |