| 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/chrome_appcache_service.h" | 10 #include "content/browser/appcache/chrome_appcache_service.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 private: | 56 private: |
| 57 net::URLRequestContext* context_; | 57 net::URLRequestContext* context_; |
| 58 scoped_refptr<base::SingleThreadTaskRunner> message_loop_proxy_; | 58 scoped_refptr<base::SingleThreadTaskRunner> message_loop_proxy_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 class ChromeAppCacheServiceTest : public testing::Test { | 63 class ChromeAppCacheServiceTest : public testing::Test { |
| 64 public: | 64 public: |
| 65 ChromeAppCacheServiceTest() | 65 ChromeAppCacheServiceTest() |
| 66 : message_loop_(base::MessageLoop::TYPE_IO), | 66 : kProtectedManifestURL(kProtectedManifest), |
| 67 kProtectedManifestURL(kProtectedManifest), | |
| 68 kNormalManifestURL(kNormalManifest), | 67 kNormalManifestURL(kNormalManifest), |
| 69 kSessionOnlyManifestURL(kSessionOnlyManifest), | 68 kSessionOnlyManifestURL(kSessionOnlyManifest), |
| 70 file_thread_(BrowserThread::FILE, &message_loop_), | 69 file_thread_(BrowserThread::FILE, &message_loop_), |
| 71 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, | 70 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, |
| 72 &message_loop_), | 71 &message_loop_), |
| 73 cache_thread_(BrowserThread::CACHE, &message_loop_), | 72 cache_thread_(BrowserThread::CACHE, &message_loop_), |
| 74 io_thread_(BrowserThread::IO, &message_loop_) {} | 73 io_thread_(BrowserThread::IO, &message_loop_) {} |
| 75 | 74 |
| 76 protected: | 75 protected: |
| 77 scoped_refptr<ChromeAppCacheService> CreateAppCacheService( | 76 scoped_refptr<ChromeAppCacheService> CreateAppCacheService( |
| 78 const base::FilePath& appcache_path, | 77 const base::FilePath& appcache_path, |
| 79 bool init_storage); | 78 bool init_storage); |
| 80 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); | 79 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); |
| 81 | 80 |
| 82 base::MessageLoop message_loop_; | 81 base::MessageLoopForIO message_loop_; |
| 83 base::ScopedTempDir temp_dir_; | 82 base::ScopedTempDir temp_dir_; |
| 84 const GURL kProtectedManifestURL; | 83 const GURL kProtectedManifestURL; |
| 85 const GURL kNormalManifestURL; | 84 const GURL kNormalManifestURL; |
| 86 const GURL kSessionOnlyManifestURL; | 85 const GURL kSessionOnlyManifestURL; |
| 87 | 86 |
| 88 private: | 87 private: |
| 89 BrowserThreadImpl file_thread_; | 88 BrowserThreadImpl file_thread_; |
| 90 BrowserThreadImpl file_user_blocking_thread_; | 89 BrowserThreadImpl file_user_blocking_thread_; |
| 91 BrowserThreadImpl cache_thread_; | 90 BrowserThreadImpl cache_thread_; |
| 92 BrowserThreadImpl io_thread_; | 91 BrowserThreadImpl io_thread_; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); | 216 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); |
| 218 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != | 217 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != |
| 219 origins.end()); | 218 origins.end()); |
| 220 | 219 |
| 221 // Delete and let cleanup tasks run prior to returning. | 220 // Delete and let cleanup tasks run prior to returning. |
| 222 appcache_service = NULL; | 221 appcache_service = NULL; |
| 223 message_loop_.RunUntilIdle(); | 222 message_loop_.RunUntilIdle(); |
| 224 } | 223 } |
| 225 | 224 |
| 226 } // namespace content | 225 } // namespace content |
| OLD | NEW |