| 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/indexed_db/indexed_db_context_impl.h" | 8 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 9 #include "content/browser/indexed_db/webidbdatabase_impl.h" |
| 9 #include "content/public/browser/storage_partition.h" | 10 #include "content/public/browser/storage_partition.h" |
| 10 #include "content/public/common/url_constants.h" | 11 #include "content/public/common/url_constants.h" |
| 11 #include "content/public/test/test_browser_context.h" | 12 #include "content/public/test/test_browser_context.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "third_party/WebKit/public/platform/WebIDBDatabase.h" | 14 #include "third_party/WebKit/public/platform/WebIDBDatabase.h" |
| 14 #include "webkit/base/origin_url_conversions.h" | 15 #include "webkit/base/origin_url_conversions.h" |
| 15 #include "webkit/browser/quota/mock_special_storage_policy.h" | 16 #include "webkit/browser/quota/mock_special_storage_policy.h" |
| 16 #include "webkit/browser/quota/quota_manager.h" | 17 #include "webkit/browser/quota/quota_manager.h" |
| 17 #include "webkit/browser/quota/special_storage_policy.h" | 18 #include "webkit/browser/quota/special_storage_policy.h" |
| 18 | 19 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 120 } |
| 120 | 121 |
| 121 // Make sure we wait until the destructor has run. | 122 // Make sure we wait until the destructor has run. |
| 122 message_loop_.RunUntilIdle(); | 123 message_loop_.RunUntilIdle(); |
| 123 | 124 |
| 124 // No data was cleared because of SetForceKeepSessionState. | 125 // No data was cleared because of SetForceKeepSessionState. |
| 125 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); | 126 EXPECT_TRUE(file_util::DirectoryExists(normal_path)); |
| 126 EXPECT_TRUE(file_util::DirectoryExists(session_only_path)); | 127 EXPECT_TRUE(file_util::DirectoryExists(session_only_path)); |
| 127 } | 128 } |
| 128 | 129 |
| 129 class MockWebIDBDatabase : public WebKit::WebIDBDatabase { | 130 class MockWebIDBDatabase : public WebIDBDatabaseImpl { |
| 130 public: | 131 public: |
| 131 explicit MockWebIDBDatabase(bool expect_force_close) | 132 explicit MockWebIDBDatabase(bool expect_force_close) |
| 132 : expect_force_close_(expect_force_close), force_close_called_(false) {} | 133 : WebIDBDatabaseImpl(NULL, NULL), |
| 134 expect_force_close_(expect_force_close), |
| 135 force_close_called_(false) {} |
| 133 | 136 |
| 134 virtual ~MockWebIDBDatabase() { | 137 virtual ~MockWebIDBDatabase() { |
| 135 EXPECT_TRUE(force_close_called_ == expect_force_close_); | 138 EXPECT_TRUE(force_close_called_ == expect_force_close_); |
| 136 } | 139 } |
| 137 | 140 |
| 138 virtual void forceClose() { | 141 virtual void forceClose() OVERRIDE { |
| 139 ASSERT_TRUE(expect_force_close_); | 142 ASSERT_TRUE(expect_force_close_); |
| 140 force_close_called_ = true; | 143 force_close_called_ = true; |
| 141 } | 144 } |
| 142 | 145 |
| 143 private: | 146 private: |
| 144 bool expect_force_close_; | 147 bool expect_force_close_; |
| 145 bool force_close_called_; | 148 bool force_close_called_; |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { | 151 TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 message_loop_.RunUntilIdle(); | 186 message_loop_.RunUntilIdle(); |
| 184 } | 187 } |
| 185 | 188 |
| 186 // Make sure we wait until the destructor has run. | 189 // Make sure we wait until the destructor has run. |
| 187 message_loop_.RunUntilIdle(); | 190 message_loop_.RunUntilIdle(); |
| 188 | 191 |
| 189 EXPECT_FALSE(file_util::DirectoryExists(test_path)); | 192 EXPECT_FALSE(file_util::DirectoryExists(test_path)); |
| 190 } | 193 } |
| 191 | 194 |
| 192 } // namespace content | 195 } // namespace content |
| OLD | NEW |