| 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/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 new ChromeAppCacheService(NULL); | 95 new ChromeAppCacheService(NULL); |
| 96 scoped_refptr<MockSpecialStoragePolicy> mock_policy = | 96 scoped_refptr<MockSpecialStoragePolicy> mock_policy = |
| 97 new MockSpecialStoragePolicy; | 97 new MockSpecialStoragePolicy; |
| 98 mock_policy->AddProtected(kProtectedManifestURL.GetOrigin()); | 98 mock_policy->AddProtected(kProtectedManifestURL.GetOrigin()); |
| 99 mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin()); | 99 mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin()); |
| 100 scoped_refptr<MockURLRequestContextGetter> mock_request_context_getter = | 100 scoped_refptr<MockURLRequestContextGetter> mock_request_context_getter = |
| 101 new MockURLRequestContextGetter( | 101 new MockURLRequestContextGetter( |
| 102 browser_context_.GetResourceContext()->GetRequestContext(), | 102 browser_context_.GetResourceContext()->GetRequestContext(), |
| 103 message_loop_.task_runner().get()); | 103 message_loop_.task_runner().get()); |
| 104 BrowserThread::PostTask( | 104 BrowserThread::PostTask( |
| 105 BrowserThread::IO, | 105 BrowserThread::IO, FROM_HERE, |
| 106 FROM_HERE, | |
| 107 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 106 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, |
| 108 appcache_service.get(), | 107 appcache_service.get(), appcache_path, |
| 109 appcache_path, | |
| 110 browser_context_.GetResourceContext(), | 108 browser_context_.GetResourceContext(), |
| 111 mock_request_context_getter, | 109 base::RetainedRef(mock_request_context_getter), mock_policy)); |
| 112 mock_policy)); | |
| 113 // Steps needed to initialize the storage of AppCache data. | 110 // Steps needed to initialize the storage of AppCache data. |
| 114 message_loop_.RunUntilIdle(); | 111 message_loop_.RunUntilIdle(); |
| 115 if (init_storage) { | 112 if (init_storage) { |
| 116 AppCacheStorageImpl* storage = | 113 AppCacheStorageImpl* storage = |
| 117 static_cast<AppCacheStorageImpl*>( | 114 static_cast<AppCacheStorageImpl*>( |
| 118 appcache_service->storage()); | 115 appcache_service->storage()); |
| 119 storage->database_->db_connection(); | 116 storage->database_->db_connection(); |
| 120 storage->disk_cache(); | 117 storage->disk_cache(); |
| 121 message_loop_.RunUntilIdle(); | 118 message_loop_.RunUntilIdle(); |
| 122 } | 119 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); | 208 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); |
| 212 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != | 209 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != |
| 213 origins.end()); | 210 origins.end()); |
| 214 | 211 |
| 215 // Delete and let cleanup tasks run prior to returning. | 212 // Delete and let cleanup tasks run prior to returning. |
| 216 appcache_service = NULL; | 213 appcache_service = NULL; |
| 217 message_loop_.RunUntilIdle(); | 214 message_loop_.RunUntilIdle(); |
| 218 } | 215 } |
| 219 | 216 |
| 220 } // namespace content | 217 } // namespace content |
| OLD | NEW |