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