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.h" | 9 #include "base/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_(MessageLoop::TYPE_IO), | 66 : message_loop_(base::MessageLoop::TYPE_IO), |
67 kProtectedManifestURL(kProtectedManifest), | 67 kProtectedManifestURL(kProtectedManifest), |
68 kNormalManifestURL(kNormalManifest), | 68 kNormalManifestURL(kNormalManifest), |
69 kSessionOnlyManifestURL(kSessionOnlyManifest), | 69 kSessionOnlyManifestURL(kSessionOnlyManifest), |
70 file_thread_(BrowserThread::FILE, &message_loop_), | 70 file_thread_(BrowserThread::FILE, &message_loop_), |
71 file_user_blocking_thread_( | 71 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, |
72 BrowserThread::FILE_USER_BLOCKING, &message_loop_), | 72 &message_loop_), |
73 cache_thread_(BrowserThread::CACHE, &message_loop_), | 73 cache_thread_(BrowserThread::CACHE, &message_loop_), |
74 io_thread_(BrowserThread::IO, &message_loop_) { | 74 io_thread_(BrowserThread::IO, &message_loop_) {} |
75 } | |
76 | 75 |
77 protected: | 76 protected: |
78 scoped_refptr<ChromeAppCacheService> CreateAppCacheService( | 77 scoped_refptr<ChromeAppCacheService> CreateAppCacheService( |
79 const base::FilePath& appcache_path, | 78 const base::FilePath& appcache_path, |
80 bool init_storage); | 79 bool init_storage); |
81 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); | 80 void InsertDataIntoAppCache(ChromeAppCacheService* appcache_service); |
82 | 81 |
83 MessageLoop message_loop_; | 82 base::MessageLoop message_loop_; |
84 base::ScopedTempDir temp_dir_; | 83 base::ScopedTempDir temp_dir_; |
85 const GURL kProtectedManifestURL; | 84 const GURL kProtectedManifestURL; |
86 const GURL kNormalManifestURL; | 85 const GURL kNormalManifestURL; |
87 const GURL kSessionOnlyManifestURL; | 86 const GURL kSessionOnlyManifestURL; |
88 | 87 |
89 private: | 88 private: |
90 BrowserThreadImpl file_thread_; | 89 BrowserThreadImpl file_thread_; |
91 BrowserThreadImpl file_user_blocking_thread_; | 90 BrowserThreadImpl file_user_blocking_thread_; |
92 BrowserThreadImpl cache_thread_; | 91 BrowserThreadImpl cache_thread_; |
93 BrowserThreadImpl io_thread_; | 92 BrowserThreadImpl io_thread_; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); | 215 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end()); |
217 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != | 216 EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) != |
218 origins.end()); | 217 origins.end()); |
219 | 218 |
220 // Delete and let cleanup tasks run prior to returning. | 219 // Delete and let cleanup tasks run prior to returning. |
221 appcache_service = NULL; | 220 appcache_service = NULL; |
222 message_loop_.RunUntilIdle(); | 221 message_loop_.RunUntilIdle(); |
223 } | 222 } |
224 | 223 |
225 } // namespace content | 224 } // namespace content |
OLD | NEW |