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 | 5 |
6 #include "content/browser/dom_storage/session_storage_database.h" | 6 #include "content/browser/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/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "content/common/dom_storage/dom_storage_types.h" | 17 #include "content/common/dom_storage/dom_storage_types.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 "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 class SessionStorageDatabaseTest : public testing::Test { | 26 class SessionStorageDatabaseTest : public testing::Test { |
27 public: | 27 public: |
28 SessionStorageDatabaseTest(); | 28 SessionStorageDatabaseTest(); |
29 virtual ~SessionStorageDatabaseTest(); | 29 virtual ~SessionStorageDatabaseTest(); |
30 virtual void SetUp() OVERRIDE; | 30 virtual void SetUp() override; |
31 | 31 |
32 protected: | 32 protected: |
33 typedef std::map<std::string, std::string> DataMap; | 33 typedef std::map<std::string, std::string> DataMap; |
34 | 34 |
35 // Helpers. | 35 // Helpers. |
36 static bool IsNamespaceKey(const std::string& key, | 36 static bool IsNamespaceKey(const std::string& key, |
37 std::string* namespace_id); | 37 std::string* namespace_id); |
38 static bool IsNamespaceOriginKey(const std::string& key, | 38 static bool IsNamespaceOriginKey(const std::string& key, |
39 std::string* namespace_id); | 39 std::string* namespace_id); |
40 static bool IsMapRefCountKey(const std::string& key, | 40 static bool IsMapRefCountKey(const std::string& key, |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 ASSERT_TRUE(db_->CommitAreaChanges(kNamespace1, kOrigin2, false, data2)); | 790 ASSERT_TRUE(db_->CommitAreaChanges(kNamespace1, kOrigin2, false, data2)); |
791 | 791 |
792 EXPECT_TRUE(db_->DeleteArea(kNamespace1, kOrigin1)); | 792 EXPECT_TRUE(db_->DeleteArea(kNamespace1, kOrigin1)); |
793 EXPECT_TRUE(db_->DeleteArea(kNamespace1, kOrigin2)); | 793 EXPECT_TRUE(db_->DeleteArea(kNamespace1, kOrigin2)); |
794 // Check that also the namespace start key was deleted. | 794 // Check that also the namespace start key was deleted. |
795 CheckDatabaseConsistency(); | 795 CheckDatabaseConsistency(); |
796 } | 796 } |
797 | 797 |
798 | 798 |
799 } // namespace content | 799 } // namespace content |
OLD | NEW |