| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/indexed_db/indexed_db_factory.h" | 5 #include "content/browser/indexed_db/indexed_db_factory.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 mem_store2 = NULL; | 156 mem_store2 = NULL; |
| 157 EXPECT_TRUE(mem_store1->HasOneRef()); | 157 EXPECT_TRUE(mem_store1->HasOneRef()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TEST_F(IndexedDBFactoryTest, RejectLongOrigins) { | 160 TEST_F(IndexedDBFactoryTest, RejectLongOrigins) { |
| 161 base::ScopedTempDir temp_directory; | 161 base::ScopedTempDir temp_directory; |
| 162 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 162 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
| 163 const base::FilePath base_path = temp_directory.path(); | 163 const base::FilePath base_path = temp_directory.path(); |
| 164 scoped_refptr<MockIDBFactory> factory = new MockIDBFactory(); | 164 scoped_refptr<MockIDBFactory> factory = new MockIDBFactory(); |
| 165 | 165 |
| 166 int limit = file_util::GetMaximumPathComponentLength(base_path); | 166 int limit = base::GetMaximumPathComponentLength(base_path); |
| 167 EXPECT_GT(limit, 0); | 167 EXPECT_GT(limit, 0); |
| 168 | 168 |
| 169 std::string origin(limit + 1, 'x'); | 169 std::string origin(limit + 1, 'x'); |
| 170 GURL too_long_origin("http://" + origin + ":81/"); | 170 GURL too_long_origin("http://" + origin + ":81/"); |
| 171 scoped_refptr<IndexedDBBackingStore> diskStore1 = | 171 scoped_refptr<IndexedDBBackingStore> diskStore1 = |
| 172 factory->TestOpenBackingStore(too_long_origin, base_path); | 172 factory->TestOpenBackingStore(too_long_origin, base_path); |
| 173 EXPECT_FALSE(diskStore1); | 173 EXPECT_FALSE(diskStore1); |
| 174 | 174 |
| 175 GURL ok_origin("http://someorigin.com:82/"); | 175 GURL ok_origin("http://someorigin.com:82/"); |
| 176 scoped_refptr<IndexedDBBackingStore> diskStore2 = | 176 scoped_refptr<IndexedDBBackingStore> diskStore2 = |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 origin, | 472 origin, |
| 473 temp_directory.path()); | 473 temp_directory.path()); |
| 474 EXPECT_FALSE(factory->IsDatabaseOpen(origin, db_name)); | 474 EXPECT_FALSE(factory->IsDatabaseOpen(origin, db_name)); |
| 475 } | 475 } |
| 476 | 476 |
| 477 // Terminate all pending-close timers. | 477 // Terminate all pending-close timers. |
| 478 factory->ForceClose(origin); | 478 factory->ForceClose(origin); |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace content | 481 } // namespace content |
| OLD | NEW |