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) { ...@@ -890,19 +890,19 @@ TEST_F(ServiceWorkerStorageTest, StoreFindUpdateDeleteRegistration) {
} }
TEST_F(ServiceWorkerStorageTest, StoreUserData) { TEST_F(ServiceWorkerStorageTest, StoreUserData) {
const int64_t kRegistrationId = 1;
const GURL kScope("http://www.test.not/scope/"); const GURL kScope("http://www.test.not/scope/");
const url::Origin kOrigin = url::Origin::Create(kScope); const url::Origin kOrigin = url::Origin::Create(kScope);
const GURL kScript("http://www.test.not/script.js"); const GURL kScript("http://www.test.not/script.js");
LazyInitialize(); LazyInitialize();
// Store a registration. // Store a registration.
scoped_refptr<ServiceWorkerRegistration> live_registration = std::vector<ResourceRecord> resources;
CreateServiceWorkerRegistrationAndVersion(context(), kScope, kScript, resources.push_back(CreateResourceRecord(1, kScript, 100));
/*resource_id=*/1); storage::mojom::ServiceWorkerRegistrationDataPtr registration_data =
EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, CreateRegistrationData(kRegistrationId,
StoreRegistration(live_registration, /*version_id=*/1, kScope, kScript, resources);
live_registration->waiting_version())); StoreRegistrationData(std::move(registration_data), std::move(resources));
const int64_t kRegistrationId = live_registration->id();
// Store user data associated with the registration. // Store user data associated with the registration.
std::vector<std::string> data_out; std::vector<std::string> data_out;
...@@ -998,8 +998,8 @@ TEST_F(ServiceWorkerStorageTest, StoreUserData) { ...@@ -998,8 +998,8 @@ TEST_F(ServiceWorkerStorageTest, StoreUserData) {
ASSERT_EQ(1u, data_out.size()); ASSERT_EQ(1u, data_out.size());
ASSERT_EQ("data", data_out[0]); ASSERT_EQ("data", data_out[0]);
EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, EXPECT_EQ(ServiceWorkerDatabase::Status::kOk,
DeleteRegistration(live_registration, kScope.GetOrigin())); DeleteRegistrationById(kRegistrationId, kScope.GetOrigin()));
EXPECT_EQ(blink::ServiceWorkerStatusCode::kErrorNotFound, EXPECT_EQ(blink::ServiceWorkerStatusCode::kErrorNotFound,
GetUserData(kRegistrationId, {"key"}, &data_out)); GetUserData(kRegistrationId, {"key"}, &data_out));
data_list_out.clear(); 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