Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1516)

Unified Diff: content/browser/service_worker/service_worker_storage_unittest.cc

Issue 2569353003: Make ServiceWorkerStorage's UserData functions call LazyInitialize (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_storage.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_storage_unittest.cc
diff --git a/content/browser/service_worker/service_worker_storage_unittest.cc b/content/browser/service_worker/service_worker_storage_unittest.cc
index 97312a56b215b6f58f0c3c2ff678d31b1e82fdbc..fb743e953f94995c5c7b288ad777f5ccd2cf6313 100644
--- a/content/browser/service_worker/service_worker_storage_unittest.cc
+++ b/content/browser/service_worker/service_worker_storage_unittest.cc
@@ -1096,6 +1096,35 @@ TEST_P(ServiceWorkerStorageTestP, StoreUserData) {
GetUserDataForAllRegistrations(std::string(), &data_list_out));
}
+// The *_BeforeInitialize tests exercise the API before LazyInitialize() is
+// called.
+TEST_P(ServiceWorkerStorageTestP, StoreUserData_BeforeInitialize) {
+ const int kRegistrationId = 0;
+ EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND,
+ StoreUserData(kRegistrationId, GURL("https://example.com"),
+ {{"key", "data"}}));
+}
+
+TEST_P(ServiceWorkerStorageTestP, GetUserData_BeforeInitialize) {
+ const int kRegistrationId = 0;
+ std::vector<std::string> data_out;
+ EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND,
+ GetUserData(kRegistrationId, {"key"}, &data_out));
+}
+
+TEST_P(ServiceWorkerStorageTestP, ClearUserData_BeforeInitialize) {
+ const int kRegistrationId = 0;
+ EXPECT_EQ(SERVICE_WORKER_OK, ClearUserData(kRegistrationId, {"key"}));
+}
+
+TEST_P(ServiceWorkerStorageTestP,
+ GetUserDataForAllRegistrations_BeforeInitialize) {
+ std::vector<std::pair<int64_t, std::string>> data_list_out;
+ EXPECT_EQ(SERVICE_WORKER_OK,
+ GetUserDataForAllRegistrations("key", &data_list_out));
+ EXPECT_TRUE(data_list_out.empty());
+}
+
class ServiceWorkerResourceStorageTest : public ServiceWorkerStorageTestP {
public:
void SetUp() override {
« no previous file with comments | « content/browser/service_worker/service_worker_storage.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698