| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "content/browser/browser_thread_impl.h" |
| 9 #include "content/browser/appcache/chrome_appcache_service.h" | 10 #include "content/browser/appcache/chrome_appcache_service.h" |
| 10 #include "content/test/test_browser_thread.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "webkit/appcache/appcache_database.h" | 12 #include "webkit/appcache/appcache_database.h" |
| 13 #include "webkit/appcache/appcache_storage_impl.h" | 13 #include "webkit/appcache/appcache_storage_impl.h" |
| 14 #include "webkit/appcache/appcache_test_helper.h" | 14 #include "webkit/appcache/appcache_test_helper.h" |
| 15 #include "webkit/quota/mock_special_storage_policy.h" | 15 #include "webkit/quota/mock_special_storage_policy.h" |
| 16 | 16 |
| 17 #include <set> | 17 #include <set> |
| 18 | 18 |
| 19 using content::BrowserThreadImpl; |
| 20 |
| 19 namespace { | 21 namespace { |
| 20 const FilePath::CharType kTestingAppCacheDirname[] = | 22 const FilePath::CharType kTestingAppCacheDirname[] = |
| 21 FILE_PATH_LITERAL("Application Cache"); | 23 FILE_PATH_LITERAL("Application Cache"); |
| 22 | 24 |
| 23 // Examples of a protected and an unprotected origin, to be used througout the | 25 // Examples of a protected and an unprotected origin, to be used througout the |
| 24 // test. | 26 // test. |
| 25 const char kProtectedManifest[] = "http://www.protected.com/cache.manifest"; | 27 const char kProtectedManifest[] = "http://www.protected.com/cache.manifest"; |
| 26 const char kNormalManifest[] = "http://www.normal.com/cache.manifest"; | 28 const char kNormalManifest[] = "http://www.normal.com/cache.manifest"; |
| 27 const char kSessionOnlyManifest[] = "http://www.sessiononly.com/cache.manifest"; | 29 const char kSessionOnlyManifest[] = "http://www.sessiononly.com/cache.manifest"; |
| 28 | 30 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 49 bool init_storage); | 51 bool init_storage); |
| 50 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); | 52 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); |
| 51 | 53 |
| 52 MessageLoop message_loop_; | 54 MessageLoop message_loop_; |
| 53 ScopedTempDir temp_dir_; | 55 ScopedTempDir temp_dir_; |
| 54 const GURL kProtectedManifestURL; | 56 const GURL kProtectedManifestURL; |
| 55 const GURL kNormalManifestURL; | 57 const GURL kNormalManifestURL; |
| 56 const GURL kSessionOnlyManifestURL; | 58 const GURL kSessionOnlyManifestURL; |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 content::TestBrowserThread db_thread_; | 61 BrowserThreadImpl db_thread_; |
| 60 content::TestBrowserThread file_thread_; | 62 BrowserThreadImpl file_thread_; |
| 61 content::TestBrowserThread cache_thread_; | 63 BrowserThreadImpl cache_thread_; |
| 62 content::TestBrowserThread io_thread_; | 64 BrowserThreadImpl io_thread_; |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 scoped_refptr<ChromeAppCacheService> | 67 scoped_refptr<ChromeAppCacheService> |
| 66 ChromeAppCacheServiceTest::CreateAppCacheService( | 68 ChromeAppCacheServiceTest::CreateAppCacheService( |
| 67 const FilePath& appcache_path, | 69 const FilePath& appcache_path, |
| 68 bool init_storage) { | 70 bool init_storage) { |
| 69 scoped_refptr<ChromeAppCacheService> appcache_service = | 71 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 70 new ChromeAppCacheService(NULL); | 72 new ChromeAppCacheService(NULL); |
| 71 const content::ResourceContext* resource_context = NULL; | 73 const content::ResourceContext* resource_context = NULL; |
| 72 scoped_refptr<quota::MockSpecialStoragePolicy> mock_policy = | 74 scoped_refptr<quota::MockSpecialStoragePolicy> mock_policy = |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) == origins.end()); | 181 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) == origins.end()); |
| 180 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) == | 182 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) == |
| 181 origins.end()); | 183 origins.end()); |
| 182 | 184 |
| 183 // Delete and let cleanup tasks run prior to returning. | 185 // Delete and let cleanup tasks run prior to returning. |
| 184 appcache_service = NULL; | 186 appcache_service = NULL; |
| 185 message_loop_.RunAllPending(); | 187 message_loop_.RunAllPending(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace appcache | 190 } // namespace appcache |
| OLD | NEW |