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/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 data3.version_id = 102; | 988 data3.version_id = 102; |
989 | 989 |
990 std::vector<Resource> resources3; | 990 std::vector<Resource> resources3; |
991 resources3.push_back(CreateResource(5, URL(origin2, "/resource5"))); | 991 resources3.push_back(CreateResource(5, URL(origin2, "/resource5"))); |
992 resources3.push_back(CreateResource(6, URL(origin2, "/resource6"))); | 992 resources3.push_back(CreateResource(6, URL(origin2, "/resource6"))); |
993 ASSERT_EQ( | 993 ASSERT_EQ( |
994 ServiceWorkerDatabase::STATUS_OK, | 994 ServiceWorkerDatabase::STATUS_OK, |
995 database->WriteRegistration( | 995 database->WriteRegistration( |
996 data3, resources3, &deleted_version_id, &newly_purgeable_resources)); | 996 data3, resources3, &deleted_version_id, &newly_purgeable_resources)); |
997 | 997 |
998 std::set<GURL> origin_to_delete; | |
999 origin_to_delete.insert(GURL(origin1)); | |
michaeln
2014/10/08 01:22:27
origin1 is of type GURL so no need to construct a
falken
2014/10/08 02:36:44
Oops, that was leftover from trying to make the se
| |
998 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, | 1000 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
999 database->DeleteAllDataForOrigin(origin1, | 1001 database->DeleteAllDataForOrigins(origin_to_delete, |
1000 &newly_purgeable_resources)); | 1002 &newly_purgeable_resources)); |
1001 | 1003 |
1002 // |origin1| should be removed from the unique origin list. | 1004 // |origin1| should be removed from the unique origin list. |
1003 std::set<GURL> unique_origins; | 1005 std::set<GURL> unique_origins; |
1004 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, | 1006 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, |
1005 database->GetOriginsWithRegistrations(&unique_origins)); | 1007 database->GetOriginsWithRegistrations(&unique_origins)); |
1006 EXPECT_EQ(1u, unique_origins.size()); | 1008 EXPECT_EQ(1u, unique_origins.size()); |
1007 EXPECT_TRUE(ContainsKey(unique_origins, origin2)); | 1009 EXPECT_TRUE(ContainsKey(unique_origins, origin2)); |
1008 | 1010 |
1009 // The registrations for |origin1| should be removed. | 1011 // The registrations for |origin1| should be removed. |
1010 std::vector<RegistrationData> registrations; | 1012 std::vector<RegistrationData> registrations; |
(...skipping 27 matching lines...) Expand all Loading... | |
1038 CreateDatabase(database_dir.path())); | 1040 CreateDatabase(database_dir.path())); |
1039 | 1041 |
1040 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->LazyOpen(true)); | 1042 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->LazyOpen(true)); |
1041 ASSERT_TRUE(base::DirectoryExists(database_dir.path())); | 1043 ASSERT_TRUE(base::DirectoryExists(database_dir.path())); |
1042 | 1044 |
1043 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->DestroyDatabase()); | 1045 EXPECT_EQ(ServiceWorkerDatabase::STATUS_OK, database->DestroyDatabase()); |
1044 ASSERT_FALSE(base::DirectoryExists(database_dir.path())); | 1046 ASSERT_FALSE(base::DirectoryExists(database_dir.path())); |
1045 } | 1047 } |
1046 | 1048 |
1047 } // namespace content | 1049 } // namespace content |
OLD | NEW |