Index: content/browser/service_worker/service_worker_database_unittest.cc |
diff --git a/content/browser/service_worker/service_worker_database_unittest.cc b/content/browser/service_worker/service_worker_database_unittest.cc |
index 84424f7d980ccb74ed5a53eb7ef01687612ce9c5..e38930366318f4323ce62b3a8b05033d9101d652 100644 |
--- a/content/browser/service_worker/service_worker_database_unittest.cc |
+++ b/content/browser/service_worker/service_worker_database_unittest.cc |
@@ -406,9 +406,12 @@ TEST(ServiceWorkerDatabaseTest, GetRegistrationsForOrigin) { |
GURL origin3("https://example.org"); |
std::vector<RegistrationData> registrations; |
+ std::vector<std::vector<Resource>> resources_list; |
EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
- database->GetRegistrationsForOrigin(origin1, ®istrations)); |
+ database->GetRegistrationsForOrigin(origin1, ®istrations, |
+ &resources_list)); |
EXPECT_TRUE(registrations.empty()); |
+ EXPECT_TRUE(resources_list.empty()); |
ServiceWorkerDatabase::RegistrationData deleted_version; |
std::vector<int64> newly_purgeable_resources; |
@@ -425,6 +428,16 @@ TEST(ServiceWorkerDatabaseTest, GetRegistrationsForOrigin) { |
database->WriteRegistration(data1, resources1, &deleted_version, |
&newly_purgeable_resources)); |
+ registrations.clear(); |
+ resources_list.clear(); |
+ EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
+ database->GetRegistrationsForOrigin(origin1, ®istrations, |
+ &resources_list)); |
+ EXPECT_EQ(1U, registrations.size()); |
+ VerifyRegistrationData(data1, registrations[0]); |
+ EXPECT_EQ(1U, resources_list.size()); |
+ VerifyResourceRecords(resources1, resources_list[0]); |
+ |
RegistrationData data2; |
data2.registration_id = 200; |
data2.scope = URL(origin2, "/bar"); |
@@ -437,6 +450,16 @@ TEST(ServiceWorkerDatabaseTest, GetRegistrationsForOrigin) { |
database->WriteRegistration(data2, resources2, &deleted_version, |
&newly_purgeable_resources)); |
+ registrations.clear(); |
+ resources_list.clear(); |
+ EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
+ database->GetRegistrationsForOrigin(origin2, ®istrations, |
+ &resources_list)); |
+ EXPECT_EQ(1U, registrations.size()); |
+ VerifyRegistrationData(data2, registrations[0]); |
+ EXPECT_EQ(1U, resources_list.size()); |
+ VerifyResourceRecords(resources2, resources_list[0]); |
+ |
RegistrationData data3; |
data3.registration_id = 300; |
data3.scope = URL(origin3, "/hoge"); |
@@ -463,11 +486,25 @@ TEST(ServiceWorkerDatabaseTest, GetRegistrationsForOrigin) { |
&newly_purgeable_resources)); |
registrations.clear(); |
+ resources_list.clear(); |
EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
- database->GetRegistrationsForOrigin(origin3, ®istrations)); |
+ database->GetRegistrationsForOrigin(origin3, ®istrations, |
+ &resources_list)); |
EXPECT_EQ(2U, registrations.size()); |
VerifyRegistrationData(data3, registrations[0]); |
VerifyRegistrationData(data4, registrations[1]); |
+ EXPECT_EQ(2U, resources_list.size()); |
+ VerifyResourceRecords(resources3, resources_list[0]); |
+ VerifyResourceRecords(resources4, resources_list[1]); |
+ |
+ // The third parameter |opt_resources_list| to GetRegistrationsForOrigin() |
+ // is optional. So, nullptr should be acceptable. |
+ registrations.clear(); |
+ EXPECT_EQ( |
+ ServiceWorkerDatabase::STATUS_OK, |
+ database->GetRegistrationsForOrigin(origin1, ®istrations, nullptr)); |
+ EXPECT_EQ(1U, registrations.size()); |
+ VerifyRegistrationData(data1, registrations[0]); |
} |
TEST(ServiceWorkerDatabaseTest, GetAllRegistrations) { |
@@ -1471,8 +1508,9 @@ TEST(ServiceWorkerDatabaseTest, DeleteAllDataForOrigin) { |
// The registrations for |origin1| should be removed. |
std::vector<RegistrationData> registrations; |
- EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
- database->GetRegistrationsForOrigin(origin1, ®istrations)); |
+ EXPECT_EQ( |
+ ServiceWorkerDatabase::STATUS_OK, |
+ database->GetRegistrationsForOrigin(origin1, ®istrations, nullptr)); |
EXPECT_TRUE(registrations.empty()); |
GURL origin_out; |
EXPECT_EQ( |