Commit 907a06d2 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

Update ServiceWorkerStorageTest.StoreUserData test

To remove ServiceWorker{Registration,Version} dependencies from
the test so that the test can be moved to the Storage Service.

Bug: 1016064
Change-Id: Ic1653d69e432bcbcf4f50e725a7c3e70bf29f637
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2467260Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816833}
parent 8521a09f
......@@ -890,19 +890,19 @@ TEST_F(ServiceWorkerStorageTest, StoreFindUpdateDeleteRegistration) {
}
TEST_F(ServiceWorkerStorageTest, StoreUserData) {
const int64_t kRegistrationId = 1;
const GURL kScope("http://www.test.not/scope/");
const url::Origin kOrigin = url::Origin::Create(kScope);
const GURL kScript("http://www.test.not/script.js");
LazyInitialize();
// Store a registration.
scoped_refptr<ServiceWorkerRegistration> live_registration =
CreateServiceWorkerRegistrationAndVersion(context(), kScope, kScript,
/*resource_id=*/1);
EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk,
StoreRegistration(live_registration,
live_registration->waiting_version()));
const int64_t kRegistrationId = live_registration->id();
std::vector<ResourceRecord> resources;
resources.push_back(CreateResourceRecord(1, kScript, 100));
storage::mojom::ServiceWorkerRegistrationDataPtr registration_data =
CreateRegistrationData(kRegistrationId,
/*version_id=*/1, kScope, kScript, resources);
StoreRegistrationData(std::move(registration_data), std::move(resources));
// Store user data associated with the registration.
std::vector<std::string> data_out;
......@@ -998,8 +998,8 @@ TEST_F(ServiceWorkerStorageTest, StoreUserData) {
ASSERT_EQ(1u, data_out.size());
ASSERT_EQ("data", data_out[0]);
EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk,
DeleteRegistration(live_registration, kScope.GetOrigin()));
EXPECT_EQ(ServiceWorkerDatabase::Status::kOk,
DeleteRegistrationById(kRegistrationId, kScope.GetOrigin()));
EXPECT_EQ(blink::ServiceWorkerStatusCode::kErrorNotFound,
GetUserData(kRegistrationId, {"key"}, &data_out));
data_list_out.clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment