| 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
| 8 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 8 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
| 9 #include "content/public/browser/storage_partition.h" | 9 #include "content/public/browser/storage_partition.h" |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 private: | 35 private: |
| 36 BrowserThreadImpl webkit_thread_; | 36 BrowserThreadImpl webkit_thread_; |
| 37 BrowserThreadImpl file_thread_; | 37 BrowserThreadImpl file_thread_; |
| 38 BrowserThreadImpl io_thread_; | 38 BrowserThreadImpl io_thread_; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) { | 41 TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) { |
| 42 base::ScopedTempDir temp_dir; | 42 base::ScopedTempDir temp_dir; |
| 43 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 43 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 44 | 44 |
| 45 FilePath normal_path; | 45 base::FilePath normal_path; |
| 46 FilePath session_only_path; | 46 base::FilePath session_only_path; |
| 47 | 47 |
| 48 // Create the scope which will ensure we run the destructor of the webkit | 48 // Create the scope which will ensure we run the destructor of the webkit |
| 49 // context which should trigger the clean up. | 49 // context which should trigger the clean up. |
| 50 { | 50 { |
| 51 TestBrowserContext browser_context; | 51 TestBrowserContext browser_context; |
| 52 | 52 |
| 53 const GURL kNormalOrigin("http://normal/"); | 53 const GURL kNormalOrigin("http://normal/"); |
| 54 const GURL kSessionOnlyOrigin("http://session-only/"); | 54 const GURL kSessionOnlyOrigin("http://session-only/"); |
| 55 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 55 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
| 56 new quota::MockSpecialStoragePolicy; | 56 new quota::MockSpecialStoragePolicy; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 79 message_loop_.RunUntilIdle(); | 79 message_loop_.RunUntilIdle(); |
| 80 | 80 |
| 81 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); | 81 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); |
| 82 EXPECT_FALSE(file_util::DirectoryExists(session_only_path)); | 82 EXPECT_FALSE(file_util::DirectoryExists(session_only_path)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 TEST_F(IndexedDBTest, SetForceKeepSessionState) { | 85 TEST_F(IndexedDBTest, SetForceKeepSessionState) { |
| 86 base::ScopedTempDir temp_dir; | 86 base::ScopedTempDir temp_dir; |
| 87 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 87 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 88 | 88 |
| 89 FilePath normal_path; | 89 base::FilePath normal_path; |
| 90 FilePath session_only_path; | 90 base::FilePath session_only_path; |
| 91 | 91 |
| 92 // Create the scope which will ensure we run the destructor of the webkit | 92 // Create the scope which will ensure we run the destructor of the webkit |
| 93 // context. | 93 // context. |
| 94 { | 94 { |
| 95 TestBrowserContext browser_context; | 95 TestBrowserContext browser_context; |
| 96 | 96 |
| 97 const GURL kNormalOrigin("http://normal/"); | 97 const GURL kNormalOrigin("http://normal/"); |
| 98 const GURL kSessionOnlyOrigin("http://session-only/"); | 98 const GURL kSessionOnlyOrigin("http://session-only/"); |
| 99 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 99 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
| 100 new quota::MockSpecialStoragePolicy; | 100 new quota::MockSpecialStoragePolicy; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 private: | 152 private: |
| 153 bool expect_force_close_; | 153 bool expect_force_close_; |
| 154 bool force_close_called_; | 154 bool force_close_called_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 | 157 |
| 158 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { | 158 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { |
| 159 base::ScopedTempDir temp_dir; | 159 base::ScopedTempDir temp_dir; |
| 160 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 160 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 161 | 161 |
| 162 FilePath test_path; | 162 base::FilePath test_path; |
| 163 | 163 |
| 164 // Create the scope which will ensure we run the destructor of the webkit | 164 // Create the scope which will ensure we run the destructor of the webkit |
| 165 // context. | 165 // context. |
| 166 { | 166 { |
| 167 TestBrowserContext browser_context; | 167 TestBrowserContext browser_context; |
| 168 | 168 |
| 169 const GURL kTestOrigin("http://test/"); | 169 const GURL kTestOrigin("http://test/"); |
| 170 | 170 |
| 171 IndexedDBContextImpl* idb_context = | 171 IndexedDBContextImpl* idb_context = |
| 172 static_cast<IndexedDBContextImpl*>( | 172 static_cast<IndexedDBContextImpl*>( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 194 message_loop_.RunUntilIdle(); | 194 message_loop_.RunUntilIdle(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // Make sure we wait until the destructor has run. | 197 // Make sure we wait until the destructor has run. |
| 198 message_loop_.RunUntilIdle(); | 198 message_loop_.RunUntilIdle(); |
| 199 | 199 |
| 200 EXPECT_FALSE(file_util::DirectoryExists(test_path)); | 200 EXPECT_FALSE(file_util::DirectoryExists(test_path)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace content | 203 } // namespace content |
| OLD | NEW |