OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/service_worker/service_worker_database.h" | 5 #include "content/browser/service_worker/service_worker_database.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 resources2.push_back(CreateResource(3, URL(origin, "/resource3"))); | 621 resources2.push_back(CreateResource(3, URL(origin, "/resource3"))); |
622 resources2.push_back(CreateResource(4, URL(origin, "/resource4"))); | 622 resources2.push_back(CreateResource(4, URL(origin, "/resource4"))); |
623 | 623 |
624 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, | 624 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
625 database->WriteRegistration(updated_data, | 625 database->WriteRegistration(updated_data, |
626 resources2, | 626 resources2, |
627 &deleted_version_id, | 627 &deleted_version_id, |
628 &newly_purgeable_resources)); | 628 &newly_purgeable_resources)); |
629 EXPECT_EQ(data.version_id, deleted_version_id); | 629 EXPECT_EQ(data.version_id, deleted_version_id); |
630 ASSERT_EQ(resources1.size(), newly_purgeable_resources.size()); | 630 ASSERT_EQ(resources1.size(), newly_purgeable_resources.size()); |
631 for(size_t i = 0; i < resources1.size(); ++i) | 631 for (size_t i = 0; i < resources1.size(); ++i) |
632 EXPECT_EQ(newly_purgeable_resources[i], resources1[i].resource_id); | 632 EXPECT_EQ(newly_purgeable_resources[i], resources1[i].resource_id); |
633 | 633 |
634 // Make sure that |updated_data| is stored and resources referred from |data| | 634 // Make sure that |updated_data| is stored and resources referred from |data| |
635 // is moved to the purgeable list. | 635 // is moved to the purgeable list. |
636 resources_out.clear(); | 636 resources_out.clear(); |
637 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->ReadRegistration( | 637 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->ReadRegistration( |
638 updated_data.registration_id, origin, &data_out, &resources_out)); | 638 updated_data.registration_id, origin, &data_out, &resources_out)); |
639 VerifyRegistrationData(updated_data, data_out); | 639 VerifyRegistrationData(updated_data, data_out); |
640 VerifyResourceRecords(resources2, resources_out); | 640 VerifyResourceRecords(resources2, resources_out); |
641 | 641 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 CreateDatabase(database_dir.path())); | 1038 CreateDatabase(database_dir.path())); |
1039 | 1039 |
1040 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->LazyOpen(true)); | 1040 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->LazyOpen(true)); |
1041 ASSERT_TRUE(base::DirectoryExists(database_dir.path())); | 1041 ASSERT_TRUE(base::DirectoryExists(database_dir.path())); |
1042 | 1042 |
1043 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->DestroyDatabase()); | 1043 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->DestroyDatabase()); |
1044 ASSERT_FALSE(base::DirectoryExists(database_dir.path())); | 1044 ASSERT_FALSE(base::DirectoryExists(database_dir.path())); |
1045 } | 1045 } |
1046 | 1046 |
1047 } // namespace content | 1047 } // namespace content |
OLD | NEW |