| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/browser/appcache/appcache_database.h" |
| 11 #include "content/browser/appcache/appcache_storage_impl.h" |
| 10 #include "content/browser/appcache/chrome_appcache_service.h" | 12 #include "content/browser/appcache/chrome_appcache_service.h" |
| 11 #include "content/browser/browser_thread_impl.h" | 13 #include "content/browser/browser_thread_impl.h" |
| 12 #include "content/public/browser/resource_context.h" | 14 #include "content/public/browser/resource_context.h" |
| 13 #include "content/public/test/mock_special_storage_policy.h" | 15 #include "content/public/test/mock_special_storage_policy.h" |
| 14 #include "content/public/test/test_browser_context.h" | 16 #include "content/public/test/test_browser_context.h" |
| 15 #include "content/test/appcache_test_helper.h" | 17 #include "content/test/appcache_test_helper.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "webkit/browser/appcache/appcache_database.h" | |
| 19 #include "webkit/browser/appcache/appcache_storage_impl.h" | |
| 20 | 20 |
| 21 #include <set> | 21 #include <set> |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 namespace { | 24 namespace { |
| 25 const base::FilePath::CharType kTestingAppCacheDirname[] = | 25 const base::FilePath::CharType kTestingAppCacheDirname[] = |
| 26 FILE_PATH_LITERAL("Application Cache"); | 26 FILE_PATH_LITERAL("Application Cache"); |
| 27 | 27 |
| 28 // Examples of a protected and an unprotected origin, to be used througout the | 28 // Examples of a protected and an unprotected origin, to be used througout the |
| 29 // test. | 29 // test. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 FROM_HERE, | 109 FROM_HERE, |
| 110 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 110 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, |
| 111 appcache_service.get(), | 111 appcache_service.get(), |
| 112 appcache_path, | 112 appcache_path, |
| 113 browser_context_.GetResourceContext(), | 113 browser_context_.GetResourceContext(), |
| 114 mock_request_context_getter, | 114 mock_request_context_getter, |
| 115 mock_policy)); | 115 mock_policy)); |
| 116 // Steps needed to initialize the storage of AppCache data. | 116 // Steps needed to initialize the storage of AppCache data. |
| 117 message_loop_.RunUntilIdle(); | 117 message_loop_.RunUntilIdle(); |
| 118 if (init_storage) { | 118 if (init_storage) { |
| 119 appcache::AppCacheStorageImpl* storage = | 119 AppCacheStorageImpl* storage = |
| 120 static_cast<appcache::AppCacheStorageImpl*>( | 120 static_cast<AppCacheStorageImpl*>( |
| 121 appcache_service->storage()); | 121 appcache_service->storage()); |
| 122 storage->database_->db_connection(); | 122 storage->database_->db_connection(); |
| 123 storage->disk_cache(); | 123 storage->disk_cache(); |
| 124 message_loop_.RunUntilIdle(); | 124 message_loop_.RunUntilIdle(); |
| 125 } | 125 } |
| 126 return appcache_service; | 126 return appcache_service; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ChromeAppCacheServiceTest::InsertDataIntoAppCache( | 129 void ChromeAppCacheServiceTest::InsertDataIntoAppCache( |
| 130 ChromeAppCacheService* appcache_service) { | 130 ChromeAppCacheService* appcache_service) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); | 214 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); |
| 215 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != | 215 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != |
| 216 origins.end()); | 216 origins.end()); |
| 217 | 217 |
| 218 // Delete and let cleanup tasks run prior to returning. | 218 // Delete and let cleanup tasks run prior to returning. |
| 219 appcache_service = NULL; | 219 appcache_service = NULL; |
| 220 message_loop_.RunUntilIdle(); | 220 message_loop_.RunUntilIdle(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace content | 223 } // namespace content |
| OLD | NEW |