| 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/appcache/chrome_appcache_service.h" | 9 #include "content/browser/appcache/chrome_appcache_service.h" |
| 10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 namespace appcache { | 31 namespace appcache { |
| 32 | 32 |
| 33 class ChromeAppCacheServiceTest : public testing::Test { | 33 class ChromeAppCacheServiceTest : public testing::Test { |
| 34 public: | 34 public: |
| 35 ChromeAppCacheServiceTest() | 35 ChromeAppCacheServiceTest() |
| 36 : message_loop_(MessageLoop::TYPE_IO), | 36 : message_loop_(MessageLoop::TYPE_IO), |
| 37 kProtectedManifestURL(kProtectedManifest), | 37 kProtectedManifestURL(kProtectedManifest), |
| 38 kNormalManifestURL(kNormalManifest), | 38 kNormalManifestURL(kNormalManifest), |
| 39 kSessionOnlyManifestURL(kSessionOnlyManifest), | 39 kSessionOnlyManifestURL(kSessionOnlyManifest), |
| 40 db_thread_(BrowserThread::DB, &message_loop_), | 40 appcache_thread_(BrowserThread::APPCACHE, &message_loop_), |
| 41 file_thread_(BrowserThread::FILE, &message_loop_), | 41 file_thread_(BrowserThread::FILE, &message_loop_), |
| 42 cache_thread_(BrowserThread::CACHE, &message_loop_), | 42 cache_thread_(BrowserThread::CACHE, &message_loop_), |
| 43 io_thread_(BrowserThread::IO, &message_loop_) { | 43 io_thread_(BrowserThread::IO, &message_loop_) { |
| 44 } | 44 } |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 scoped_refptr<ChromeAppCacheService> CreateAppCacheService( | 47 scoped_refptr<ChromeAppCacheService> CreateAppCacheService( |
| 48 const FilePath& appcache_path, | 48 const FilePath& appcache_path, |
| 49 bool init_storage); | 49 bool init_storage); |
| 50 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); | 50 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); |
| 51 | 51 |
| 52 MessageLoop message_loop_; | 52 MessageLoop message_loop_; |
| 53 ScopedTempDir temp_dir_; | 53 ScopedTempDir temp_dir_; |
| 54 const GURL kProtectedManifestURL; | 54 const GURL kProtectedManifestURL; |
| 55 const GURL kNormalManifestURL; | 55 const GURL kNormalManifestURL; |
| 56 const GURL kSessionOnlyManifestURL; | 56 const GURL kSessionOnlyManifestURL; |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 BrowserThread db_thread_; | 59 BrowserThread appcache_thread_; |
| 60 BrowserThread file_thread_; | 60 BrowserThread file_thread_; |
| 61 BrowserThread cache_thread_; | 61 BrowserThread cache_thread_; |
| 62 BrowserThread io_thread_; | 62 BrowserThread io_thread_; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 scoped_refptr<ChromeAppCacheService> | 65 scoped_refptr<ChromeAppCacheService> |
| 66 ChromeAppCacheServiceTest::CreateAppCacheService( | 66 ChromeAppCacheServiceTest::CreateAppCacheService( |
| 67 const FilePath& appcache_path, | 67 const FilePath& appcache_path, |
| 68 bool init_storage) { | 68 bool init_storage) { |
| 69 scoped_refptr<ChromeAppCacheService> appcache_service = | 69 scoped_refptr<ChromeAppCacheService> appcache_service = |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) == origins.end()); | 179 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) == origins.end()); |
| 180 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) == | 180 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) == |
| 181 origins.end()); | 181 origins.end()); |
| 182 | 182 |
| 183 // Delete and let cleanup tasks run prior to returning. | 183 // Delete and let cleanup tasks run prior to returning. |
| 184 appcache_service = NULL; | 184 appcache_service = NULL; |
| 185 message_loop_.RunAllPending(); | 185 message_loop_.RunAllPending(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace appcache | 188 } // namespace appcache |
| OLD | NEW |