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> |
11 | 11 |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/scoped_temp_dir.h" | |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 19 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
20 #include "third_party/leveldatabase/src/include/leveldb/iterator.h" | 20 #include "third_party/leveldatabase/src/include/leveldb/iterator.h" |
21 #include "third_party/leveldatabase/src/include/leveldb/options.h" | 21 #include "third_party/leveldatabase/src/include/leveldb/options.h" |
22 #include "webkit/dom_storage/dom_storage_types.h" | 22 #include "webkit/dom_storage/dom_storage_types.h" |
23 | 23 |
24 namespace dom_storage { | 24 namespace dom_storage { |
(...skipping 27 matching lines...) Expand all Loading... |
52 void CompareValuesMaps(const ValuesMap& map1, const ValuesMap& map2) const; | 52 void CompareValuesMaps(const ValuesMap& map1, const ValuesMap& map2) const; |
53 void CheckNamespaceIds( | 53 void CheckNamespaceIds( |
54 const std::set<std::string>& expected_namespace_ids) const; | 54 const std::set<std::string>& expected_namespace_ids) const; |
55 void CheckOrigins( | 55 void CheckOrigins( |
56 const std::string& namespace_id, | 56 const std::string& namespace_id, |
57 const std::set<GURL>& expected_origins) const; | 57 const std::set<GURL>& expected_origins) const; |
58 std::string GetMapForArea(const std::string& namespace_id, | 58 std::string GetMapForArea(const std::string& namespace_id, |
59 const GURL& origin) const; | 59 const GURL& origin) const; |
60 int64 GetMapRefCount(const std::string& map_id) const; | 60 int64 GetMapRefCount(const std::string& map_id) const; |
61 | 61 |
62 ScopedTempDir temp_dir_; | 62 base::ScopedTempDir temp_dir_; |
63 scoped_refptr<SessionStorageDatabase> db_; | 63 scoped_refptr<SessionStorageDatabase> db_; |
64 | 64 |
65 // Test data. | 65 // Test data. |
66 const GURL kOrigin1; | 66 const GURL kOrigin1; |
67 const GURL kOrigin2; | 67 const GURL kOrigin2; |
68 const std::string kNamespace1; | 68 const std::string kNamespace1; |
69 const std::string kNamespace2; | 69 const std::string kNamespace2; |
70 const std::string kNamespaceClone; | 70 const std::string kNamespaceClone; |
71 const string16 kKey1; | 71 const string16 kKey1; |
72 const string16 kKey2; | 72 const string16 kKey2; |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 CheckOrigins(kNamespaceClone, expected_origins1); | 767 CheckOrigins(kNamespaceClone, expected_origins1); |
768 | 768 |
769 ASSERT_TRUE(db_->DeleteArea(kNamespace1, kOrigin2)); | 769 ASSERT_TRUE(db_->DeleteArea(kNamespace1, kOrigin2)); |
770 expected_origins1.erase(kOrigin2); | 770 expected_origins1.erase(kOrigin2); |
771 CheckOrigins(kNamespace1, expected_origins1); | 771 CheckOrigins(kNamespace1, expected_origins1); |
772 | 772 |
773 CheckDatabaseConsistency(); | 773 CheckDatabaseConsistency(); |
774 } | 774 } |
775 | 775 |
776 } // namespace dom_storage | 776 } // namespace dom_storage |
OLD | NEW |