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 | 5 |
6 #include "webkit/dom_storage/session_storage_database.h" | 6 #include "webkit/dom_storage/session_storage_database.h" |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 // Delete the newly created namespace. | 844 // Delete the newly created namespace. |
845 EXPECT_TRUE(db_->DeleteNamespace(1)); | 845 EXPECT_TRUE(db_->DeleteNamespace(1)); |
846 | 846 |
847 // Namespace 1 is empty. | 847 // Namespace 1 is empty. |
848 CheckAreaData(1, kOrigin1, ValuesMap()); | 848 CheckAreaData(1, kOrigin1, ValuesMap()); |
849 | 849 |
850 // The values for the old namespace 1 are still accessible via id -1. | 850 // The values for the old namespace 1 are still accessible via id -1. |
851 CheckAreaData(-1, kOrigin1, data1); | 851 CheckAreaData(-1, kOrigin1, data1); |
852 } | 852 } |
853 | 853 |
| 854 TEST_F(SessionStorageDatabaseTest, DeleteNamespaceConfusion) { |
| 855 // Regression test for a bug where a namespace with id 10 prevented deleting |
| 856 // the namespace with id 1. |
| 857 |
| 858 // Create namespace with IDs 0 to 10. The real IDs in the DB will correspond |
| 859 // to these IDs. |
| 860 ValuesMap data1; |
| 861 data1[kKey1] = kValue1; |
| 862 for (int i = 0; i <= 10; ++i) |
| 863 ASSERT_TRUE(db_->CommitAreaChanges(i, kOrigin1, false, data1)); |
| 864 |
| 865 // Delete the namespace with ID 1. |
| 866 EXPECT_TRUE(db_->DeleteNamespace(1)); |
| 867 } |
| 868 |
854 } // namespace dom_storage | 869 } // namespace dom_storage |
OLD | NEW |