| 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 "chrome/test/base/testing_browser_process.h" | |
| 10 #include "chrome/test/base/testing_browser_process_test.h" | |
| 11 #include "content/browser/appcache/chrome_appcache_service.h" | 9 #include "content/browser/appcache/chrome_appcache_service.h" |
| 12 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "webkit/appcache/appcache_database.h" | 12 #include "webkit/appcache/appcache_database.h" |
| 15 #include "webkit/appcache/appcache_storage_impl.h" | 13 #include "webkit/appcache/appcache_storage_impl.h" |
| 16 #include "webkit/appcache/appcache_test_helper.h" | 14 #include "webkit/appcache/appcache_test_helper.h" |
| 17 #include "webkit/quota/mock_special_storage_policy.h" | 15 #include "webkit/quota/mock_special_storage_policy.h" |
| 18 | 16 |
| 19 #include <set> | 17 #include <set> |
| 20 | 18 |
| 21 namespace { | 19 namespace { |
| 22 const FilePath::CharType kTestingAppCacheDirname[] = | 20 const FilePath::CharType kTestingAppCacheDirname[] = |
| 23 FILE_PATH_LITERAL("Application Cache"); | 21 FILE_PATH_LITERAL("Application Cache"); |
| 24 | 22 |
| 25 // Examples of a protected and an unprotected origin, to be used througout the | 23 // Examples of a protected and an unprotected origin, to be used througout the |
| 26 // test. | 24 // test. |
| 27 const char kProtectedManifest[] = "http://www.protected.com/cache.manifest"; | 25 const char kProtectedManifest[] = "http://www.protected.com/cache.manifest"; |
| 28 const char kNormalManifest[] = "http://www.normal.com/cache.manifest"; | 26 const char kNormalManifest[] = "http://www.normal.com/cache.manifest"; |
| 29 | 27 |
| 30 } // namespace | 28 } // namespace |
| 31 | 29 |
| 32 namespace appcache { | 30 namespace appcache { |
| 33 | 31 |
| 34 class ChromeAppCacheServiceTest : public TestingBrowserProcessTest { | 32 class ChromeAppCacheServiceTest : public testing::Test { |
| 35 public: | 33 public: |
| 36 ChromeAppCacheServiceTest() | 34 ChromeAppCacheServiceTest() |
| 37 : message_loop_(MessageLoop::TYPE_IO), | 35 : message_loop_(MessageLoop::TYPE_IO), |
| 38 kProtectedManifestURL(kProtectedManifest), | 36 kProtectedManifestURL(kProtectedManifest), |
| 39 kNormalManifestURL(kNormalManifest), | 37 kNormalManifestURL(kNormalManifest), |
| 40 db_thread_(BrowserThread::DB, &message_loop_), | 38 db_thread_(BrowserThread::DB, &message_loop_), |
| 41 file_thread_(BrowserThread::FILE, &message_loop_), | 39 file_thread_(BrowserThread::FILE, &message_loop_), |
| 42 cache_thread_(BrowserThread::CACHE, &message_loop_), | 40 cache_thread_(BrowserThread::CACHE, &message_loop_), |
| 43 io_thread_(BrowserThread::IO, &message_loop_) { | 41 io_thread_(BrowserThread::IO, &message_loop_) { |
| 44 } | 42 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 EXPECT_EQ(1UL, origins.size()); | 168 EXPECT_EQ(1UL, origins.size()); |
| 171 EXPECT_TRUE(origins.find(kProtectedManifestURL.GetOrigin()) != origins.end()); | 169 EXPECT_TRUE(origins.find(kProtectedManifestURL.GetOrigin()) != origins.end()); |
| 172 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) == origins.end()); | 170 EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) == origins.end()); |
| 173 | 171 |
| 174 // Delete and let cleanup tasks run prior to returning. | 172 // Delete and let cleanup tasks run prior to returning. |
| 175 appcache_service = NULL; | 173 appcache_service = NULL; |
| 176 message_loop_.RunAllPending(); | 174 message_loop_.RunAllPending(); |
| 177 } | 175 } |
| 178 | 176 |
| 179 } // namespace appcache | 177 } // namespace appcache |
| OLD | NEW |