| 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 "webkit/dom_storage/dom_storage_database.h" | 5 #include "webkit/dom_storage/dom_storage_database.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 string16 kCannedKeys[] = { | 84 string16 kCannedKeys[] = { |
| 85 ASCIIToUTF16("test"), | 85 ASCIIToUTF16("test"), |
| 86 ASCIIToUTF16("company"), | 86 ASCIIToUTF16("company"), |
| 87 ASCIIToUTF16("date"), | 87 ASCIIToUTF16("date"), |
| 88 ASCIIToUTF16("empty") | 88 ASCIIToUTF16("empty") |
| 89 }; | 89 }; |
| 90 NullableString16 kCannedValues[] = { | 90 NullableString16 kCannedValues[] = { |
| 91 NullableString16(ASCIIToUTF16("123"), false), | 91 NullableString16(ASCIIToUTF16("123"), false), |
| 92 NullableString16(ASCIIToUTF16("Google"), false), | 92 NullableString16(ASCIIToUTF16("Google"), false), |
| 93 NullableString16(ASCIIToUTF16("18-01-2012"), false), | 93 NullableString16(ASCIIToUTF16("18-01-2012"), false), |
| 94 NullableString16(ASCIIToUTF16(""), false) | 94 NullableString16(string16(), false) |
| 95 }; | 95 }; |
| 96 for (unsigned i = 0; i < sizeof(kCannedKeys) / sizeof(kCannedKeys[0]); i++) | 96 for (unsigned i = 0; i < sizeof(kCannedKeys) / sizeof(kCannedKeys[0]); i++) |
| 97 (*values)[kCannedKeys[i]] = kCannedValues[i]; | 97 (*values)[kCannedKeys[i]] = kCannedValues[i]; |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST(DomStorageDatabaseTest, SimpleOpenAndClose) { | 100 TEST(DomStorageDatabaseTest, SimpleOpenAndClose) { |
| 101 DomStorageDatabase db; | 101 DomStorageDatabase db; |
| 102 EXPECT_FALSE(db.IsOpen()); | 102 EXPECT_FALSE(db.IsOpen()); |
| 103 ASSERT_TRUE(db.LazyOpen(true)); | 103 ASSERT_TRUE(db.LazyOpen(true)); |
| 104 EXPECT_TRUE(db.IsOpen()); | 104 EXPECT_TRUE(db.IsOpen()); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 db.ReadAllValues(&values); | 368 db.ReadAllValues(&values); |
| 369 EXPECT_EQ(0u, values.size()); | 369 EXPECT_EQ(0u, values.size()); |
| 370 EXPECT_FALSE(db.IsOpen()); | 370 EXPECT_FALSE(db.IsOpen()); |
| 371 | 371 |
| 372 EXPECT_TRUE(file_util::PathExists(temp_dir.path())); | 372 EXPECT_TRUE(file_util::PathExists(temp_dir.path())); |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace dom_storage | 376 } // namespace dom_storage |
| OLD | NEW |